Changed playerFragment controller layout

This commit is contained in:
CappielloAntonio 2022-01-03 17:43:54 +01:00
parent aba5134469
commit 8394c3f84e
8 changed files with 227 additions and 203 deletions

4
.idea/misc.xml generated
View file

@ -30,16 +30,19 @@
<entry key="app/src/main/res/drawable/ic_favorites_outlined.xml" value="0.28055555555555556" />
<entry key="app/src/main/res/drawable/ic_feed.xml" value="0.28055555555555556" />
<entry key="app/src/main/res/drawable/ic_file_download.xml" value="0.2722222222222222" />
<entry key="app/src/main/res/drawable/ic_grade.xml" value="0.28703703703703703" />
<entry key="app/src/main/res/drawable/ic_graphic_eq.xml" value="0.28055555555555556" />
<entry key="app/src/main/res/drawable/ic_home.xml" value="0.28055555555555556" />
<entry key="app/src/main/res/drawable/ic_launcher_background.xml" value="0.2814814814814815" />
<entry key="app/src/main/res/drawable/ic_lyrics.xml" value="0.17314814814814813" />
<entry key="app/src/main/res/drawable/ic_more_vert.xml" value="0.28055555555555556" />
<entry key="app/src/main/res/drawable/ic_pause.xml" value="0.28055555555555556" />
<entry key="app/src/main/res/drawable/ic_pause_circle.xml" value="0.28703703703703703" />
<entry key="app/src/main/res/drawable/ic_play.xml" value="0.27685185185185185" />
<entry key="app/src/main/res/drawable/ic_play_arrow_white_24dp.xml" value="0.28055555555555556" />
<entry key="app/src/main/res/drawable/ic_play_for_work.xml" value="0.30625" />
<entry key="app/src/main/res/drawable/ic_refresh.xml" value="0.18958333333333333" />
<entry key="app/src/main/res/drawable/ic_repeat.xml" value="0.28703703703703703" />
<entry key="app/src/main/res/drawable/ic_search.xml" value="0.27685185185185185" />
<entry key="app/src/main/res/drawable/ic_settings.xml" value="0.28055555555555556" />
<entry key="app/src/main/res/drawable/ic_shuffle.xml" value="0.2722222222222222" />
@ -50,6 +53,7 @@
<entry key="app/src/main/res/drawable/ic_star.xml" value="0.2722222222222222" />
<entry key="app/src/main/res/drawable/ic_toolbar_motion_on.xml" value="0.30625" />
<entry key="app/src/main/res/drawable/ic_unfold.xml" value="0.5484375" />
<entry key="app/src/main/res/drawable/outline_play_circle.xml" value="0.28703703703703703" />
<entry key="app/src/main/res/drawable/ui_empty_list.xml" value="0.28055555555555556" />
<entry key="app/src/main/res/layout/activity_main.xml" value="0.3229166666666667" />
<entry key="app/src/main/res/layout/bottom_sheet_album_dialog.xml" value="0.3229166666666667" />

View file

@ -13,7 +13,6 @@ import android.widget.TextView;
import android.widget.ToggleButton;
import androidx.annotation.NonNull;
import androidx.cardview.widget.CardView;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import androidx.media3.common.MediaMetadata;
@ -40,9 +39,8 @@ public class PlayerControllerFragment extends Fragment {
private InnerFragmentPlayerControllerBinding bind;
private ImageView playerMoveDownBottomSheet;
private ViewPager2 playerSongCoverViewPager;
private ImageButton buttonRating;
private ToggleButton buttonFavorite;
private ImageButton playerCommandUnfoldButton;
private CardView playerCommandCardview;
private TextView playerSongTitleLabel;
private TextView playerArtistNameLabel;
@ -62,7 +60,6 @@ public class PlayerControllerFragment extends Fragment {
init();
initCoverLyricsSlideView();
initMediaListenable();
initMusicCommandUnfoldButton();
initArtistLabelButton();
return view;
@ -93,8 +90,7 @@ public class PlayerControllerFragment extends Fragment {
playerMoveDownBottomSheet = bind.getRoot().findViewById(R.id.player_move_down_bottom_sheet);
playerSongCoverViewPager = bind.getRoot().findViewById(R.id.player_song_cover_view_pager);
buttonFavorite = bind.getRoot().findViewById(R.id.button_favorite);
playerCommandUnfoldButton = bind.getRoot().findViewById(R.id.player_command_unfold_button);
playerCommandCardview = bind.getRoot().findViewById(R.id.player_command_cardview);
buttonRating = bind.getRoot().findViewById(R.id.button_rating);
playerSongTitleLabel = bind.getRoot().findViewById(R.id.player_song_title_label);
playerArtistNameLabel = bind.getRoot().findViewById(R.id.player_artist_name_label);
@ -167,15 +163,13 @@ public class PlayerControllerFragment extends Fragment {
buttonFavorite.setOnClickListener(v -> playerBottomSheetViewModel.setFavorite(requireContext(), song));
buttonFavorite.setOnLongClickListener(v -> {
buttonRating.setOnClickListener(v -> {
Bundle bundle = new Bundle();
bundle.putParcelable("song_object", song);
RatingDialog dialog = new RatingDialog();
dialog.setArguments(bundle);
dialog.show(requireActivity().getSupportFragmentManager(), null);
return true;
});
playerBottomSheetViewModel.refreshSongInfo(requireActivity(), song);
@ -183,16 +177,6 @@ public class PlayerControllerFragment extends Fragment {
});
}
private void initMusicCommandUnfoldButton() {
playerCommandUnfoldButton.setOnClickListener(view -> {
if (playerCommandCardview.getVisibility() == View.INVISIBLE || playerCommandCardview.getVisibility() == View.GONE) {
playerCommandCardview.setVisibility(View.VISIBLE);
} else {
playerCommandCardview.setVisibility(View.GONE);
}
});
}
private void initArtistLabelButton() {
playerArtistNameLabel.setOnClickListener(view -> playerBottomSheetViewModel.getLiveArtist().observe(requireActivity(), artist -> {
Bundle bundle = new Bundle();

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/titleTextColor"
android:pathData="M12,7.13l0.97,2.29 0.47,1.11 1.2,0.1 2.47,0.21 -1.88,1.63 -0.91,0.79 0.27,1.18 0.56,2.41 -2.12,-1.28 -1.03,-0.64 -1.03,0.62 -2.12,1.28 0.56,-2.41 0.27,-1.18 -0.91,-0.79 -1.88,-1.63 2.47,-0.21 1.2,-0.1 0.47,-1.11 0.97,-2.27M12,2L9.19,8.63 2,9.24l5.46,4.73L5.82,21 12,17.27 18.18,21l-1.64,-7.03L22,9.24l-7.19,-0.61L12,2z"/>
</vector>

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/titleTextColor"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10s10,-4.48 10,-10S17.52,2 12,2zM11,16H9V8h2V16zM15,16h-2V8h2V16z"/>
</vector>

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/titleTextColor"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM10,16.5v-9l6,4.5 -6,4.5z"/>
</vector>

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/titleTextColor"
android:pathData="M7,7h10v3l4,-4 -4,-4v3L5,5v6h2L7,7zM17,17L7,17v-3l-4,4 4,4v-3h12v-6h-2v4z"/>
</vector>

View file

@ -1,17 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/now_playing_song_controller_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_height="match_parent">
<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">
app:elevation="0dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
@ -45,81 +47,43 @@
</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"
android:layout_marginBottom="12dp"
app:layout_constraintBottom_toTopOf="@id/player_song_title_label"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toBottomOf="@+id/appbar" />
</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">
<ImageButton
android:id="@+id/button_rating"
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_marginStart="24dp"
android:layout_marginTop="8dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="fitCenter"
app:layout_constraintBottom_toBottomOf="@+id/player_song_title_label"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/player_song_title_label"
app:srcCompat="@drawable/ic_grade" />
<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_marginTop="8dp"
android:layout_weight="1"
android:paddingStart="24dp"
android:paddingEnd="24dp"
android:text="@string/label_placeholder" />
android:text="@string/label_placeholder"
android:textAlignment="center"
app:layout_constraintBottom_toTopOf="@+id/player_artist_name_label"
app:layout_constraintEnd_toStartOf="@+id/button_favorite"
app:layout_constraintStart_toEndOf="@+id/button_rating" />
<ToggleButton
android:id="@+id/button_favorite"
@ -132,119 +96,156 @@
android:foreground="?android:attr/selectableItemBackgroundBorderless"
android:text=""
android:textOff=""
android:textOn="" />
</LinearLayout>
android:textOn=""
app:layout_constraintBottom_toBottomOf="@+id/player_song_title_label"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/player_song_title_label" />
<TextView
android:id="@+id/player_artist_name_label"
style="@style/SubheadTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:paddingStart="24dp"
android:paddingEnd="24dp"
android:paddingBottom="12dp"
android:text="@string/label_placeholder" />
android:text="@string/label_placeholder"
app:layout_constraintBottom_toTopOf="@+id/exo_progress"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<LinearLayout
android:id="@+id/player_music_command_sector"
android:layout_width="match_parent"
<TextView
android:id="@+id/exo_position"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:layout_gravity="center"
android:layout_marginLeft="24dp"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:text="@string/label_placeholder"
android:textColor="@color/titleTextColor"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="@+id/exo_progress"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/exo_progress" />
<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_marginBottom="12dp"
android:layout_weight="1"
app:bar_height="2dp"
app:buffered_color="@color/seekBarBufferedColor"
app:layout_constraintBottom_toTopOf="@+id/player_play_pause_placeholder_view"
app:layout_constraintEnd_toStartOf="@+id/exo_duration"
app:layout_constraintStart_toEndOf="@+id/exo_position"
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="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="24dp"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:text="@string/label_placeholder"
android:textColor="@color/titleTextColor"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="@+id/exo_progress"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/exo_progress" />
<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" />
android:id="@+id/player_play_pause_placeholder_view"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginBottom="24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<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">
android:id="@+id/exo_shuffle"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginStart="12dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="fitCenter"
app:layout_constraintBottom_toBottomOf="@+id/exo_prev"
app:layout_constraintEnd_toStartOf="@+id/exo_prev"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/exo_prev"
app:srcCompat="@drawable/ic_shuffle" />
<ImageButton
android:id="@+id/exo_prev"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="24dp"
android:layout_width="42dp"
android:layout_height="42dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="fitCenter"
app:layout_constraintBottom_toBottomOf="@+id/player_play_pause_placeholder_view"
app:layout_constraintEnd_toStartOf="@+id/player_play_pause_placeholder_view"
app:layout_constraintStart_toEndOf="@id/exo_shuffle"
app:layout_constraintTop_toTopOf="@+id/player_play_pause_placeholder_view"
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:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginBottom="24dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="fitCenter"
android:src="@drawable/ic_play" />
android:src="@drawable/ic_play_circle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<ImageButton
android:id="@id/exo_pause"
style="@style/ExoMediaButton.Pause"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginTop="4dp"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginBottom="24dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="fitCenter"
android:src="@drawable/ic_pause" />
android:src="@drawable/ic_pause_circle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<ImageButton
android:id="@+id/exo_next"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="24dp"
android:layout_marginTop="4dp"
android:layout_width="42dp"
android:layout_height="42dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="fitCenter"
app:layout_constraintBottom_toBottomOf="@+id/player_play_pause_placeholder_view"
app:layout_constraintEnd_toStartOf="@id/exo_repeat_toggle"
app:layout_constraintStart_toEndOf="@+id/player_play_pause_placeholder_view"
app:layout_constraintTop_toTopOf="@+id/player_play_pause_placeholder_view"
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" />
<ImageButton
android:id="@+id/exo_repeat_toggle"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginEnd="12dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="fitCenter"
app:layout_constraintBottom_toBottomOf="@+id/exo_next"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/exo_next"
app:layout_constraintTop_toTopOf="@+id/exo_next"
app:srcCompat="@drawable/ic_repeat" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -7,7 +7,6 @@
style="@style/LyricsTextView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="16dp"
android:paddingStart="24dp"
android:paddingEnd="24dp"/>
</androidx.core.widget.NestedScrollView>