playback: fix flickering with album/artist info
Forgot to move these TextViews into the hacky FrameLayout to make their new marquee states work correctly. Resolves #376.
This commit is contained in:
parent
5e0059fdba
commit
f57b5dfc81
6 changed files with 35 additions and 41 deletions
|
@ -270,7 +270,8 @@ class MainFragment :
|
||||||
when (action) {
|
when (action) {
|
||||||
is MainNavigationAction.Expand -> tryExpandSheets()
|
is MainNavigationAction.Expand -> tryExpandSheets()
|
||||||
is MainNavigationAction.Collapse -> tryCollapseSheets()
|
is MainNavigationAction.Collapse -> tryCollapseSheets()
|
||||||
is MainNavigationAction.Directions -> findNavController().navigateSafe(action.directions)
|
is MainNavigationAction.Directions ->
|
||||||
|
findNavController().navigateSafe(action.directions)
|
||||||
}
|
}
|
||||||
|
|
||||||
navModel.mainNavigationAction.consume()
|
navModel.mainNavigationAction.consume()
|
||||||
|
|
|
@ -64,7 +64,8 @@ class RootPreferenceFragment : BasePreferenceFragment(R.xml.preferences_root) {
|
||||||
// do one.
|
// do one.
|
||||||
when (preference.key) {
|
when (preference.key) {
|
||||||
getString(R.string.set_key_ui) -> {
|
getString(R.string.set_key_ui) -> {
|
||||||
findNavController().navigateSafe(RootPreferenceFragmentDirections.goToUiPreferences())
|
findNavController()
|
||||||
|
.navigateSafe(RootPreferenceFragmentDirections.goToUiPreferences())
|
||||||
}
|
}
|
||||||
getString(R.string.set_key_personalize) -> {
|
getString(R.string.set_key_personalize) -> {
|
||||||
findNavController()
|
findNavController()
|
||||||
|
|
|
@ -39,7 +39,8 @@ class MusicPreferenceFragment : BasePreferenceFragment(R.xml.preferences_music)
|
||||||
|
|
||||||
override fun onOpenDialogPreference(preference: WrappedDialogPreference) {
|
override fun onOpenDialogPreference(preference: WrappedDialogPreference) {
|
||||||
if (preference.key == getString(R.string.set_key_separators)) {
|
if (preference.key == getString(R.string.set_key_separators)) {
|
||||||
findNavController().navigateSafe(MusicPreferenceFragmentDirections.goToSeparatorsDialog())
|
findNavController()
|
||||||
|
.navigateSafe(MusicPreferenceFragmentDirections.goToSeparatorsDialog())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,8 @@ import org.oxycblt.auxio.util.navigateSafe
|
||||||
class PersonalizePreferenceFragment : BasePreferenceFragment(R.xml.preferences_personalize) {
|
class PersonalizePreferenceFragment : BasePreferenceFragment(R.xml.preferences_personalize) {
|
||||||
override fun onOpenDialogPreference(preference: WrappedDialogPreference) {
|
override fun onOpenDialogPreference(preference: WrappedDialogPreference) {
|
||||||
if (preference.key == getString(R.string.set_key_home_tabs)) {
|
if (preference.key == getString(R.string.set_key_home_tabs)) {
|
||||||
findNavController().navigateSafe(PersonalizePreferenceFragmentDirections.goToTabDialog())
|
findNavController()
|
||||||
|
.navigateSafe(PersonalizePreferenceFragmentDirections.goToTabDialog())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@ import androidx.appcompat.widget.AppCompatButton
|
||||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
import androidx.core.graphics.Insets
|
import androidx.core.graphics.Insets
|
||||||
import androidx.core.graphics.drawable.DrawableCompat
|
import androidx.core.graphics.drawable.DrawableCompat
|
||||||
import androidx.navigation.NavAction
|
|
||||||
import androidx.navigation.NavController
|
import androidx.navigation.NavController
|
||||||
import androidx.navigation.NavDirections
|
import androidx.navigation.NavDirections
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
@ -119,9 +118,11 @@ fun AppCompatButton.fixDoubleRipple() {
|
||||||
/**
|
/**
|
||||||
* Crash-safe wrapped around [NavController.navigate] that will not crash if multiple destinations
|
* Crash-safe wrapped around [NavController.navigate] that will not crash if multiple destinations
|
||||||
* are selected at once.
|
* are selected at once.
|
||||||
|
*
|
||||||
* @param directions The [NavDirections] to navigate with.
|
* @param directions The [NavDirections] to navigate with.
|
||||||
*/
|
*/
|
||||||
fun NavController.navigateSafe(directions: NavDirections) = try {
|
fun NavController.navigateSafe(directions: NavDirections) =
|
||||||
|
try {
|
||||||
navigate(directions)
|
navigate(directions)
|
||||||
} catch (e: IllegalStateException) {
|
} catch (e: IllegalStateException) {
|
||||||
// Nothing to do.
|
// Nothing to do.
|
||||||
|
|
|
@ -28,15 +28,16 @@
|
||||||
tools:staticIcon="@drawable/ic_song_24" />
|
tools:staticIcon="@drawable/ic_song_24" />
|
||||||
|
|
||||||
|
|
||||||
<!-- TextView is wrapped in a container so that marquee doesn't break -->
|
<!-- Playback information is wrapped in a container so that marquee doesn't break -->
|
||||||
|
|
||||||
<FrameLayout
|
<LinearLayout
|
||||||
android:id="@+id/playback_song_container"
|
android:id="@+id/playback_info_container"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="@dimen/spacing_medium"
|
android:layout_marginStart="@dimen/spacing_medium"
|
||||||
android:layout_marginEnd="@dimen/spacing_medium"
|
android:layout_marginEnd="@dimen/spacing_medium"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/playback_artist"
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/playback_seek_bar"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0.5"
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
app:layout_constraintStart_toEndOf="@+id/playback_cover"
|
app:layout_constraintStart_toEndOf="@+id/playback_cover"
|
||||||
|
@ -47,43 +48,31 @@
|
||||||
android:id="@+id/playback_song"
|
android:id="@+id/playback_song"
|
||||||
style="@style/Widget.Auxio.TextView.Primary"
|
style="@style/Widget.Auxio.TextView.Primary"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
tools:text="Song Name" />
|
tools:text="Song Name" />
|
||||||
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/playback_artist"
|
android:id="@+id/playback_artist"
|
||||||
style="@style/Widget.Auxio.TextView.Secondary.Marquee"
|
style="@style/Widget.Auxio.TextView.Secondary.Marquee"
|
||||||
android:layout_width="0dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="@dimen/spacing_medium"
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/playback_album"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintHorizontal_bias="0.5"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/playback_cover"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/playback_song_container"
|
|
||||||
tools:text="Artist Name" />
|
tools:text="Artist Name" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/playback_album"
|
android:id="@+id/playback_album"
|
||||||
style="@style/Widget.Auxio.TextView.Secondary.Marquee"
|
style="@style/Widget.Auxio.TextView.Secondary.Marquee"
|
||||||
android:layout_width="0dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="@dimen/spacing_medium"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/playback_cover"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintHorizontal_bias="0.5"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/playback_cover"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/playback_artist"
|
|
||||||
tools:text="Album Name" />
|
tools:text="Album Name" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<org.oxycblt.auxio.playback.ui.StyledSeekBar
|
<org.oxycblt.auxio.playback.ui.StyledSeekBar
|
||||||
android:id="@+id/playback_seek_bar"
|
android:id="@+id/playback_seek_bar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/playback_controls_container"
|
app:layout_constraintBottom_toTopOf="@+id/playback_controls_container"
|
||||||
app:layout_constraintEnd_toEndOf="@+id/playback_song_container"
|
app:layout_constraintEnd_toEndOf="@+id/playback_info_container"
|
||||||
app:layout_constraintHorizontal_bias="0.0"
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue