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.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.appthemehelper.util.*
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||
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.RetroBottomSheetBehavior
|
||||
import code.name.monkey.retromusic.activities.base.AbsSlidingMusicPanelActivity
|
||||
import code.name.monkey.retromusic.adapter.song.PlayingQueueAdapter
|
||||
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.fragments.VolumeFragment
|
||||
import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
|
||||
|
@ -136,8 +137,7 @@ class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener,
|
|||
0
|
||||
).build()
|
||||
)
|
||||
shapeDrawable.fillColor =
|
||||
ColorStateList.valueOf(ATHUtil.resolveColor(requireContext(), R.attr.colorSurface))
|
||||
shapeDrawable.fillColor = ColorStateList.valueOf(ATHUtil.resolveColor(requireContext(), R.attr.colorSurface))
|
||||
playerQueueSheet.background = shapeDrawable
|
||||
|
||||
ToolbarContentTintHelper.colorizeToolbar(
|
||||
|
@ -263,45 +263,32 @@ class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener,
|
|||
|
||||
override fun onColorChanged(color: MediaNotificationProcessor) {
|
||||
lastColor = color.backgroundColor
|
||||
if (ATHUtil.isWindowBackgroundDark(requireContext())) {
|
||||
lastPlaybackControlsColor =
|
||||
MaterialValueHelper.getPrimaryTextColor(requireContext(), false)
|
||||
lastDisabledPlaybackControlsColor =
|
||||
MaterialValueHelper.getPrimaryDisabledTextColor(requireContext(), false)
|
||||
} else {
|
||||
lastPlaybackControlsColor =
|
||||
MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
|
||||
lastDisabledPlaybackControlsColor =
|
||||
MaterialValueHelper.getSecondaryDisabledTextColor(requireContext(), true)
|
||||
}
|
||||
lastPlaybackControlsColor = color.primaryTextColor
|
||||
lastDisabledPlaybackControlsColor = ColorUtil.withAlpha(color.primaryTextColor, 0.3f)
|
||||
|
||||
title.setTextColor(color.primaryTextColor)
|
||||
text.setTextColor(color.secondaryTextColor)
|
||||
songInfo.setTextColor(color.secondaryTextColor)
|
||||
|
||||
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
|
||||
color.primaryTextColor
|
||||
} else {
|
||||
ThemeStore.accentColor(requireContext())
|
||||
}.ripAlpha()
|
||||
songCurrentProgress.setTextColor(lastPlaybackControlsColor)
|
||||
songTotalTime.setTextColor(lastPlaybackControlsColor)
|
||||
|
||||
TintHelper.setTintAuto(
|
||||
playPauseButton,
|
||||
MaterialValueHelper.getPrimaryTextColor(
|
||||
requireContext(),
|
||||
ColorUtil.isColorLight(colorFinal)
|
||||
),
|
||||
false
|
||||
)
|
||||
TintHelper.setTintAuto(playPauseButton, colorFinal, true)
|
||||
ViewUtil.setProgressDrawable(progressSlider, color.primaryTextColor, true)
|
||||
volumeFragment?.setTintableColor(color.primaryTextColor)
|
||||
|
||||
ViewUtil.setProgressDrawable(progressSlider, colorFinal, true)
|
||||
volumeFragment?.setTintable(colorFinal)
|
||||
player_queue_sub_header.setTextColor(color.secondaryTextColor)
|
||||
|
||||
TintHelper.setTintAuto(playPauseButton, color.primaryTextColor, true)
|
||||
TintHelper.setTintAuto(playPauseButton, color.backgroundColor, false)
|
||||
updateRepeatState()
|
||||
updateShuffleState()
|
||||
updatePrevNextColor()
|
||||
|
||||
ToolbarContentTintHelper.colorizeToolbar(
|
||||
playerToolbar,
|
||||
Color.WHITE,
|
||||
requireActivity()
|
||||
)
|
||||
updateRepeatState()
|
||||
updateShuffleState()
|
||||
updatePrevNextColor()
|
||||
}
|
||||
|
||||
override fun toggleFavorite(song: Song) {
|
||||
|
@ -349,7 +336,7 @@ class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener,
|
|||
}
|
||||
val height = playerContainer.height
|
||||
val width = playerContainer.width
|
||||
val finalHeight = height - (playerControlsContainer.height + width)
|
||||
val finalHeight = height - width
|
||||
val panel = getQueuePanel()
|
||||
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() {
|
||||
playPauseButton.apply {
|
||||
|
@ -274,7 +262,19 @@ class FitPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
}.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) {
|
||||
progressSlider.max = total
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="8dp"
|
||||
tools:ignore="MissingPrefix">
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/colorSurface">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/playerContainer"
|
||||
|
@ -52,6 +53,24 @@
|
|||
android:navigationIcon="@drawable/ic_keyboard_arrow_down_black_24dp"
|
||||
app:navigationIcon="@drawable/ic_keyboard_arrow_down_black_24dp" />
|
||||
</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>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
|
@ -60,46 +79,34 @@
|
|||
android:layout_height="match_parent"
|
||||
android:gravity="bottom"
|
||||
app:behavior_hideable="false"
|
||||
app:cardBackgroundColor="?attr/colorSurface"
|
||||
app:cardCornerRadius="0dp"
|
||||
app:cardElevation="12dp"
|
||||
app:layout_behavior="code.name.monkey.retromusic.RetroBottomSheetBehavior"
|
||||
app:shapeAppearance="@style/ClassicThemeOverLay">
|
||||
app:cardElevation="24dp"
|
||||
app:layout_behavior="code.name.monkey.retromusic.RetroBottomSheetBehavior">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/colorSurface"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include
|
||||
android:id="@+id/playerControlsContainer"
|
||||
layout="@layout/fragment_classic_controls"
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/player_queue_sub_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="?attr/listPreferredItemHeightSmall"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:text="@string/up_next"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
|
||||
android:textColor="?android:attr/textColorSecondary" />
|
||||
|
||||
<LinearLayout
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/player_queue_sub_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/listPreferredItemHeightSmall"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:text="@string/up_next"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
|
||||
android:textColor="?android:attr/textColorSecondary" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:overScrollMode="never"
|
||||
tools:listitem="@layout/item_list" />
|
||||
</LinearLayout>
|
||||
android:overScrollMode="never"
|
||||
tools:listitem="@layout/item_list" />
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -175,8 +175,8 @@
|
|||
<style name="ClassicThemeOverLay">
|
||||
<item name="cornerFamily">rounded</item>
|
||||
<item name="cornerSize">0dp</item>
|
||||
<item name="cornerSizeTopRight">16dp</item>
|
||||
<item name="cornerSizeTopLeft">16dp</item>
|
||||
<item name="cornerSizeTopRight">8dp</item>
|
||||
<item name="cornerSizeTopLeft">8dp</item>
|
||||
</style>
|
||||
|
||||
<style name="TopCornerCardViewStyle" parent="@style/Widget.MaterialComponents.CardView">
|
||||
|
|
Loading…
Reference in a new issue