fixed layout, more readable (back to bigger fonts among other)

remotes/origin/devel
yattoz 2020-01-12 14:24:40 +01:00
parent d03b06341a
commit a59d57a685
4 changed files with 61 additions and 42 deletions

View File

@ -229,7 +229,7 @@ class PlayerStore {
val queueJSON = val queueJSON =
resMain.getJSONObject("next") resMain.getJSONObject("next")
val t = extractSong(queueJSON) val t = extractSong(queueJSON)
if (queue.isNotEmpty() && t == queue.last()) if (queue.isNotEmpty() && (t == queue.last() || t == currentSong))
{ {
//[REMOVE LOG CALLS]Log.d((tag, playerStoreTag + "Song already in there: $t") //[REMOVE LOG CALLS]Log.d((tag, playerStoreTag + "Song already in there: $t")
Async(sleepScrape, post) Async(sleepScrape, post)

View File

@ -6,8 +6,6 @@ import android.content.Context
import androidx.lifecycle.ViewModelProviders import androidx.lifecycle.ViewModelProviders
import android.os.Bundle import android.os.Bundle
import android.support.v4.media.session.PlaybackStateCompat import android.support.v4.media.session.PlaybackStateCompat
import android.util.Log
import android.util.TypedValue
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
@ -15,7 +13,6 @@ import android.view.ViewGroup
import android.widget.* import android.widget.*
import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintLayout
import androidx.constraintlayout.widget.ConstraintSet import androidx.constraintlayout.widget.ConstraintSet
import androidx.core.widget.TextViewCompat
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import com.google.android.material.snackbar.BaseTransientBottomBar import com.google.android.material.snackbar.BaseTransientBottomBar
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
@ -24,7 +21,6 @@ import fr.forum_thalie.tsumugi.alarm.RadioSleeper
import fr.forum_thalie.tsumugi.planning.Planning import fr.forum_thalie.tsumugi.planning.Planning
import fr.forum_thalie.tsumugi.playerstore.PlayerStore import fr.forum_thalie.tsumugi.playerstore.PlayerStore
import fr.forum_thalie.tsumugi.playerstore.Song import fr.forum_thalie.tsumugi.playerstore.Song
import kotlinx.android.synthetic.main.fragment_nowplaying.*
class NowPlayingFragment : Fragment() { class NowPlayingFragment : Fragment() {
@ -49,7 +45,7 @@ class NowPlayingFragment : Fragment() {
val volumeText: TextView = root.findViewById(R.id.volume_text) val volumeText: TextView = root.findViewById(R.id.volume_text)
val progressBar: ProgressBar = root.findViewById(R.id.progressBar) val progressBar: ProgressBar = root.findViewById(R.id.progressBar)
val volumeIconImage : ImageView = root.findViewById(R.id.volume_icon) val volumeIconImage : ImageView = root.findViewById(R.id.volume_icon)
val currentProgrammeText: TextView = root.findViewById(R.id.text_current_programme) val currentProgrammeText: TextView = root.findViewById(R.id.current_programme)
val streamerPictureImageView: ImageView = root.findViewById(R.id.streamerPicture) 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. // Note: these values are not used in the generic app, but if you want to, you can use them.
@ -69,10 +65,6 @@ class NowPlayingFragment : Fragment() {
listenersText,8, 16, 2, TypedValue.COMPLEX_UNIT_SP) listenersText,8, 16, 2, TypedValue.COMPLEX_UNIT_SP)
*/ */
TextViewCompat.setAutoSizeTextTypeUniformWithConfiguration(
currentProgrammeText,8, 20, 2, TypedValue.COMPLEX_UNIT_SP)
// trick : I can't observe the queue because it's an ArrayDeque that doesn't trigger any change... // 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. // so I observe a dedicated Mutable that gets set when the queue is updated.
PlayerStore.instance.isQueueUpdated.observe(viewLifecycleOwner, Observer { PlayerStore.instance.isQueueUpdated.observe(viewLifecycleOwner, Observer {
@ -97,7 +89,7 @@ class NowPlayingFragment : Fragment() {
Planning.instance.currentProgramme.observe(viewLifecycleOwner, Observer { Planning.instance.currentProgramme.observe(viewLifecycleOwner, Observer {
currentProgrammeText.text = it currentProgrammeText.text = "${context!!.getString(R.string.current_programme)} $it"
}) })

View File

@ -49,7 +49,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
app:layout_constraintGuide_percent="0.68" /> app:layout_constraintGuide_percent="0.71" />
<androidx.constraintlayout.widget.Guideline <androidx.constraintlayout.widget.Guideline
android:id="@+id/imageLeftGuideline" android:id="@+id/imageLeftGuideline"
@ -140,7 +140,7 @@
<ImageView <ImageView
android:id="@+id/volume_icon" android:id="@+id/volume_icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="24dp" android:layout_height="20dp"
android:contentDescription="@string/volume" android:contentDescription="@string/volume"
android:src="@drawable/ic_volume_high" android:src="@drawable/ic_volume_high"
android:textSize="12sp" android:textSize="12sp"
@ -156,10 +156,11 @@
android:layout_height="0dp" android:layout_height="0dp"
android:fillViewport="true" android:fillViewport="true"
android:layout_marginBottom="4dp" android:layout_marginBottom="4dp"
app:layout_constraintBottom_toTopOf="@id/text_current_programme" app:layout_constraintBottom_toTopOf="@id/scrollProgramme"
app:layout_constraintEnd_toStartOf="@id/streamerPicture" app:layout_constraintEnd_toStartOf="@id/streamerPicture"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/seek_bar_volume"> app:layout_constraintTop_toBottomOf="@id/seek_bar_volume"
app:layout_constraintVertical_weight="3">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
@ -214,35 +215,61 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView> </ScrollView>
<TextView <ScrollView
android:id="@+id/current_programme" android:id="@+id/scrollProgramme"
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="16sp"
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_width="0dp"
android:layout_height="wrap_content" android:layout_height="0dp"
android:text="" android:fillViewport="true"
android:layout_marginStart="8sp" android:layout_marginBottom="0dp"
android:layout_marginLeft="8sp"
android:gravity="start|bottom"
android:textAlignment="textStart"
android:textColor="@color/whited"
android:textSize="16sp"
app:layout_constraintStart_toEndOf="@id/current_programme"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/scrollViewMetadataNext"
app:layout_constraintBottom_toBottomOf="@id/topInfoGuideline" app:layout_constraintBottom_toBottomOf="@id/topInfoGuideline"
app:layout_constraintVertical_weight="1">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:visibility="visible" android:visibility="visible"
/> >
<TextView
android:id="@+id/current_programme"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top|center_horizontal"
android:text="@string/current_programme"
android:textAlignment="center"
android:textColor="@color/whited3"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
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|center_horizontal"
android:textAlignment="textStart"
android:textColor="@color/whited"
android:textSize="16sp"
app:layout_constraintStart_toEndOf="@id/current_programme"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:visibility="gone"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
<androidx.constraintlayout.widget.Guideline <androidx.constraintlayout.widget.Guideline
android:id="@+id/topInfoGuideline" android:id="@+id/topInfoGuideline"

View File

@ -10,8 +10,8 @@
<string name="volume">Volume : </string> <string name="volume">Volume : </string>
<string name="up_next">Prochain titre :</string> <string name="up_next">À suivre :</string>
<string name="current_programme">Émission en cours : </string> <string name="current_programme">Émission : </string>
<string name="now_streaming">En cours</string> <string name="now_streaming">En cours</string>
<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> <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>
<string name="action_settings">Paramètres</string> <string name="action_settings">Paramètres</string>