Add playback fragment

Add a fragment to show songs that are currently being played.
This commit is contained in:
OxygenCobalt
2020-10-05 15:54:53 -06:00
parent 21ff93d5f0
commit a72cb48c71
18 changed files with 266 additions and 103 deletions
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<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">
<data>
<variable
name="song"
type="org.oxycblt.auxio.music.Song" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:animateLayoutChanges="true"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ProgressBar
android:id="@+id/song_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="@dimen/playback_progress_size"
android:clickable="false"
android:progressBackgroundTint="?android:attr/colorControlNormal"
android:progressTint="?android:attr/colorPrimary"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:progress="70" />
<ImageView
android:id="@+id/album_cover"
android:layout_width="@dimen/cover_size_compact"
android:layout_height="@dimen/cover_size_compact"
android:contentDescription="@{@string/description_album_cover(song.name)}"
android:layout_margin="@dimen/margin_smallish"
app:coverArt="@{song}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/song_progress"
tools:src="@drawable/ic_song" />
<TextView
android:id="@+id/song_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:fontFamily="@font/inter_semibold"
android:text="@{song.name}"
android:layout_marginStart="@dimen/margin_smallish"
android:textAppearance="@style/TextAppearance.SmallHeader"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
app:layout_constraintBottom_toTopOf="@+id/song_info"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/album_cover"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
tools:text="Song Name" />
<TextView
android:id="@+id/song_info"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_smallish"
android:ellipsize="marquee"
android:singleLine="true"
android:marqueeRepeatLimit="marquee_forever"
android:textAppearance="@style/TextAppearance.MaterialComponents.Caption"
android:text="@{@string/format_info(song.album.name, song.album.artist.name)}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/album_cover"
app:layout_constraintTop_toBottomOf="@+id/song_name"
tools:text="Artist / Album" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
+9 -1
View File
@@ -15,6 +15,13 @@
android:layout_height="0dp"
android:layout_weight="1" />
<androidx.fragment.app.FragmentContainerView
android:id="@+id/playback_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:name="org.oxycblt.auxio.playback.CompactPlaybackFragment"
android:elevation="@dimen/elevation_normal" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/main_tabs"
android:layout_width="match_parent"
@@ -29,7 +36,8 @@
app:tabIndicator="@drawable/indicator"
app:tabIndicatorColor="?android:attr/colorPrimary"
app:tabMode="fixed"
app:tabRippleColor="@color/selection_color" />
app:tabRippleColor="@color/selection_color"
tools:background="@color/control_color" />
</LinearLayout>
</layout>
+28 -28
View File
@@ -12,10 +12,10 @@
<action
android:id="@+id/action_to_main"
app:destination="@id/main_fragment"
app:enterAnim="@anim/fragment_fade_enter"
app:exitAnim="@anim/fragment_fade_exit"
app:popEnterAnim="@anim/fragment_fade_enter"
app:popExitAnim="@anim/fragment_fade_exit"
app:enterAnim="@anim/nav_default_enter_anim"
app:exitAnim="@anim/nav_default_exit_anim"
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
app:popExitAnim="@anim/nav_default_pop_exit_anim"
app:popUpTo="@id/loading_fragment"
app:popUpToInclusive="true"
app:launchSingleTop="true" />
@@ -27,24 +27,24 @@
tools:layout="@layout/fragment_main">
<action
android:id="@+id/action_show_artist"
app:enterAnim="@anim/fragment_fade_enter"
app:exitAnim="@anim/fragment_fade_exit"
app:popEnterAnim="@anim/fragment_fade_enter"
app:popExitAnim="@anim/fragment_fade_exit"
app:enterAnim="@anim/nav_default_enter_anim"
app:exitAnim="@anim/nav_default_exit_anim"
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
app:popExitAnim="@anim/nav_default_pop_exit_anim"
app:destination="@id/artist_detail_fragment" />
<action
android:id="@+id/action_show_album"
app:enterAnim="@anim/fragment_fade_enter"
app:exitAnim="@anim/fragment_fade_exit"
app:popEnterAnim="@anim/fragment_fade_enter"
app:popExitAnim="@anim/fragment_fade_exit"
app:enterAnim="@anim/nav_default_enter_anim"
app:exitAnim="@anim/nav_default_exit_anim"
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
app:popExitAnim="@anim/nav_default_pop_exit_anim"
app:destination="@id/album_detail_fragment" />
<action
android:id="@+id/action_show_genre"
app:enterAnim="@anim/fragment_fade_enter"
app:exitAnim="@anim/fragment_fade_exit"
app:popEnterAnim="@anim/fragment_fade_enter"
app:popExitAnim="@anim/fragment_fade_exit"
app:enterAnim="@anim/nav_default_enter_anim"
app:exitAnim="@anim/nav_default_exit_anim"
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
app:popExitAnim="@anim/nav_default_pop_exit_anim"
app:destination="@id/genreDetailFragment" />
<action
android:id="@+id/action_return_to_loading"
@@ -62,10 +62,10 @@
app:argType="long" />
<action
android:id="@+id/action_show_album"
app:enterAnim="@anim/fragment_fade_enter"
app:exitAnim="@anim/fragment_fade_exit"
app:popEnterAnim="@anim/fragment_fade_enter"
app:popExitAnim="@anim/fragment_fade_exit"
app:enterAnim="@anim/nav_default_enter_anim"
app:exitAnim="@anim/nav_default_exit_anim"
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
app:popExitAnim="@anim/nav_default_pop_exit_anim"
app:destination="@id/album_detail_fragment" />
</fragment>
<fragment
@@ -81,10 +81,10 @@
app:argType="boolean" />
<action
android:id="@+id/action_show_parent_artist"
app:enterAnim="@anim/fragment_fade_enter"
app:exitAnim="@anim/fragment_fade_exit"
app:popEnterAnim="@anim/fragment_fade_enter"
app:popExitAnim="@anim/fragment_fade_exit"
app:enterAnim="@anim/nav_default_enter_anim"
app:exitAnim="@anim/nav_default_exit_anim"
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
app:popExitAnim="@anim/nav_default_pop_exit_anim"
app:destination="@id/artist_detail_fragment" />
</fragment>
<fragment
@@ -94,10 +94,10 @@
tools:layout="@layout/fragment_genre_detail">
<action
android:id="@+id/action_show_artist"
app:enterAnim="@anim/fragment_fade_enter"
app:exitAnim="@anim/fragment_fade_exit"
app:popEnterAnim="@anim/fragment_fade_enter"
app:popExitAnim="@anim/fragment_fade_exit"
app:enterAnim="@anim/nav_default_enter_anim"
app:exitAnim="@anim/nav_default_exit_anim"
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
app:popExitAnim="@anim/nav_default_pop_exit_anim"
app:destination="@id/artist_detail_fragment" />
<argument
android:name="genreId"
+4
View File
@@ -5,12 +5,14 @@
<dimen name="padding_medium">16dp</dimen>
<dimen name="margin_small">8dp</dimen>
<dimen name="margin_smallish">10dp</dimen>
<dimen name="margin_medium">16dp</dimen>
<dimen name="status_icon_size">48dp</dimen>
<dimen name="tab_menu_size">40dp</dimen>
<dimen name="cover_size_small">36dp</dimen>
<dimen name="cover_size_compact">44dp</dimen>
<dimen name="cover_size_normal">56dp</dimen>
<dimen name="cover_size_large">68dp</dimen>
@@ -26,5 +28,7 @@
<dimen name="divider_ripple_size">18dp</dimen>
<dimen name="playback_progress_size">2dp</dimen>
<dimen name="elevation_normal">4dp</dimen>
</resources>
+4
View File
@@ -27,6 +27,10 @@
<item name="android:textSize">@dimen/detail_header_size_max</item>
</style>
<style name="TextAppearance.SmallHeader" parent="TextAppearance.MaterialComponents.Body2">
<item name="android:fontFamily">@font/inter_semibold</item>
</style>
<style name="AppThemeOverlay.Popup" parent="ThemeOverlay.AppCompat.DayNight">
<item name="android:colorBackground">@color/background</item>
<item name="colorControlHighlight">@color/selection_color</item>