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,6 +15,7 @@ import fr.forum_thalie.tsumugi.playerstore.PlayerStore
15 15
 
16 16
 import java.util.Timer
17 17
 import android.view.MenuItem
18
+import com.google.android.material.snackbar.Snackbar
18 19
 import fr.forum_thalie.tsumugi.alarm.RadioAlarm
19 20
 import fr.forum_thalie.tsumugi.planning.Planning
20 21
 
@@ -86,6 +87,14 @@ class MainActivity : BaseActivity() {
86 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 98
             R.id.action_settings -> {
90 99
                 val i = Intent(this, ParametersActivity::class.java)
91 100
                 startActivity(i)

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

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

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

@@ -69,6 +69,9 @@ class NowPlayingFragment : Fragment() {
69 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 76
         // trick : I can't observe the queue because it's an ArrayDeque that doesn't trigger any change...
74 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,7 +193,7 @@
193 193
                     android:text=""
194 194
                     android:textAlignment="center"
195 195
                     android:textColor="@color/whited3"
196
-                    android:textSize="14sp"
196
+                    android:textSize="16sp"
197 197
                     app:layout_constraintStart_toStartOf="parent"
198 198
                     app:layout_constraintTop_toBottomOf="@id/upNext"
199 199
                     android:visibility="visible"/>
@@ -206,7 +206,7 @@
206 206
                     android:text=""
207 207
                     android:textAlignment="center"
208 208
                     android:textColor="@color/whited"
209
-                    android:textSize="14sp"
209
+                    android:textSize="16sp"
210 210
                     app:layout_constraintStart_toStartOf="parent"
211 211
                     app:layout_constraintTop_toBottomOf="@id/text_song_artist_next"
212 212
                     android:visibility="visible" />
@@ -222,7 +222,7 @@
222 222
             android:text="@string/current_programme"
223 223
             android:textAlignment="center"
224 224
             android:textColor="@color/whited3"
225
-            android:textSize="14sp"
225
+            android:textSize="16sp"
226 226
             app:layout_constraintStart_toStartOf="parent"
227 227
             app:layout_constraintBottom_toBottomOf="@id/topInfoGuideline"
228 228
             android:visibility="visible" />
@@ -237,7 +237,7 @@
237 237
             android:gravity="start|bottom"
238 238
             android:textAlignment="textStart"
239 239
             android:textColor="@color/whited"
240
-            android:textSize="14sp"
240
+            android:textSize="16sp"
241 241
             app:layout_constraintStart_toEndOf="@id/current_programme"
242 242
             app:layout_constraintEnd_toEndOf="parent"
243 243
             app:layout_constraintBottom_toBottomOf="@id/topInfoGuideline"
@@ -298,7 +298,7 @@
298 298
                     android:text=""
299 299
                     android:textAlignment="center"
300 300
                     android:textColor="@color/whited"
301
-                    android:textSize="18sp"
301
+                    android:textSize="20sp"
302 302
                     app:layout_constraintBottom_toBottomOf="parent"
303 303
                     app:layout_constraintStart_toStartOf="parent" />
304 304
 
@@ -310,7 +310,7 @@
310 310
                     android:text=""
311 311
                     android:textAlignment="center"
312 312
                     android:textColor="@color/whited3"
313
-                    android:textSize="18sp"
313
+                    android:textSize="20sp"
314 314
                     app:layout_constraintBottom_toTopOf="@id/text_song_title"
315 315
                     app:layout_constraintStart_toStartOf="parent" />
316 316
 
@@ -376,7 +376,7 @@
376 376
             android:layout_width="wrap_content"
377 377
             android:layout_height="wrap_content"
378 378
             android:orientation="horizontal"
379
-            app:layout_constraintGuide_percent="0.58" />
379
+            app:layout_constraintGuide_percent="0.63" />
380 380
 
381 381
 
382 382
         <ImageButton

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

@@ -15,23 +15,22 @@
15 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 19
     <item
26 20
         android:id="@+id/action_bug_submit"
27 21
         android:title="@string/action_bug_submit"
28 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 30
     <item android:id="@+id/action_settings"
32 31
         android:title="@string/action_settings"
33 32
         android:icon="@drawable/ic_settings"
34
-        app:showAsAction="ifRoom"/>
33
+        app:showAsAction="never"/>
35 34
 
36 35
 
37 36
 </menu>

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

@@ -52,5 +52,7 @@
52 52
     <string name="setSleepDuration">Choisir une durée (en minutes)</string>
53 53
     <string name="willCloseIn">Extinction dans %1$d minutes</string>
54 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 58
 </resources>

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

@@ -72,5 +72,7 @@
72 72
     <string name="setSleepDuration">Set duration (minutes)</string>
73 73
     <string name="willCloseIn">Will close in %1$d minutes</string>
74 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 78
 </resources>