Improved alignments & Add classic player'

This commit is contained in:
Hemanth S 2020-05-06 19:49:16 +05:30
parent 21d59f0274
commit c3c5f7e829
14 changed files with 217 additions and 190 deletions

View file

@ -263,7 +263,7 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C
.dontTransform()
.into(object : RetroMusicColoredTarget(image) {
override fun onColorReady(colors: MediaNotificationProcessor) {
setColors(colors.backgroundColor)
setColors(colors.primaryTextColor)
}
})
}
@ -348,8 +348,7 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C
R.id.action_sort_order_title -> sortOrder = AlbumSongSortOrder.SONG_A_Z
R.id.action_sort_order_title_desc -> sortOrder = AlbumSongSortOrder.SONG_Z_A
R.id.action_sort_order_track_list -> sortOrder = AlbumSongSortOrder.SONG_TRACK_LIST
R.id.action_sort_order_artist_song_duration -> sortOrder =
AlbumSongSortOrder.SONG_DURATION
R.id.action_sort_order_artist_song_duration -> sortOrder = AlbumSongSortOrder.SONG_DURATION
}
if (sortOrder != null) {
item.isChecked = true

View file

@ -26,5 +26,5 @@ enum class NowPlayingScreen constructor(
PLAIN(R.string.plain, R.drawable.np_plain, 3),
SIMPLE(R.string.simple, R.drawable.np_simple, 8),
TINY(R.string.tiny, R.drawable.np_tiny, 7),
CLASSIC(R.string.classic, R.drawable.np_tiny, 16),
CLASSIC(R.string.classic, R.drawable.np_classic, 16),
}

View file

@ -476,6 +476,16 @@ public class MediaNotificationProcessor {
return backgroundColor;
}
public int getMightyColor() {
if (isColorLight(backgroundColor)) {
return primaryTextColor;
} else if (isColorLight(primaryTextColor)) {
return secondaryTextColor;
} else {
return backgroundColor;
}
}
public interface OnPaletteLoadedListener {
void onPaletteLoaded(MediaNotificationProcessor mediaNotificationProcessor);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 49 KiB

View file

@ -1,5 +1,5 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
@ -9,15 +9,23 @@
tools:ignore="UnusedAttribute">
<FrameLayout
android:id="@+id/statusBarContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<include layout="@layout/status_bar" />
</FrameLayout>
<FrameLayout
android:id="@+id/toolbarContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/statusBarContainer">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
@ -30,101 +38,104 @@
android:layout_height="48dp" />
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<com.google.android.material.card.MaterialCardView
android:id="@+id/albumCoverContainer"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:transitionName="@string/transition_album_art"
app:cardCornerRadius="24dp"
app:cardElevation="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/container"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/toolbarContainer">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
tools:srcCompat="@tools:sample/backgrounds/scenic[5]" />
</com.google.android.material.card.MaterialCardView>
<androidx.core.widget.NestedScrollView
android:id="@+id/container"
android:layout_width="0dp"
android:layout_height="0dp"
android:fillViewport="true"
android:overScrollMode="never"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/albumCoverContainer"
app:layout_constraintTop_toBottomOf="@id/toolbarContainer">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.card.MaterialCardView
android:id="@+id/albumCoverContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="16dp"
android:transitionName="@string/transition_album_art"
app:cardCornerRadius="24dp"
app:cardElevation="8dp">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
tools:srcCompat="@tools:sample/backgrounds/scenic[5]" />
</com.google.android.material.card.MaterialCardView>
</LinearLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:fillViewport="true"
android:overScrollMode="never">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:gravity="center_vertical"
android:orientation="horizontal">
<code.name.monkey.retromusic.views.RetroShapeableImageView
android:id="@+id/artistImage"
android:layout_width="52dp"
android:layout_height="52dp"
android:layout_marginStart="8dp"
android:scaleType="centerCrop"
app:retroCornerSize="26dp"
tools:srcCompat="@tools:sample/backgrounds/scenic[11]" />
<LinearLayout
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
android:layout_gravity="bottom"
android:layout_weight="1"
android:orientation="vertical"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:paddingBottom="8dp">
<code.name.monkey.retromusic.views.RetroShapeableImageView
android:id="@+id/artistImage"
android:layout_width="52dp"
android:layout_height="52dp"
android:layout_marginStart="8dp"
android:scaleType="centerCrop"
app:retroCornerSize="26dp"
tools:srcCompat="@tools:sample/backgrounds/scenic[11]" />
<LinearLayout
<code.name.monkey.retromusic.views.BaselineGridTextView
android:id="@+id/albumTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_weight="1"
android:orientation="vertical"
android:padding="16dp">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/albumTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="2"
android:textAppearance="@style/TextViewHeadline5"
android:textStyle="bold"
tools:ignore="MissingPrefix"
tools:text="Album name" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/albumText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:paddingTop="4dp"
android:singleLine="true"
android:textAppearance="@style/TextViewSubtitle2"
android:textColor="?android:attr/textColorSecondary"
tools:ignore="MissingPrefix"
tools:text="Album details name" />
</LinearLayout>
android:maxLines="2"
android:textAppearance="@style/TextViewHeadline5"
android:textStyle="bold"
app:lineHeightHint="28sp"
tools:ignore="MissingPrefix"
tools:text="Album name" />
<code.name.monkey.retromusic.views.BaselineGridTextView
android:id="@+id/albumText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:paddingTop="4dp"
android:singleLine="true"
android:textAppearance="@style/TextViewSubtitle2"
android:textColor="?android:attr/textColorSecondary"
app:lineHeightHint="24sp"
tools:ignore="MissingPrefix"
tools:text="Album details name" />
</LinearLayout>
<include layout="@layout/activity_album_content" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
</LinearLayout>
<include layout="@layout/activity_album_content" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -1,5 +1,5 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
@ -9,15 +9,23 @@
tools:ignore="UnusedAttribute">
<FrameLayout
android:id="@+id/statusBarContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<include layout="@layout/status_bar" />
</FrameLayout>
<FrameLayout
android:id="@+id/toolbarContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/statusBarContainer">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
@ -30,91 +38,83 @@
android:layout_height="48dp" />
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
<com.google.android.material.card.MaterialCardView
android:id="@+id/artistCoverContainer"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:transitionName="@string/transition_artist_image"
app:cardCornerRadius="24dp"
app:cardElevation="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/container"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/toolbarContainer">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
android:scaleType="centerCrop"
tools:srcCompat="@tools:sample/backgrounds/scenic[5]" />
<com.google.android.material.card.MaterialCardView
android:id="@+id/artistCoverContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="16dp"
android:transitionName="@string/transition_artist_image"
app:cardCornerRadius="24dp"
app:cardElevation="8dp">
</com.google.android.material.card.MaterialCardView>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
tools:srcCompat="@tools:sample/backgrounds/scenic[5]" />
</com.google.android.material.card.MaterialCardView>
</LinearLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/container"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"
android:overScrollMode="never"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/artistCoverContainer"
app:layout_constraintTop_toBottomOf="@id/toolbarContainer">
<androidx.core.widget.NestedScrollView
android:id="@+id/container"
<LinearLayout
android:id="@+id/background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:overScrollMode="never">
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:orientation="vertical"
android:padding="16dp">
<LinearLayout
android:id="@+id/background"
<code.name.monkey.retromusic.views.BaselineGridTextView
android:id="@+id/artistTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:maxLines="2"
android:textAppearance="@style/TextViewHeadline5"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"
tools:ignore="MissingPrefix"
tools:text="Title" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/artistTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="2"
android:textAppearance="@style/TextViewHeadline5"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"
tools:ignore="MissingPrefix"
tools:text="Title" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:textAppearance="@style/TextViewSubtitle2"
android:textColor="?android:attr/textColorSecondary"
tools:ignore="MissingPrefix"
tools:text="Title" />
</LinearLayout>
<include layout="@layout/activity_artist_content" />
</LinearLayout>
<View
<code.name.monkey.retromusic.views.BaselineGridTextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="@dimen/status_bar_padding" />
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:textAppearance="@style/TextViewSubtitle2"
android:textColor="?android:attr/textColorSecondary"
app:lineHeightHint="24sp"
tools:ignore="MissingPrefix"
tools:text="Title" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
</LinearLayout>
<include layout="@layout/activity_artist_content" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -54,14 +54,17 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<code.name.monkey.retromusic.views.WidthFitSquareCardView
<com.google.android.material.card.MaterialCardView
android:id="@+id/albumCoverContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:transitionName="@string/transition_album_art"
app:cardCornerRadius="24dp"
app:cardElevation="8dp"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
@ -73,8 +76,7 @@
android:scaleType="centerCrop"
tools:srcCompat="@tools:sample/backgrounds/scenic[5]" />
</code.name.monkey.retromusic.views.WidthFitSquareCardView>
</com.google.android.material.card.MaterialCardView>
<code.name.monkey.retromusic.views.RetroShapeableImageView
android:id="@+id/artistImage"
@ -88,7 +90,7 @@
app:retroCornerSize="26dp"
tools:srcCompat="@tools:sample/backgrounds/scenic[11]" />
<com.google.android.material.textview.MaterialTextView
<code.name.monkey.retromusic.views.BaselineGridTextView
android:id="@+id/albumTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -105,7 +107,7 @@
tools:ignore="MissingPrefix"
tools:text="@tools:sample/lorem/random" />
<com.google.android.material.textview.MaterialTextView
<code.name.monkey.retromusic.views.BaselineGridTextView
android:id="@+id/albumText"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -119,6 +121,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/artistImage"
app:layout_constraintTop_toBottomOf="@id/albumTitle"
app:lineHeightHint="24sp"
tools:ignore="MissingPrefix"
tools:text="@tools:sample/lorem/random" />

View file

@ -10,7 +10,7 @@
android:id="@+id/playAction"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="4dp"
android:text="@string/action_play_all"
android:textColor="?android:attr/textColorPrimary"
@ -26,7 +26,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginEnd="8dp"
android:layout_marginEnd="16dp"
android:text="@string/shuffle"
android:textColor="?android:attr/textColorPrimary"
app:backgroundTint="?attr/colorSurface"

View file

@ -10,7 +10,7 @@
android:id="@+id/playAction"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="4dp"
android:text="@string/action_play_all"
app:backgroundTint="?attr/colorSurface"
@ -25,7 +25,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:layout_marginEnd="16dp"
android:text="@string/shuffle"
app:backgroundTint="?attr/colorSurface"
app:icon="@drawable/ic_shuffle_white_24dp"
@ -39,7 +39,7 @@
android:id="@+id/albumTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="12dp"
android:padding="16dp"
android:text="@string/albums"
android:textAppearance="@style/TextViewHeadline6"
android:textStyle="bold"

View file

@ -54,14 +54,17 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<code.name.monkey.retromusic.views.WidthFitSquareCardView
<com.google.android.material.card.MaterialCardView
android:id="@+id/artistCoverContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:transitionName="@string/transition_artist_image"
app:cardCornerRadius="24dp"
app:cardElevation="8dp"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
@ -73,10 +76,10 @@
android:scaleType="centerCrop"
tools:srcCompat="@tools:sample/backgrounds/scenic[16]" />
</code.name.monkey.retromusic.views.WidthFitSquareCardView>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.textview.MaterialTextView
<code.name.monkey.retromusic.views.BaselineGridTextView
android:id="@+id/artistTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -93,7 +96,7 @@
tools:ignore="MissingPrefix"
tools:text="Title" />
<com.google.android.material.textview.MaterialTextView
<code.name.monkey.retromusic.views.BaselineGridTextView
android:id="@+id/text"
android:layout_width="0dp"
android:layout_height="wrap_content"

View file

@ -18,8 +18,8 @@
</FrameLayout>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:id="@+id/mainContent"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
@ -35,8 +35,10 @@
android:id="@+id/toolbarContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="8dp"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
app:cardUseCompatPadding="true"
app:cardCornerRadius="8dp"
app:layout_scrollFlags="scroll|enterAlways">
<FrameLayout
@ -49,8 +51,8 @@
android:layout_height="@dimen/toolbar_height"
android:background="?attr/colorSurface"
app:popupTheme="?attr/toolbarPopupTheme"
app:titleTextColor="?attr/colorControlNormal"
app:titleTextAppearance="@style/TextViewHeadline6"
app:titleTextColor="?attr/colorControlNormal"
tools:ignore="UnusedAttribute">
<com.google.android.material.textview.MaterialTextView
@ -59,8 +61,8 @@
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/app_name"
android:textColor="?attr/colorControlNormal"
android:textAppearance="@style/TextViewHeadline6" />
android:textAppearance="@style/TextViewHeadline6"
android:textColor="?attr/colorControlNormal" />
</androidx.appcompat.widget.Toolbar>
<ViewStub

View file

@ -7,7 +7,6 @@
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingBottom="12dp"
tools:ignore="MissingPrefix">
@ -159,6 +158,7 @@
android:id="@+id/playPauseButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:background="?attr/roundSelector"
app:layout_constraintBottom_toTopOf="@+id/volumeFragmentContainer"
app:layout_constraintEnd_toStartOf="@+id/nextButton"

View file

@ -18,15 +18,14 @@
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="8dp"
android:paddingEnd="8dp">
>
<com.google.android.material.button.MaterialButton
android:id="@+id/playAction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="2dp"
android:layout_weight="1"
android:text="@string/action_play_all"
app:backgroundTint="?attr/colorSurface"
@ -36,8 +35,8 @@
android:id="@+id/shuffleAction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="2dp"
android:layout_weight="1"
android:text="@string/shuffle"
app:backgroundTint="?attr/colorSurface"