Implement a safe slider wrapper that does not crash with invalid values as often. Slider is a terrible component that is not designed with Auxio's use-case in the slightest. Instead of gracefully degrading with invalid values, it just crashes the entire app, which is horrible for UX. Since SeekBar is a useless buggy version-specific sh******ed mess too, we have no choice but to wrap Slider in a safe view layout that hopefully hacks with the input enough to not crash the app when doing simple seeking actions. I hate android so much. Resolves #140.
49 lines
2.1 KiB
XML
49 lines
2.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
xmlns:tools="http://schemas.android.com/tools">
|
|
|
|
<com.google.android.material.slider.Slider
|
|
android:id="@+id/seek_bar_slider"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:layout_marginBottom="@dimen/spacing_medium"
|
|
android:valueFrom="0"
|
|
android:valueTo="1"
|
|
app:haloRadius="@dimen/slider_halo_radius"
|
|
app:labelBehavior="gone"
|
|
app:labelStyle="@style/TextAppearance.Auxio.BodySmall"
|
|
app:layout_constraintBottom_toTopOf="@+id/playback_play_pause"
|
|
app:layout_constraintEnd_toEndOf="parent"
|
|
app:layout_constraintHorizontal_bias="0.0"
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
app:thumbRadius="@dimen/slider_thumb_radius"
|
|
app:trackColorInactive="@color/sel_track" />
|
|
|
|
<TextView
|
|
android:id="@+id/seek_bar_position"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:layout_marginStart="@dimen/spacing_medium"
|
|
android:textAppearance="@style/TextAppearance.Auxio.BodyMedium"
|
|
android:textColor="@color/sel_accented_secondary"
|
|
android:layout_marginBottom="@dimen/spacing_tiny"
|
|
android:layout_gravity="bottom|start"
|
|
tools:text="11:38" />
|
|
|
|
<TextView
|
|
android:id="@+id/seek_bar_duration"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:layout_marginEnd="@dimen/spacing_medium"
|
|
android:layout_marginBottom="@dimen/spacing_tiny"
|
|
android:textAppearance="@style/TextAppearance.Auxio.BodyMedium"
|
|
android:textColor="?android:attr/textColorSecondary"
|
|
android:layout_gravity="bottom|end"
|
|
app:layout_constraintEnd_toEndOf="parent"
|
|
app:layout_constraintTop_toBottomOf="@+id/playback_seek_bar"
|
|
tools:text="16:16" />
|
|
|
|
</FrameLayout> |