playback: make compact playback ui a view

Change CompactPlaybackFragment into a View. This completely fixes the
issue I tried to band-aid in ae39054. The code is a bit uglier, but
that's tolerable.
This commit is contained in:
OxygenCobalt
2021-10-31 11:14:04 -06:00
parent ae39054b63
commit c1e1329c21
13 changed files with 226 additions and 178 deletions
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Hack to make MaterialShapeDrawable cooperate with RippleDrawable. See
CompactPlaybackView for more info. -->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?attr/colorControlHighlight">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="@android:color/white" />
</shape>
</item>
<item android:id="@android:id/background">
<shape android:shape="rectangle" />
</item>
</ripple>
@@ -32,7 +32,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
app:layout_role="content"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"
tools:listitem="@layout/item_detail" />
@@ -2,7 +2,7 @@
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".playback.CompactPlaybackFragment">
tools:context=".playback.CompactPlaybackView">
<data>
@@ -10,19 +10,17 @@
name="song"
type="org.oxycblt.auxio.music.Song" />
<variable
name="playbackModel"
type="org.oxycblt.auxio.playback.PlaybackViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
<merge
android:id="@+id/playback_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:background="@drawable/ui_background_ripple"
android:clickable="true"
android:focusable="true">
android:focusable="true"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
<ImageView
android:id="@+id/playback_cover"
@@ -73,7 +71,6 @@
android:src="@drawable/sel_playing_state"
android:layout_margin="@dimen/spacing_small"
android:contentDescription="@string/desc_play_pause"
android:onClick="@{() -> playbackModel.invertPlayingStatus()}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@@ -82,12 +79,12 @@
android:id="@+id/playback_progress"
android:layout_width="match_parent"
android:layout_height="@dimen/size_stroke_large"
android:max="@{(int) song.seconds}"
style="@style/Widget.Auxio.ProgressBar"
android:progress="@{playbackModel.positionAsProgress}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:progress="70" />
</androidx.constraintlayout.widget.ConstraintLayout>
</merge>
</layout>
@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_playback"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorSurface"
android:clipToPadding="true"
android:elevation="@dimen/elevation_normal"
tools:layout="@layout/fragment_compact_playback" />
-5
View File
@@ -4,9 +4,4 @@
<attr name="entries" format="reference" />
<attr name="entryValues" format="reference" />
</declare-styleable>
<attr format="enum" name="layout_role">
<enum name="content" value="0" />
<enum name="floating" value="1" />
</attr>
</resources>
+3
View File
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- This is for PlaybackBarLayout -->
<item name="playback_bar" type="id" />
<!-- This is for HomeFragment's AppBarLayout. Explanations for these can be found there. -->
<item name="home_song_list" type="id" />
<item name="home_album_list" type="id" />