Ver código fonte

fixed layout, more readable (back to bigger fonts among other)

yattoz 4 anos atrás
pai
commit
a59d57a685

+ 1 - 1
app/src/main/java/fr/forum_thalie/tsumugi/playerstore/PlayerStore.kt Ver arquivo

@@ -229,7 +229,7 @@ class PlayerStore {
229 229
                     val queueJSON =
230 230
                         resMain.getJSONObject("next")
231 231
                     val t = extractSong(queueJSON)
232
-                    if (queue.isNotEmpty() && t == queue.last())
232
+                    if (queue.isNotEmpty() && (t == queue.last() || t == currentSong))
233 233
                     {
234 234
                         //[REMOVE LOG CALLS]Log.d((tag, playerStoreTag +  "Song already in there: $t")
235 235
                         Async(sleepScrape, post)

+ 2 - 10
app/src/main/java/fr/forum_thalie/tsumugi/ui/nowplaying/NowPlayingFragment.kt Ver arquivo

@@ -6,8 +6,6 @@ import android.content.Context
6 6
 import androidx.lifecycle.ViewModelProviders
7 7
 import android.os.Bundle
8 8
 import android.support.v4.media.session.PlaybackStateCompat
9
-import android.util.Log
10
-import android.util.TypedValue
11 9
 import androidx.fragment.app.Fragment
12 10
 import android.view.LayoutInflater
13 11
 import android.view.View
@@ -15,7 +13,6 @@ import android.view.ViewGroup
15 13
 import android.widget.*
16 14
 import androidx.constraintlayout.widget.ConstraintLayout
17 15
 import androidx.constraintlayout.widget.ConstraintSet
18
-import androidx.core.widget.TextViewCompat
19 16
 import androidx.lifecycle.Observer
20 17
 import com.google.android.material.snackbar.BaseTransientBottomBar
21 18
 import com.google.android.material.snackbar.Snackbar
@@ -24,7 +21,6 @@ import fr.forum_thalie.tsumugi.alarm.RadioSleeper
24 21
 import fr.forum_thalie.tsumugi.planning.Planning
25 22
 import fr.forum_thalie.tsumugi.playerstore.PlayerStore
26 23
 import fr.forum_thalie.tsumugi.playerstore.Song
27
-import kotlinx.android.synthetic.main.fragment_nowplaying.*
28 24
 
29 25
 
30 26
 class NowPlayingFragment : Fragment() {
@@ -49,7 +45,7 @@ class NowPlayingFragment : Fragment() {
49 45
         val volumeText: TextView = root.findViewById(R.id.volume_text)
50 46
         val progressBar: ProgressBar = root.findViewById(R.id.progressBar)
51 47
         val volumeIconImage : ImageView = root.findViewById(R.id.volume_icon)
52
-        val currentProgrammeText: TextView  = root.findViewById(R.id.text_current_programme)
48
+        val currentProgrammeText: TextView  = root.findViewById(R.id.current_programme)
53 49
         val streamerPictureImageView: ImageView = root.findViewById(R.id.streamerPicture)
54 50
 
55 51
         // Note: these values are not used in the generic app, but if you want to, you can use them.
@@ -69,10 +65,6 @@ class NowPlayingFragment : Fragment() {
69 65
             listenersText,8, 16, 2, TypedValue.COMPLEX_UNIT_SP)
70 66
          */
71 67
 
72
-        TextViewCompat.setAutoSizeTextTypeUniformWithConfiguration(
73
-            currentProgrammeText,8, 20, 2, TypedValue.COMPLEX_UNIT_SP)
74
-
75
-
76 68
         // trick : I can't observe the queue because it's an ArrayDeque that doesn't trigger any change...
77 69
         // so I observe a dedicated Mutable that gets set when the queue is updated.
78 70
         PlayerStore.instance.isQueueUpdated.observe(viewLifecycleOwner, Observer {
@@ -97,7 +89,7 @@ class NowPlayingFragment : Fragment() {
97 89
 
98 90
 
99 91
         Planning.instance.currentProgramme.observe(viewLifecycleOwner, Observer {
100
-            currentProgrammeText.text = it
92
+            currentProgrammeText.text = "${context!!.getString(R.string.current_programme)} $it"
101 93
         })
102 94
 
103 95
 

+ 55 - 28
app/src/main/res/layout/fragment_nowplaying.xml Ver arquivo

@@ -49,7 +49,7 @@
49 49
             android:layout_width="wrap_content"
50 50
             android:layout_height="wrap_content"
51 51
             android:orientation="vertical"
52
-            app:layout_constraintGuide_percent="0.68" />
52
+            app:layout_constraintGuide_percent="0.71" />
53 53
 
54 54
         <androidx.constraintlayout.widget.Guideline
55 55
             android:id="@+id/imageLeftGuideline"
@@ -140,7 +140,7 @@
140 140
         <ImageView
141 141
             android:id="@+id/volume_icon"
142 142
             android:layout_width="wrap_content"
143
-            android:layout_height="24dp"
143
+            android:layout_height="20dp"
144 144
             android:contentDescription="@string/volume"
145 145
             android:src="@drawable/ic_volume_high"
146 146
             android:textSize="12sp"
@@ -156,10 +156,11 @@
156 156
             android:layout_height="0dp"
157 157
             android:fillViewport="true"
158 158
             android:layout_marginBottom="4dp"
159
-            app:layout_constraintBottom_toTopOf="@id/text_current_programme"
159
+            app:layout_constraintBottom_toTopOf="@id/scrollProgramme"
160 160
             app:layout_constraintEnd_toStartOf="@id/streamerPicture"
161 161
             app:layout_constraintStart_toStartOf="parent"
162
-            app:layout_constraintTop_toBottomOf="@id/seek_bar_volume">
162
+            app:layout_constraintTop_toBottomOf="@id/seek_bar_volume"
163
+            app:layout_constraintVertical_weight="3">
163 164
 
164 165
 
165 166
             <androidx.constraintlayout.widget.ConstraintLayout
@@ -214,35 +215,61 @@
214 215
             </androidx.constraintlayout.widget.ConstraintLayout>
215 216
         </ScrollView>
216 217
 
217
-        <TextView
218
-            android:id="@+id/current_programme"
219
-            android:layout_width="wrap_content"
220
-            android:layout_height="wrap_content"
221
-            android:gravity="bottom"
222
-            android:text="@string/current_programme"
223
-            android:textAlignment="center"
224
-            android:textColor="@color/whited3"
225
-            android:textSize="16sp"
218
+        <ScrollView
219
+            android:id="@+id/scrollProgramme"
220
+            android:layout_width="0dp"
221
+            android:layout_height="0dp"
222
+            android:fillViewport="true"
223
+            android:layout_marginBottom="0dp"
224
+            app:layout_constraintEnd_toEndOf="parent"
226 225
             app:layout_constraintStart_toStartOf="parent"
226
+            app:layout_constraintTop_toBottomOf="@id/scrollViewMetadataNext"
227 227
             app:layout_constraintBottom_toBottomOf="@id/topInfoGuideline"
228
-            android:visibility="visible" />
228
+            app:layout_constraintVertical_weight="1">
229 229
 
230
-        <TextView
231
-            android:id="@+id/text_current_programme"
232
-            android:layout_width="0dp"
230
+
231
+        <androidx.constraintlayout.widget.ConstraintLayout
232
+            android:layout_width="match_parent"
233 233
             android:layout_height="wrap_content"
234
-            android:text=""
235
-            android:layout_marginStart="8sp"
236
-            android:layout_marginLeft="8sp"
237
-            android:gravity="start|bottom"
238
-            android:textAlignment="textStart"
239
-            android:textColor="@color/whited"
240
-            android:textSize="16sp"
241
-            app:layout_constraintStart_toEndOf="@id/current_programme"
242
-            app:layout_constraintEnd_toEndOf="parent"
243
-            app:layout_constraintBottom_toBottomOf="@id/topInfoGuideline"
234
+            android:orientation="vertical"
235
+            android:layout_marginEnd="8dp"
236
+            android:layout_marginRight="8dp"
244 237
             android:visibility="visible"
245
-             />
238
+            >
239
+
240
+            <TextView
241
+                android:id="@+id/current_programme"
242
+                android:layout_width="match_parent"
243
+                android:layout_height="wrap_content"
244
+                android:gravity="top|center_horizontal"
245
+                android:text="@string/current_programme"
246
+                android:textAlignment="center"
247
+                android:textColor="@color/whited3"
248
+                android:textSize="16sp"
249
+                app:layout_constraintStart_toStartOf="parent"
250
+                app:layout_constraintEnd_toEndOf="parent"
251
+                app:layout_constraintTop_toTopOf="parent"
252
+                android:visibility="visible" />
253
+
254
+            <TextView
255
+                android:id="@+id/text_current_programme"
256
+                android:layout_width="0dp"
257
+                android:layout_height="wrap_content"
258
+                android:text=""
259
+                android:layout_marginStart="8sp"
260
+                android:layout_marginLeft="8sp"
261
+                android:gravity="start|center_horizontal"
262
+                android:textAlignment="textStart"
263
+                android:textColor="@color/whited"
264
+                android:textSize="16sp"
265
+                app:layout_constraintStart_toEndOf="@id/current_programme"
266
+                app:layout_constraintEnd_toEndOf="parent"
267
+                app:layout_constraintTop_toTopOf="parent"
268
+                android:visibility="gone"
269
+                />
270
+
271
+        </androidx.constraintlayout.widget.ConstraintLayout>
272
+        </ScrollView>
246 273
 
247 274
         <androidx.constraintlayout.widget.Guideline
248 275
             android:id="@+id/topInfoGuideline"

+ 2 - 2
app/src/main/res/values-fr/strings.xml Ver arquivo

@@ -10,8 +10,8 @@
10 10
 
11 11
     <string name="volume">Volume : </string>
12 12
 
13
-    <string name="up_next">Prochain titre :</string>
14
-    <string name="current_programme">Émission en cours : </string>
13
+    <string name="up_next">À suivre :</string>
14
+    <string name="current_programme">Émission : </string>
15 15
     <string name="now_streaming">En cours</string>
16 16
     <string name="error_webView">Erreur du chargement de WebView. Téléchargez Google Chrome sur le Play Store, ou activez le si vous l\'avez désactivé.</string>
17 17
     <string name="action_settings">Paramètres</string>