Revamped classic theme
Why not
This commit is contained in:
parent
3dd4b46efe
commit
1e85e7e943
5 changed files with 77 additions and 82 deletions
|
@ -12,14 +12,15 @@ import androidx.appcompat.widget.Toolbar
|
||||||
import androidx.core.view.ViewCompat
|
import androidx.core.view.ViewCompat
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import code.name.monkey.appthemehelper.ThemeStore
|
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||||
import code.name.monkey.appthemehelper.util.*
|
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||||
|
import code.name.monkey.appthemehelper.util.TintHelper
|
||||||
|
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.RetroBottomSheetBehavior
|
import code.name.monkey.retromusic.RetroBottomSheetBehavior
|
||||||
import code.name.monkey.retromusic.activities.base.AbsSlidingMusicPanelActivity
|
import code.name.monkey.retromusic.activities.base.AbsSlidingMusicPanelActivity
|
||||||
import code.name.monkey.retromusic.adapter.song.PlayingQueueAdapter
|
import code.name.monkey.retromusic.adapter.song.PlayingQueueAdapter
|
||||||
import code.name.monkey.retromusic.extensions.hide
|
import code.name.monkey.retromusic.extensions.hide
|
||||||
import code.name.monkey.retromusic.extensions.ripAlpha
|
|
||||||
import code.name.monkey.retromusic.extensions.show
|
import code.name.monkey.retromusic.extensions.show
|
||||||
import code.name.monkey.retromusic.fragments.VolumeFragment
|
import code.name.monkey.retromusic.fragments.VolumeFragment
|
||||||
import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
|
import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
|
||||||
|
@ -136,8 +137,7 @@ class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener,
|
||||||
0
|
0
|
||||||
).build()
|
).build()
|
||||||
)
|
)
|
||||||
shapeDrawable.fillColor =
|
shapeDrawable.fillColor = ColorStateList.valueOf(ATHUtil.resolveColor(requireContext(), R.attr.colorSurface))
|
||||||
ColorStateList.valueOf(ATHUtil.resolveColor(requireContext(), R.attr.colorSurface))
|
|
||||||
playerQueueSheet.background = shapeDrawable
|
playerQueueSheet.background = shapeDrawable
|
||||||
|
|
||||||
ToolbarContentTintHelper.colorizeToolbar(
|
ToolbarContentTintHelper.colorizeToolbar(
|
||||||
|
@ -263,45 +263,32 @@ class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener,
|
||||||
|
|
||||||
override fun onColorChanged(color: MediaNotificationProcessor) {
|
override fun onColorChanged(color: MediaNotificationProcessor) {
|
||||||
lastColor = color.backgroundColor
|
lastColor = color.backgroundColor
|
||||||
if (ATHUtil.isWindowBackgroundDark(requireContext())) {
|
lastPlaybackControlsColor = color.primaryTextColor
|
||||||
lastPlaybackControlsColor =
|
lastDisabledPlaybackControlsColor = ColorUtil.withAlpha(color.primaryTextColor, 0.3f)
|
||||||
MaterialValueHelper.getPrimaryTextColor(requireContext(), false)
|
|
||||||
lastDisabledPlaybackControlsColor =
|
|
||||||
MaterialValueHelper.getPrimaryDisabledTextColor(requireContext(), false)
|
|
||||||
} else {
|
|
||||||
lastPlaybackControlsColor =
|
|
||||||
MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
|
|
||||||
lastDisabledPlaybackControlsColor =
|
|
||||||
MaterialValueHelper.getSecondaryDisabledTextColor(requireContext(), true)
|
|
||||||
}
|
|
||||||
|
|
||||||
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
|
title.setTextColor(color.primaryTextColor)
|
||||||
color.primaryTextColor
|
text.setTextColor(color.secondaryTextColor)
|
||||||
} else {
|
songInfo.setTextColor(color.secondaryTextColor)
|
||||||
ThemeStore.accentColor(requireContext())
|
|
||||||
}.ripAlpha()
|
|
||||||
|
|
||||||
TintHelper.setTintAuto(
|
songCurrentProgress.setTextColor(lastPlaybackControlsColor)
|
||||||
playPauseButton,
|
songTotalTime.setTextColor(lastPlaybackControlsColor)
|
||||||
MaterialValueHelper.getPrimaryTextColor(
|
|
||||||
requireContext(),
|
|
||||||
ColorUtil.isColorLight(colorFinal)
|
|
||||||
),
|
|
||||||
false
|
|
||||||
)
|
|
||||||
TintHelper.setTintAuto(playPauseButton, colorFinal, true)
|
|
||||||
|
|
||||||
ViewUtil.setProgressDrawable(progressSlider, colorFinal, true)
|
ViewUtil.setProgressDrawable(progressSlider, color.primaryTextColor, true)
|
||||||
volumeFragment?.setTintable(colorFinal)
|
volumeFragment?.setTintableColor(color.primaryTextColor)
|
||||||
|
|
||||||
|
player_queue_sub_header.setTextColor(color.secondaryTextColor)
|
||||||
|
|
||||||
|
TintHelper.setTintAuto(playPauseButton, color.primaryTextColor, true)
|
||||||
|
TintHelper.setTintAuto(playPauseButton, color.backgroundColor, false)
|
||||||
|
updateRepeatState()
|
||||||
|
updateShuffleState()
|
||||||
|
updatePrevNextColor()
|
||||||
|
|
||||||
ToolbarContentTintHelper.colorizeToolbar(
|
ToolbarContentTintHelper.colorizeToolbar(
|
||||||
playerToolbar,
|
playerToolbar,
|
||||||
Color.WHITE,
|
Color.WHITE,
|
||||||
requireActivity()
|
requireActivity()
|
||||||
)
|
)
|
||||||
updateRepeatState()
|
|
||||||
updateShuffleState()
|
|
||||||
updatePrevNextColor()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toggleFavorite(song: Song) {
|
override fun toggleFavorite(song: Song) {
|
||||||
|
@ -349,7 +336,7 @@ class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener,
|
||||||
}
|
}
|
||||||
val height = playerContainer.height
|
val height = playerContainer.height
|
||||||
val width = playerContainer.width
|
val width = playerContainer.width
|
||||||
val finalHeight = height - (playerControlsContainer.height + width)
|
val finalHeight = height - width
|
||||||
val panel = getQueuePanel()
|
val panel = getQueuePanel()
|
||||||
panel.peekHeight = finalHeight
|
panel.peekHeight = finalHeight
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,19 +238,7 @@ class FitPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setUpProgressSlider() {
|
|
||||||
progressSlider.setOnSeekBarChangeListener(object : SimpleOnSeekbarChangeListener() {
|
|
||||||
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
|
|
||||||
if (fromUser) {
|
|
||||||
MusicPlayerRemote.seekTo(progress)
|
|
||||||
onUpdateProgressViews(
|
|
||||||
MusicPlayerRemote.songProgressMillis,
|
|
||||||
MusicPlayerRemote.songDurationMillis
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun showBonceAnimation() {
|
private fun showBonceAnimation() {
|
||||||
playPauseButton.apply {
|
playPauseButton.apply {
|
||||||
|
@ -274,7 +262,19 @@ class FitPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
}.start()
|
}.start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
override fun setUpProgressSlider() {
|
||||||
|
progressSlider.setOnSeekBarChangeListener(object : SimpleOnSeekbarChangeListener() {
|
||||||
|
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
|
||||||
|
if (fromUser) {
|
||||||
|
MusicPlayerRemote.seekTo(progress)
|
||||||
|
onUpdateProgressViews(
|
||||||
|
MusicPlayerRemote.songProgressMillis,
|
||||||
|
MusicPlayerRemote.songDurationMillis
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
override fun onUpdateProgressViews(progress: Int, total: Int) {
|
override fun onUpdateProgressViews(progress: Int, total: Int) {
|
||||||
progressSlider.max = total
|
progressSlider.max = total
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
|
android:paddingBottom="8dp"
|
||||||
tools:ignore="MissingPrefix">
|
tools:ignore="MissingPrefix">
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:background="?attr/colorSurface">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/playerContainer"
|
android:id="@+id/playerContainer"
|
||||||
|
@ -52,6 +53,24 @@
|
||||||
android:navigationIcon="@drawable/ic_keyboard_arrow_down_black_24dp"
|
android:navigationIcon="@drawable/ic_keyboard_arrow_down_black_24dp"
|
||||||
app:navigationIcon="@drawable/ic_keyboard_arrow_down_black_24dp" />
|
app:navigationIcon="@drawable/ic_keyboard_arrow_down_black_24dp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.material.card.MaterialCardView
|
||||||
|
android:id="@+id/playbackControlsFragmentContainer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:cardCornerRadius="0dp"
|
||||||
|
app:cardElevation="24dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/playerAlbumCoverFragment">
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/playerControlsContainer"
|
||||||
|
layout="@layout/fragment_classic_controls"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
</com.google.android.material.card.MaterialCardView>
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
<com.google.android.material.card.MaterialCardView
|
||||||
|
@ -60,26 +79,14 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="bottom"
|
android:gravity="bottom"
|
||||||
app:behavior_hideable="false"
|
app:behavior_hideable="false"
|
||||||
app:cardBackgroundColor="?attr/colorSurface"
|
|
||||||
app:cardCornerRadius="0dp"
|
app:cardCornerRadius="0dp"
|
||||||
app:cardElevation="12dp"
|
app:cardElevation="24dp"
|
||||||
app:layout_behavior="code.name.monkey.retromusic.RetroBottomSheetBehavior"
|
app:layout_behavior="code.name.monkey.retromusic.RetroBottomSheetBehavior">
|
||||||
app:shapeAppearance="@style/ClassicThemeOverLay">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<include
|
|
||||||
android:id="@+id/playerControlsContainer"
|
|
||||||
layout="@layout/fragment_classic_controls"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:background="?attr/colorSurface"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<com.google.android.material.textview.MaterialTextView
|
<com.google.android.material.textview.MaterialTextView
|
||||||
|
@ -100,6 +107,6 @@
|
||||||
android:overScrollMode="never"
|
android:overScrollMode="never"
|
||||||
tools:listitem="@layout/item_list" />
|
tools:listitem="@layout/item_list" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -175,8 +175,8 @@
|
||||||
<style name="ClassicThemeOverLay">
|
<style name="ClassicThemeOverLay">
|
||||||
<item name="cornerFamily">rounded</item>
|
<item name="cornerFamily">rounded</item>
|
||||||
<item name="cornerSize">0dp</item>
|
<item name="cornerSize">0dp</item>
|
||||||
<item name="cornerSizeTopRight">16dp</item>
|
<item name="cornerSizeTopRight">8dp</item>
|
||||||
<item name="cornerSizeTopLeft">16dp</item>
|
<item name="cornerSizeTopLeft">8dp</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="TopCornerCardViewStyle" parent="@style/Widget.MaterialComponents.CardView">
|
<style name="TopCornerCardViewStyle" parent="@style/Widget.MaterialComponents.CardView">
|
||||||
|
|
Loading…
Reference in a new issue