tweaked up next, added current programme, seems cool

remotes/origin/devel
yattoz 2020-01-12 01:30:19 +01:00
parent c5d12c1742
commit 6a992458cc
5 changed files with 48 additions and 19 deletions

View File

@ -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)

View File

@ -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

View File

@ -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"/>
<TextView
android:id="@+id/listenersCount"
android:layout_width="0dp"
@ -93,13 +93,6 @@
android:visibility="gone"
/>
<androidx.constraintlayout.widget.Guideline
android:id="@+id/topInfoGuideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.95" />
<TextView
android:id="@+id/sleepInfo"
android:layout_width="0dp"
@ -162,7 +155,8 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:fillViewport="true"
app:layout_constraintBottom_toTopOf="@id/topInfoGuideline"
android:layout_marginBottom="4dp"
app:layout_constraintBottom_toTopOf="@id/text_current_programme"
app:layout_constraintEnd_toStartOf="@id/streamerPicture"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/seek_bar_volume">
@ -220,7 +214,42 @@
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
<TextView
android:id="@+id/current_programme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="bottom"
android:text="@string/current_programme"
android:textAlignment="center"
android:textColor="@color/whited3"
android:textSize="14sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="@id/topInfoGuideline"
android:visibility="visible" />
<TextView
android:id="@+id/text_current_programme"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text=""
android:layout_marginStart="8sp"
android:layout_marginLeft="8sp"
android:gravity="start|bottom"
android:textAlignment="textStart"
android:textColor="@color/whited"
android:textSize="14sp"
app:layout_constraintStart_toEndOf="@id/current_programme"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="@id/topInfoGuideline"
android:visibility="visible"
/>
<androidx.constraintlayout.widget.Guideline
android:id="@+id/topInfoGuideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.97" />
</androidx.constraintlayout.widget.ConstraintLayout>