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
         colorGreenListCompat = (ResourcesCompat.getColorStateList(resources, R.color.button_green_compat, null))
129
         colorGreenListCompat = (ResourcesCompat.getColorStateList(resources, R.color.button_green_compat, null))
130
         colorAccent = (ResourcesCompat.getColor(resources, R.color.colorAccent, null))
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
         PlayerStore.instance.initUrl(this)
135
         PlayerStore.instance.initUrl(this)
133
         PlayerStore.instance.initApi()
136
         PlayerStore.instance.initApi()
134
 
137
 
163
             isTimerStarted = true
166
             isTimerStarted = true
164
         }
167
         }
165
 
168
 
166
-        // fetch program
167
-        Planning.instance.parseUrl(/* getString(R.string.planning_url) */ context = this)
168
-
169
         // initialize the UI
169
         // initialize the UI
170
         setTheme(R.style.AppTheme)
170
         setTheme(R.style.AppTheme)
171
         setContentView(R.layout.activity_main)
171
         setContentView(R.layout.activity_main)

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

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

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

74
             app:layout_constraintVertical_weight="3"
74
             app:layout_constraintVertical_weight="3"
75
             app:layout_constraintStart_toStartOf="@id/streamerPicture"
75
             app:layout_constraintStart_toStartOf="@id/streamerPicture"
76
             app:layout_constraintTop_toBottomOf="@id/streamerPicture"
76
             app:layout_constraintTop_toBottomOf="@id/streamerPicture"
77
-            android:visibility="visible"/>
77
+            android:visibility="gone"/>
78
         <TextView
78
         <TextView
79
             android:id="@+id/listenersCount"
79
             android:id="@+id/listenersCount"
80
             android:layout_width="0dp"
80
             android:layout_width="0dp"
93
             android:visibility="gone"
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
         <TextView
96
         <TextView
104
             android:id="@+id/sleepInfo"
97
             android:id="@+id/sleepInfo"
105
             android:layout_width="0dp"
98
             android:layout_width="0dp"
162
             android:layout_width="0dp"
155
             android:layout_width="0dp"
163
             android:layout_height="0dp"
156
             android:layout_height="0dp"
164
             android:fillViewport="true"
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
             app:layout_constraintEnd_toStartOf="@id/streamerPicture"
160
             app:layout_constraintEnd_toStartOf="@id/streamerPicture"
167
             app:layout_constraintStart_toStartOf="parent"
161
             app:layout_constraintStart_toStartOf="parent"
168
             app:layout_constraintTop_toBottomOf="@id/seek_bar_volume">
162
             app:layout_constraintTop_toBottomOf="@id/seek_bar_volume">
220
             </androidx.constraintlayout.widget.ConstraintLayout>
214
             </androidx.constraintlayout.widget.ConstraintLayout>
221
         </ScrollView>
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
     </androidx.constraintlayout.widget.ConstraintLayout>
254
     </androidx.constraintlayout.widget.ConstraintLayout>
226
 
255
 

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

11
     <string name="volume">Volume : </string>
11
     <string name="volume">Volume : </string>
12
 
12
 
13
     <string name="up_next">Prochain titre :</string>
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
     <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>

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

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