Start of work for a structural modification of the player

This commit is contained in:
CappielloAntonio 2022-01-02 20:53:11 +01:00
parent 9fdc9ff44d
commit 0fbf3a4cdf
18 changed files with 900 additions and 484 deletions

View file

@ -1,33 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/player_nested_scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/cardColor"
app:elevation="8dp">
<FrameLayout
<include
android:id="@+id/player_body_layout"
layout="@layout/player_body_bottom_sheet"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="match_parent" />
<androidx.media3.ui.PlayerControlView
android:id="@+id/player_body_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:controller_layout_id="@layout/player_body_bottom_sheet"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:show_timeout="0"/>
<include
android:id="@+id/player_header_layout"
layout="@layout/player_header_bottom_sheet"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_peek_height"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</FrameLayout>
</androidx.core.widget.NestedScrollView>
<include
android:id="@+id/player_header_layout"
layout="@layout/player_header_bottom_sheet"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_peek_height" />
</FrameLayout>

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.media3.ui.PlayerControlView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/player_control_body_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:controller_layout_id="@layout/player_control_view_body"
app:show_timeout="0"/>

View file

@ -0,0 +1,14 @@
<com.cappielloantonio.play.helper.recyclerview.NestedScrollableHost xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/player_queue_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:orientation="vertical"
android:paddingTop="12dp"
android:paddingBottom="@dimen/global_padding_bottom" />
</com.cappielloantonio.play.helper.recyclerview.NestedScrollableHost>

View file

@ -1,259 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/player_body_bottom_sheet_layout"
<androidx.viewpager2.widget.ViewPager2 xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/player_body_bottom_sheet_view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
android:orientation="vertical">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar"
app:elevation="0dp">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
app:popupTheme="@style/ThemeOverlay.MaterialComponents.Light">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/player_move_down_bottom_sheet"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_gravity="center_vertical"
android:layout_marginEnd="8dp"
android:background="@drawable/ic_bottom_sheet_down"
android:foreground="?android:attr/selectableItemBackgroundBorderless" />
<TextView
style="@style/ToolbarTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:text="@string/player_bottom_sheet_title" />
</LinearLayout>
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/player_song_cover_view_pager"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintDimensionRatio="H,1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:id="@+id/player_big_timer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="22dp"
android:orientation="horizontal">
<TextView
android:id="@+id/exo_position"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginLeft="24dp"
android:paddingTop="4dp"
android:text="@string/label_placeholder"
android:textColor="@color/titleTextColor"
android:textSize="12sp" />
<androidx.media3.ui.DefaultTimeBar
android:id="@id/exo_progress"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_weight="1"
app:bar_height="2dp"
app:buffered_color="@color/seekBarBufferedColor"
app:played_color="@color/seekBarPlayedColor"
app:scrubber_color="@color/seekBarPlayedColor"
app:scrubber_dragged_size="8dp"
app:unplayed_color="@color/seekBarUnPlayedColor" />
<TextView
android:id="@+id/exo_duration"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginRight="24dp"
android:paddingTop="4dp"
android:text="@string/label_placeholder"
android:textColor="@color/titleTextColor"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/player_song_title_label"
style="@style/TitleTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_weight="1"
android:paddingStart="24dp"
android:paddingEnd="24dp"
android:text="@string/label_placeholder" />
<ToggleButton
android:id="@+id/button_favorite"
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="24dp"
android:background="@drawable/button_favorite_selector"
android:checked="false"
android:foreground="?android:attr/selectableItemBackgroundBorderless"
android:text=""
android:textOff=""
android:textOn="" />
</LinearLayout>
<TextView
android:id="@+id/player_artist_name_label"
style="@style/SubheadTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="24dp"
android:paddingEnd="24dp"
android:paddingBottom="12dp"
android:text="@string/label_placeholder" />
<LinearLayout
android:id="@+id/player_music_command_sector"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<View
android:layout_width="0dp"
android:layout_height="0.5dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="18dp"
android:layout_marginEnd="18dp"
android:layout_weight="1"
android:background="@color/dividerColor" />
<ImageButton
android:id="@+id/player_command_unfold_button"
android:layout_width="18dp"
android:layout_height="18dp"
android:background="@drawable/ic_unfold"
android:scaleType="fitCenter" />
<View
android:layout_width="0dp"
android:layout_height="0.5dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="18dp"
android:layout_marginEnd="18dp"
android:layout_weight="1"
android:background="@color/dividerColor" />
</LinearLayout>
<androidx.cardview.widget.CardView
android:id="@+id/player_command_cardview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="@color/colorPrimary"
android:visibility="gone"
app:cardElevation="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipChildren="false"
android:gravity="center"
android:orientation="horizontal">
<ImageButton
android:id="@+id/exo_prev"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="24dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="fitCenter"
app:srcCompat="@drawable/ic_skip_previous" />
<ImageButton
android:id="@id/exo_play"
style="@style/ExoMediaButton.Play"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginTop="4dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="fitCenter"
android:src="@drawable/ic_play" />
<ImageButton
android:id="@id/exo_pause"
style="@style/ExoMediaButton.Pause"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginTop="4dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="fitCenter"
android:src="@drawable/ic_pause" />
<ImageButton
android:id="@+id/exo_next"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="24dp"
android:layout_marginTop="4dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="fitCenter"
app:srcCompat="@drawable/ic_skip_next" />
</LinearLayout>
<View
android:id="@+id/player_divider_bottom"
style="@style/Divider"
android:layout_marginStart="18dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="18dp" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/player_queue_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:paddingTop="12dp"
android:paddingBottom="@dimen/global_padding_bottom" />
</LinearLayout>
android:background="@color/colorPrimary" />

View file

@ -0,0 +1,250 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/player_body_bottom_sheet_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar"
app:elevation="0dp">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
app:popupTheme="@style/ThemeOverlay.MaterialComponents.Light">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/player_move_down_bottom_sheet"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_gravity="center_vertical"
android:layout_marginEnd="8dp"
android:background="@drawable/ic_bottom_sheet_down"
android:foreground="?android:attr/selectableItemBackgroundBorderless" />
<TextView
style="@style/ToolbarTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:text="@string/player_bottom_sheet_title" />
</LinearLayout>
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/player_song_cover_view_pager"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintDimensionRatio="H,1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:id="@+id/player_big_timer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="22dp"
android:orientation="horizontal">
<TextView
android:id="@+id/exo_position"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginLeft="24dp"
android:paddingTop="4dp"
android:text="@string/label_placeholder"
android:textColor="@color/titleTextColor"
android:textSize="12sp" />
<androidx.media3.ui.DefaultTimeBar
android:id="@id/exo_progress"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_weight="1"
app:bar_height="2dp"
app:buffered_color="@color/seekBarBufferedColor"
app:played_color="@color/seekBarPlayedColor"
app:scrubber_color="@color/seekBarPlayedColor"
app:scrubber_dragged_size="8dp"
app:unplayed_color="@color/seekBarUnPlayedColor" />
<TextView
android:id="@+id/exo_duration"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginRight="24dp"
android:paddingTop="4dp"
android:text="@string/label_placeholder"
android:textColor="@color/titleTextColor"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/player_song_title_label"
style="@style/TitleTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_weight="1"
android:paddingStart="24dp"
android:paddingEnd="24dp"
android:text="@string/label_placeholder" />
<ToggleButton
android:id="@+id/button_favorite"
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="24dp"
android:background="@drawable/button_favorite_selector"
android:checked="false"
android:foreground="?android:attr/selectableItemBackgroundBorderless"
android:text=""
android:textOff=""
android:textOn="" />
</LinearLayout>
<TextView
android:id="@+id/player_artist_name_label"
style="@style/SubheadTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="24dp"
android:paddingEnd="24dp"
android:paddingBottom="12dp"
android:text="@string/label_placeholder" />
<LinearLayout
android:id="@+id/player_music_command_sector"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<View
android:layout_width="0dp"
android:layout_height="0.5dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="18dp"
android:layout_marginEnd="18dp"
android:layout_weight="1"
android:background="@color/dividerColor" />
<ImageButton
android:id="@+id/player_command_unfold_button"
android:layout_width="18dp"
android:layout_height="18dp"
android:background="@drawable/ic_unfold"
android:scaleType="fitCenter" />
<View
android:layout_width="0dp"
android:layout_height="0.5dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="18dp"
android:layout_marginEnd="18dp"
android:layout_weight="1"
android:background="@color/dividerColor" />
</LinearLayout>
<androidx.cardview.widget.CardView
android:id="@+id/player_command_cardview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="@color/colorPrimary"
android:visibility="visible"
app:cardElevation="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipChildren="false"
android:gravity="center"
android:orientation="horizontal">
<ImageButton
android:id="@+id/exo_prev"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="24dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="fitCenter"
app:srcCompat="@drawable/ic_skip_previous" />
<ImageButton
android:id="@id/exo_play"
style="@style/ExoMediaButton.Play"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginTop="4dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="fitCenter"
android:src="@drawable/ic_play" />
<ImageButton
android:id="@id/exo_pause"
style="@style/ExoMediaButton.Pause"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginTop="4dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="fitCenter"
android:src="@drawable/ic_pause" />
<ImageButton
android:id="@+id/exo_next"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="24dp"
android:layout_marginTop="4dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="fitCenter"
app:srcCompat="@drawable/ic_skip_next" />
</LinearLayout>
<View
android:id="@+id/player_divider_bottom"
style="@style/Divider"
android:layout_marginStart="18dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="18dp" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>

View file

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_peek_height"
android:background="@color/almostCardColor"
android:clipChildren="false"
android:elevation="2dp">
<ImageView
android:id="@+id/player_header_song_cover_image"
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_gravity="center"
android:layout_marginStart="12dp"
app:layout_constraintBottom_toTopOf="@+id/exo_progress"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/player_header_song_title_label"
style="@style/ItemTitleTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:ellipsize="end"
android:maxLines="1"
android:layout_marginStart="8dp"
android:layout_marginEnd="64dp"
app:layout_constraintEnd_toStartOf="@+id/exo_next"
app:layout_constraintStart_toEndOf="@+id/player_header_song_cover_image"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/player_header_song_artist_label"
style="@style/ItemSubtitleTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:fontFamily="@font/opensans"
android:maxLines="1"
android:layout_marginStart="8dp"
android:layout_marginEnd="64dp"
app:layout_constraintEnd_toStartOf="@+id/exo_next"
app:layout_constraintStart_toEndOf="@+id/player_header_song_cover_image"
app:layout_constraintTop_toBottomOf="@+id/player_header_song_title_label" />
<ImageButton
android:id="@+id/exo_play"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:background="@drawable/ic_play"
android:foreground="?android:attr/selectableItemBackgroundBorderless"
app:layout_constraintBottom_toTopOf="@+id/exo_progress"
app:layout_constraintEnd_toStartOf="@+id/exo_next"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/exo_pause"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:background="@drawable/ic_pause"
android:foreground="?android:attr/selectableItemBackgroundBorderless"
app:layout_constraintBottom_toTopOf="@+id/exo_progress"
app:layout_constraintEnd_toStartOf="@+id/exo_next"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/exo_next"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:background="@drawable/ic_skip_next"
android:foreground="?android:attr/selectableItemBackgroundBorderless"
app:layout_constraintBottom_toTopOf="@+id/exo_progress"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.media3.ui.DefaultTimeBar
android:id="@id/exo_progress"
android:layout_width="match_parent"
android:layout_height="2dp"
app:bar_height="2dp"
app:buffered_color="@color/seekBarBufferedColor"
app:played_color="@color/seekBarPlayedColor"
app:scrubber_color="@color/seekBarPlayedColor"
app:unplayed_color="@color/seekBarUnPlayedColor"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>