From 6a992458cc48445cffb5c398acbdd964105b7e15 Mon Sep 17 00:00:00 2001 From: yattoz <12408848+yattoz@users.noreply.github.com> Date: Sun, 12 Jan 2020 01:30:19 +0100 Subject: [PATCH] tweaked up next, added current programme, seems cool --- .../fr/forum_thalie/tsumugi/MainActivity.kt | 6 +-- .../ui/nowplaying/NowPlayingFragment.kt | 10 ++-- .../main/res/layout/fragment_nowplaying.xml | 47 +++++++++++++++---- app/src/main/res/values-fr/strings.xml | 2 +- app/src/main/res/values/strings.xml | 2 +- 5 files changed, 48 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/fr/forum_thalie/tsumugi/MainActivity.kt b/app/src/main/java/fr/forum_thalie/tsumugi/MainActivity.kt index 89d7300..b8cff04 100644 --- a/app/src/main/java/fr/forum_thalie/tsumugi/MainActivity.kt +++ b/app/src/main/java/fr/forum_thalie/tsumugi/MainActivity.kt @@ -129,6 +129,9 @@ class MainActivity : BaseActivity() { colorGreenListCompat = (ResourcesCompat.getColorStateList(resources, R.color.button_green_compat, null)) colorAccent = (ResourcesCompat.getColor(resources, R.color.colorAccent, null)) + // fetch program + Planning.instance.parseUrl(/* getString(R.string.planning_url) */ context = this) + PlayerStore.instance.initUrl(this) PlayerStore.instance.initApi() @@ -163,9 +166,6 @@ class MainActivity : BaseActivity() { isTimerStarted = true } - // fetch program - Planning.instance.parseUrl(/* getString(R.string.planning_url) */ context = this) - // initialize the UI setTheme(R.style.AppTheme) setContentView(R.layout.activity_main) diff --git a/app/src/main/java/fr/forum_thalie/tsumugi/ui/nowplaying/NowPlayingFragment.kt b/app/src/main/java/fr/forum_thalie/tsumugi/ui/nowplaying/NowPlayingFragment.kt index 336158d..be04f4b 100644 --- a/app/src/main/java/fr/forum_thalie/tsumugi/ui/nowplaying/NowPlayingFragment.kt +++ b/app/src/main/java/fr/forum_thalie/tsumugi/ui/nowplaying/NowPlayingFragment.kt @@ -49,7 +49,7 @@ class NowPlayingFragment : Fragment() { val volumeText: TextView = root.findViewById(R.id.volume_text) val progressBar: ProgressBar = root.findViewById(R.id.progressBar) val volumeIconImage : ImageView = root.findViewById(R.id.volume_icon) - + val currentProgrammeText: TextView = root.findViewById(R.id.text_current_programme) val streamerPictureImageView: ImageView = root.findViewById(R.id.streamerPicture) // 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() { // trick : I can't observe the queue because it's an ArrayDeque that doesn't trigger any change... // so I observe a dedicated Mutable that gets set when the queue is updated. PlayerStore.instance.isQueueUpdated.observe(viewLifecycleOwner, Observer { - val t = if (PlayerStore.instance.queue.size > 0) PlayerStore.instance.queue[0] else Song("No queue - ") // (it.peekFirst != null ? it.peekFirst : Song() ) + val t = if (PlayerStore.instance.queue.size > 0) PlayerStore.instance.queue[0] else Song(noConnectionValue) // (it.peekFirst != null ? it.peekFirst : Song() ) songTitleNextText.text = t.title.value songArtistNextText.text = t.artist.value }) @@ -92,11 +92,11 @@ class NowPlayingFragment : Fragment() { songTitleText.text = it }) - /* + Planning.instance.currentProgramme.observe(viewLifecycleOwner, Observer { - songTitleNextText.text = it + currentProgrammeText.text = it }) - */ + PlayerStore.instance.currentSong.artist.observe(viewLifecycleOwner, Observer { songArtistText.text = it diff --git a/app/src/main/res/layout/fragment_nowplaying.xml b/app/src/main/res/layout/fragment_nowplaying.xml index 7bfcef3..39bd18b 100644 --- a/app/src/main/res/layout/fragment_nowplaying.xml +++ b/app/src/main/res/layout/fragment_nowplaying.xml @@ -74,7 +74,7 @@ app:layout_constraintVertical_weight="3" app:layout_constraintStart_toStartOf="@id/streamerPicture" app:layout_constraintTop_toBottomOf="@id/streamerPicture" - android:visibility="visible"/> + android:visibility="gone"/> - - @@ -220,7 +214,42 @@ + + + + diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 052cbe3..323a71d 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -11,7 +11,7 @@ Volume : Prochain titre : - Émission en cours : + Émission en cours : En cours Erreur du chargement de WebView. Téléchargez Google Chrome sur le Play Store, ou activez le si vous l\'avez désactivé. Paramètres diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index bf5ff38..d2a4652 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -26,7 +26,7 @@ Volume: Up next : - Current programme : + Current programme : Now streaming Error loading WebView. Try downloading Google Chrome on Google Play, or enabling it if you disabled it. Settings