Browse Source

tweaked up next, added current programme, seems cool

yattoz 4 years ago
parent
commit
6a992458cc

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

@@ -129,6 +129,9 @@ class MainActivity : BaseActivity() {
129 129
         colorGreenListCompat = (ResourcesCompat.getColorStateList(resources, R.color.button_green_compat, null))
130 130
         colorAccent = (ResourcesCompat.getColor(resources, R.color.colorAccent, null))
131 131
 
132
+        // fetch program
133
+        Planning.instance.parseUrl(/* getString(R.string.planning_url) */ context = this)
134
+
132 135
         PlayerStore.instance.initUrl(this)
133 136
         PlayerStore.instance.initApi()
134 137
 
@@ -163,9 +166,6 @@ class MainActivity : BaseActivity() {
163 166
             isTimerStarted = true
164 167
         }
165 168
 
166
-        // fetch program
167
-        Planning.instance.parseUrl(/* getString(R.string.planning_url) */ context = this)
168
-
169 169
         // initialize the UI
170 170
         setTheme(R.style.AppTheme)
171 171
         setContentView(R.layout.activity_main)

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

@@ -49,7 +49,7 @@ class NowPlayingFragment : Fragment() {
49 49
         val volumeText: TextView = root.findViewById(R.id.volume_text)
50 50
         val progressBar: ProgressBar = root.findViewById(R.id.progressBar)
51 51
         val volumeIconImage : ImageView = root.findViewById(R.id.volume_icon)
52
-
52
+        val currentProgrammeText: TextView  = root.findViewById(R.id.text_current_programme)
53 53
         val streamerPictureImageView: ImageView = root.findViewById(R.id.streamerPicture)
54 54
 
55 55
         // Note: these values are not used in the generic app, but if you want to, you can use them.
@@ -73,7 +73,7 @@ class NowPlayingFragment : Fragment() {
73 73
         // trick : I can't observe the queue because it's an ArrayDeque that doesn't trigger any change...
74 74
         // so I observe a dedicated Mutable that gets set when the queue is updated.
75 75
         PlayerStore.instance.isQueueUpdated.observe(viewLifecycleOwner, Observer {
76
-            val t = if (PlayerStore.instance.queue.size > 0) PlayerStore.instance.queue[0] else Song("No queue - ") // (it.peekFirst != null ? it.peekFirst : Song() )
76
+            val t = if (PlayerStore.instance.queue.size > 0) PlayerStore.instance.queue[0] else Song(noConnectionValue) // (it.peekFirst != null ? it.peekFirst : Song() )
77 77
             songTitleNextText.text = t.title.value
78 78
             songArtistNextText.text = t.artist.value
79 79
         })
@@ -92,11 +92,11 @@ class NowPlayingFragment : Fragment() {
92 92
             songTitleText.text = it
93 93
         })
94 94
 
95
-        /*
95
+
96 96
         Planning.instance.currentProgramme.observe(viewLifecycleOwner, Observer {
97
-            songTitleNextText.text = it
97
+            currentProgrammeText.text = it
98 98
         })
99
-        */
99
+
100 100
 
101 101
         PlayerStore.instance.currentSong.artist.observe(viewLifecycleOwner, Observer {
102 102
             songArtistText.text = it

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

@@ -74,7 +74,7 @@
74 74
             app:layout_constraintVertical_weight="3"
75 75
             app:layout_constraintStart_toStartOf="@id/streamerPicture"
76 76
             app:layout_constraintTop_toBottomOf="@id/streamerPicture"
77
-            android:visibility="visible"/>
77
+            android:visibility="gone"/>
78 78
         <TextView
79 79
             android:id="@+id/listenersCount"
80 80
             android:layout_width="0dp"
@@ -93,13 +93,6 @@
93 93
             android:visibility="gone"
94 94
             />
95 95
 
96
-        <androidx.constraintlayout.widget.Guideline
97
-            android:id="@+id/topInfoGuideline"
98
-            android:layout_width="wrap_content"
99
-            android:layout_height="wrap_content"
100
-            android:orientation="horizontal"
101
-            app:layout_constraintGuide_percent="0.95" />
102
-
103 96
         <TextView
104 97
             android:id="@+id/sleepInfo"
105 98
             android:layout_width="0dp"
@@ -162,7 +155,8 @@
162 155
             android:layout_width="0dp"
163 156
             android:layout_height="0dp"
164 157
             android:fillViewport="true"
165
-            app:layout_constraintBottom_toTopOf="@id/topInfoGuideline"
158
+            android:layout_marginBottom="4dp"
159
+            app:layout_constraintBottom_toTopOf="@id/text_current_programme"
166 160
             app:layout_constraintEnd_toStartOf="@id/streamerPicture"
167 161
             app:layout_constraintStart_toStartOf="parent"
168 162
             app:layout_constraintTop_toBottomOf="@id/seek_bar_volume">
@@ -220,7 +214,42 @@
220 214
             </androidx.constraintlayout.widget.ConstraintLayout>
221 215
         </ScrollView>
222 216
 
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="14sp"
226
+            app:layout_constraintStart_toStartOf="parent"
227
+            app:layout_constraintBottom_toBottomOf="@id/topInfoGuideline"
228
+            android:visibility="visible" />
223 229
 
230
+        <TextView
231
+            android:id="@+id/text_current_programme"
232
+            android:layout_width="0dp"
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="14sp"
241
+            app:layout_constraintStart_toEndOf="@id/current_programme"
242
+            app:layout_constraintEnd_toEndOf="parent"
243
+            app:layout_constraintBottom_toBottomOf="@id/topInfoGuideline"
244
+            android:visibility="visible"
245
+             />
246
+
247
+        <androidx.constraintlayout.widget.Guideline
248
+            android:id="@+id/topInfoGuideline"
249
+            android:layout_width="wrap_content"
250
+            android:layout_height="wrap_content"
251
+            android:orientation="horizontal"
252
+            app:layout_constraintGuide_percent="0.97" />
224 253
 
225 254
     </androidx.constraintlayout.widget.ConstraintLayout>
226 255
 

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

@@ -11,7 +11,7 @@
11 11
     <string name="volume">Volume : </string>
12 12
 
13 13
     <string name="up_next">Prochain titre :</string>
14
-    <string name="current_programme">Émission en cours :</string>
14
+    <string name="current_programme">Émission en cours : </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>

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

@@ -26,7 +26,7 @@
26 26
     <string name="volume">Volume: </string>
27 27
 
28 28
     <string name="up_next">Up next :</string>
29
-    <string name="current_programme">Current programme :</string>
29
+    <string name="current_programme">Current programme : </string>
30 30
     <string name="now_streaming">Now streaming</string>
31 31
     <string name="error_webView">Error loading WebView. Try downloading Google Chrome on Google Play, or enabling it if you disabled it.</string>
32 32
     <string name="action_settings">Settings</string>