Browse Source

added refresh button, put font back to 16/20sp

yattoz 5 years ago
parent
commit
d03b06341a

+ 9 - 0
app/src/main/java/fr/forum_thalie/tsumugi/MainActivity.kt View File

15
 
15
 
16
 import java.util.Timer
16
 import java.util.Timer
17
 import android.view.MenuItem
17
 import android.view.MenuItem
18
+import com.google.android.material.snackbar.Snackbar
18
 import fr.forum_thalie.tsumugi.alarm.RadioAlarm
19
 import fr.forum_thalie.tsumugi.alarm.RadioAlarm
19
 import fr.forum_thalie.tsumugi.planning.Planning
20
 import fr.forum_thalie.tsumugi.planning.Planning
20
 
21
 
86
                 true
87
                 true
87
             }
88
             }
88
             */
89
             */
90
+            R.id.action_refresh -> {
91
+                PlayerStore.instance.queue.clear()
92
+                //PlayerStore.instance.lp.clear()
93
+                PlayerStore.instance.initApi()
94
+                val s = Snackbar.make(findViewById(R.id.nav_host_container), getString(R.string.refreshing) as CharSequence, Snackbar.LENGTH_LONG)
95
+                s.show()
96
+                true
97
+            }
89
             R.id.action_settings -> {
98
             R.id.action_settings -> {
90
                 val i = Intent(this, ParametersActivity::class.java)
99
                 val i = Intent(this, ParametersActivity::class.java)
91
                 startActivity(i)
100
                 startActivity(i)

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

127
             {
127
             {
128
                 updateApi(result)
128
                 updateApi(result)
129
                 currentSongBackup.copy(currentSong)
129
                 currentSongBackup.copy(currentSong)
130
-
130
+                fetchLastRequest()
131
                 isQueueUpdated.value = true
131
                 isQueueUpdated.value = true
132
 
132
 
133
                 isLpUpdated.value = true
133
                 isLpUpdated.value = true

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

69
             listenersText,8, 16, 2, TypedValue.COMPLEX_UNIT_SP)
69
             listenersText,8, 16, 2, TypedValue.COMPLEX_UNIT_SP)
70
          */
70
          */
71
 
71
 
72
+        TextViewCompat.setAutoSizeTextTypeUniformWithConfiguration(
73
+            currentProgrammeText,8, 20, 2, TypedValue.COMPLEX_UNIT_SP)
74
+
72
 
75
 
73
         // trick : I can't observe the queue because it's an ArrayDeque that doesn't trigger any change...
76
         // trick : I can't observe the queue because it's an ArrayDeque that doesn't trigger any change...
74
         // so I observe a dedicated Mutable that gets set when the queue is updated.
77
         // so I observe a dedicated Mutable that gets set when the queue is updated.

+ 7 - 7
app/src/main/res/layout/fragment_nowplaying.xml View File

193
                     android:text=""
193
                     android:text=""
194
                     android:textAlignment="center"
194
                     android:textAlignment="center"
195
                     android:textColor="@color/whited3"
195
                     android:textColor="@color/whited3"
196
-                    android:textSize="14sp"
196
+                    android:textSize="16sp"
197
                     app:layout_constraintStart_toStartOf="parent"
197
                     app:layout_constraintStart_toStartOf="parent"
198
                     app:layout_constraintTop_toBottomOf="@id/upNext"
198
                     app:layout_constraintTop_toBottomOf="@id/upNext"
199
                     android:visibility="visible"/>
199
                     android:visibility="visible"/>
206
                     android:text=""
206
                     android:text=""
207
                     android:textAlignment="center"
207
                     android:textAlignment="center"
208
                     android:textColor="@color/whited"
208
                     android:textColor="@color/whited"
209
-                    android:textSize="14sp"
209
+                    android:textSize="16sp"
210
                     app:layout_constraintStart_toStartOf="parent"
210
                     app:layout_constraintStart_toStartOf="parent"
211
                     app:layout_constraintTop_toBottomOf="@id/text_song_artist_next"
211
                     app:layout_constraintTop_toBottomOf="@id/text_song_artist_next"
212
                     android:visibility="visible" />
212
                     android:visibility="visible" />
222
             android:text="@string/current_programme"
222
             android:text="@string/current_programme"
223
             android:textAlignment="center"
223
             android:textAlignment="center"
224
             android:textColor="@color/whited3"
224
             android:textColor="@color/whited3"
225
-            android:textSize="14sp"
225
+            android:textSize="16sp"
226
             app:layout_constraintStart_toStartOf="parent"
226
             app:layout_constraintStart_toStartOf="parent"
227
             app:layout_constraintBottom_toBottomOf="@id/topInfoGuideline"
227
             app:layout_constraintBottom_toBottomOf="@id/topInfoGuideline"
228
             android:visibility="visible" />
228
             android:visibility="visible" />
237
             android:gravity="start|bottom"
237
             android:gravity="start|bottom"
238
             android:textAlignment="textStart"
238
             android:textAlignment="textStart"
239
             android:textColor="@color/whited"
239
             android:textColor="@color/whited"
240
-            android:textSize="14sp"
240
+            android:textSize="16sp"
241
             app:layout_constraintStart_toEndOf="@id/current_programme"
241
             app:layout_constraintStart_toEndOf="@id/current_programme"
242
             app:layout_constraintEnd_toEndOf="parent"
242
             app:layout_constraintEnd_toEndOf="parent"
243
             app:layout_constraintBottom_toBottomOf="@id/topInfoGuideline"
243
             app:layout_constraintBottom_toBottomOf="@id/topInfoGuideline"
298
                     android:text=""
298
                     android:text=""
299
                     android:textAlignment="center"
299
                     android:textAlignment="center"
300
                     android:textColor="@color/whited"
300
                     android:textColor="@color/whited"
301
-                    android:textSize="18sp"
301
+                    android:textSize="20sp"
302
                     app:layout_constraintBottom_toBottomOf="parent"
302
                     app:layout_constraintBottom_toBottomOf="parent"
303
                     app:layout_constraintStart_toStartOf="parent" />
303
                     app:layout_constraintStart_toStartOf="parent" />
304
 
304
 
310
                     android:text=""
310
                     android:text=""
311
                     android:textAlignment="center"
311
                     android:textAlignment="center"
312
                     android:textColor="@color/whited3"
312
                     android:textColor="@color/whited3"
313
-                    android:textSize="18sp"
313
+                    android:textSize="20sp"
314
                     app:layout_constraintBottom_toTopOf="@id/text_song_title"
314
                     app:layout_constraintBottom_toTopOf="@id/text_song_title"
315
                     app:layout_constraintStart_toStartOf="parent" />
315
                     app:layout_constraintStart_toStartOf="parent" />
316
 
316
 
376
             android:layout_width="wrap_content"
376
             android:layout_width="wrap_content"
377
             android:layout_height="wrap_content"
377
             android:layout_height="wrap_content"
378
             android:orientation="horizontal"
378
             android:orientation="horizontal"
379
-            app:layout_constraintGuide_percent="0.58" />
379
+            app:layout_constraintGuide_percent="0.63" />
380
 
380
 
381
 
381
 
382
         <ImageButton
382
         <ImageButton

+ 6 - 7
app/src/main/res/menu/toolbar_menu.xml View File

15
         app:showAsAction="ifRoom"/>
15
         app:showAsAction="ifRoom"/>
16
 
16
 
17
     <!--
17
     <!--
18
-    <item
19
-        android:id="@+id/action_refresh"
20
-        android:title="@string/action_refresh"
21
-        app:showAsAction="never"/>
22
-    -->
23
 
18
 
24
-    <!--
25
     <item
19
     <item
26
         android:id="@+id/action_bug_submit"
20
         android:id="@+id/action_bug_submit"
27
         android:title="@string/action_bug_submit"
21
         android:title="@string/action_bug_submit"
28
         app:showAsAction="never"/>
22
         app:showAsAction="never"/>
29
     -->
23
     -->
30
 
24
 
25
+    <item
26
+        android:id="@+id/action_refresh"
27
+        android:title="@string/action_refresh"
28
+        app:showAsAction="never"/>
29
+
31
     <item android:id="@+id/action_settings"
30
     <item android:id="@+id/action_settings"
32
         android:title="@string/action_settings"
31
         android:title="@string/action_settings"
33
         android:icon="@drawable/ic_settings"
32
         android:icon="@drawable/ic_settings"
34
-        app:showAsAction="ifRoom"/>
33
+        app:showAsAction="never"/>
35
 
34
 
36
 
35
 
37
 </menu>
36
 </menu>

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

52
     <string name="setSleepDuration">Choisir une durée (en minutes)</string>
52
     <string name="setSleepDuration">Choisir une durée (en minutes)</string>
53
     <string name="willCloseIn">Extinction dans %1$d minutes</string>
53
     <string name="willCloseIn">Extinction dans %1$d minutes</string>
54
     <string name="fetchPeriod">Choisir la fréquence de mise à jour quand la radio est stoppée</string>
54
     <string name="fetchPeriod">Choisir la fréquence de mise à jour quand la radio est stoppée</string>
55
+    <string name="refreshing">Actualisation…</string>
56
+    <string name="action_refresh">Raffraîchir les données</string>
55
 
57
 
56
 </resources>
58
 </resources>

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

72
     <string name="setSleepDuration">Set duration (minutes)</string>
72
     <string name="setSleepDuration">Set duration (minutes)</string>
73
     <string name="willCloseIn">Will close in %1$d minutes</string>
73
     <string name="willCloseIn">Will close in %1$d minutes</string>
74
     <string name="fetchPeriod">Set update period when stopped</string>
74
     <string name="fetchPeriod">Set update period when stopped</string>
75
+    <string name="refreshing">Refreshing data…</string>
76
+    <string name="action_refresh">Refresh data</string>
75
 
77
 
76
 </resources>
78
 </resources>