Browse Source

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

yattoz 5 years ago
parent
commit
a59d57a685

+ 1 - 1
app/src/main/java/fr/forum_thalie/tsumugi/playerstore/PlayerStore.kt View File

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

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

6
 import androidx.lifecycle.ViewModelProviders
6
 import androidx.lifecycle.ViewModelProviders
7
 import android.os.Bundle
7
 import android.os.Bundle
8
 import android.support.v4.media.session.PlaybackStateCompat
8
 import android.support.v4.media.session.PlaybackStateCompat
9
-import android.util.Log
10
-import android.util.TypedValue
11
 import androidx.fragment.app.Fragment
9
 import androidx.fragment.app.Fragment
12
 import android.view.LayoutInflater
10
 import android.view.LayoutInflater
13
 import android.view.View
11
 import android.view.View
15
 import android.widget.*
13
 import android.widget.*
16
 import androidx.constraintlayout.widget.ConstraintLayout
14
 import androidx.constraintlayout.widget.ConstraintLayout
17
 import androidx.constraintlayout.widget.ConstraintSet
15
 import androidx.constraintlayout.widget.ConstraintSet
18
-import androidx.core.widget.TextViewCompat
19
 import androidx.lifecycle.Observer
16
 import androidx.lifecycle.Observer
20
 import com.google.android.material.snackbar.BaseTransientBottomBar
17
 import com.google.android.material.snackbar.BaseTransientBottomBar
21
 import com.google.android.material.snackbar.Snackbar
18
 import com.google.android.material.snackbar.Snackbar
24
 import fr.forum_thalie.tsumugi.planning.Planning
21
 import fr.forum_thalie.tsumugi.planning.Planning
25
 import fr.forum_thalie.tsumugi.playerstore.PlayerStore
22
 import fr.forum_thalie.tsumugi.playerstore.PlayerStore
26
 import fr.forum_thalie.tsumugi.playerstore.Song
23
 import fr.forum_thalie.tsumugi.playerstore.Song
27
-import kotlinx.android.synthetic.main.fragment_nowplaying.*
28
 
24
 
29
 
25
 
30
 class NowPlayingFragment : Fragment() {
26
 class NowPlayingFragment : Fragment() {
49
         val volumeText: TextView = root.findViewById(R.id.volume_text)
45
         val volumeText: TextView = root.findViewById(R.id.volume_text)
50
         val progressBar: ProgressBar = root.findViewById(R.id.progressBar)
46
         val progressBar: ProgressBar = root.findViewById(R.id.progressBar)
51
         val volumeIconImage : ImageView = root.findViewById(R.id.volume_icon)
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
         val streamerPictureImageView: ImageView = root.findViewById(R.id.streamerPicture)
49
         val streamerPictureImageView: ImageView = root.findViewById(R.id.streamerPicture)
54
 
50
 
55
         // Note: these values are not used in the generic app, but if you want to, you can use them.
51
         // Note: these values are not used in the generic app, but if you want to, you can use them.
69
             listenersText,8, 16, 2, TypedValue.COMPLEX_UNIT_SP)
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
         // trick : I can't observe the queue because it's an ArrayDeque that doesn't trigger any change...
68
         // trick : I can't observe the queue because it's an ArrayDeque that doesn't trigger any change...
77
         // so I observe a dedicated Mutable that gets set when the queue is updated.
69
         // so I observe a dedicated Mutable that gets set when the queue is updated.
78
         PlayerStore.instance.isQueueUpdated.observe(viewLifecycleOwner, Observer {
70
         PlayerStore.instance.isQueueUpdated.observe(viewLifecycleOwner, Observer {
97
 
89
 
98
 
90
 
99
         Planning.instance.currentProgramme.observe(viewLifecycleOwner, Observer {
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 View File

49
             android:layout_width="wrap_content"
49
             android:layout_width="wrap_content"
50
             android:layout_height="wrap_content"
50
             android:layout_height="wrap_content"
51
             android:orientation="vertical"
51
             android:orientation="vertical"
52
-            app:layout_constraintGuide_percent="0.68" />
52
+            app:layout_constraintGuide_percent="0.71" />
53
 
53
 
54
         <androidx.constraintlayout.widget.Guideline
54
         <androidx.constraintlayout.widget.Guideline
55
             android:id="@+id/imageLeftGuideline"
55
             android:id="@+id/imageLeftGuideline"
140
         <ImageView
140
         <ImageView
141
             android:id="@+id/volume_icon"
141
             android:id="@+id/volume_icon"
142
             android:layout_width="wrap_content"
142
             android:layout_width="wrap_content"
143
-            android:layout_height="24dp"
143
+            android:layout_height="20dp"
144
             android:contentDescription="@string/volume"
144
             android:contentDescription="@string/volume"
145
             android:src="@drawable/ic_volume_high"
145
             android:src="@drawable/ic_volume_high"
146
             android:textSize="12sp"
146
             android:textSize="12sp"
156
             android:layout_height="0dp"
156
             android:layout_height="0dp"
157
             android:fillViewport="true"
157
             android:fillViewport="true"
158
             android:layout_marginBottom="4dp"
158
             android:layout_marginBottom="4dp"
159
-            app:layout_constraintBottom_toTopOf="@id/text_current_programme"
159
+            app:layout_constraintBottom_toTopOf="@id/scrollProgramme"
160
             app:layout_constraintEnd_toStartOf="@id/streamerPicture"
160
             app:layout_constraintEnd_toStartOf="@id/streamerPicture"
161
             app:layout_constraintStart_toStartOf="parent"
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
             <androidx.constraintlayout.widget.ConstraintLayout
166
             <androidx.constraintlayout.widget.ConstraintLayout
214
             </androidx.constraintlayout.widget.ConstraintLayout>
215
             </androidx.constraintlayout.widget.ConstraintLayout>
215
         </ScrollView>
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
             app:layout_constraintStart_toStartOf="parent"
225
             app:layout_constraintStart_toStartOf="parent"
226
+            app:layout_constraintTop_toBottomOf="@id/scrollViewMetadataNext"
227
             app:layout_constraintBottom_toBottomOf="@id/topInfoGuideline"
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
             android:layout_height="wrap_content"
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
             android:visibility="visible"
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
         <androidx.constraintlayout.widget.Guideline
274
         <androidx.constraintlayout.widget.Guideline
248
             android:id="@+id/topInfoGuideline"
275
             android:id="@+id/topInfoGuideline"

+ 2 - 2
app/src/main/res/values-fr/strings.xml View File

10
 
10
 
11
     <string name="volume">Volume : </string>
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
     <string name="now_streaming">En cours</string>
15
     <string name="now_streaming">En cours</string>
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>
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
     <string name="action_settings">Paramètres</string>
17
     <string name="action_settings">Paramètres</string>