Added classic theme

main
Hemanth S 2020-05-14 20:57:42 +05:30
parent 91475f0aa8
commit aca99f4182
9 changed files with 142 additions and 151 deletions

View File

@ -24,7 +24,7 @@ android {
vectorDrawables.useSupportLibrary = true
applicationId "code.name.monkey.retromusic"
versionCode 429
versionCode 430
versionName '3.5.300'
multiDexEnabled true

View File

@ -29,7 +29,6 @@ import code.name.monkey.retromusic.fragments.player.color.ColorFragment
import code.name.monkey.retromusic.fragments.player.fit.FitFragment
import code.name.monkey.retromusic.fragments.player.flat.FlatPlayerFragment
import code.name.monkey.retromusic.fragments.player.full.FullPlayerFragment
import code.name.monkey.retromusic.fragments.player.home.HomePlayerFragment
import code.name.monkey.retromusic.fragments.player.material.MaterialFragment
import code.name.monkey.retromusic.fragments.player.normal.PlayerFragment
import code.name.monkey.retromusic.fragments.player.peak.PeakPlayerFragment
@ -257,7 +256,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(),
Tiny -> TinyPlayerFragment()
Peak -> PeakPlayerFragment()
Circle -> CirclePlayerFragment()
//Classic -> ClassicPlayerFragment()
Classic -> ClassicPlayerFragment()
else -> PlayerFragment()
} // must implement AbsPlayerFragment
supportFragmentManager.beginTransaction()
@ -325,9 +324,9 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(),
super.setNavigationbarColor(paletteColor)
super.setLightNavigationBar(isColorLight)
super.setLightStatusbar(false)
} /*else if (cps == Classic ) {
} else if (cps == Classic ) {
super.setLightStatusbar(false)
}*/ else if (cps == Fit) {
} else if (cps == Fit) {
super.setLightStatusbar(false)
} else {
super.setLightStatusbar(

View File

@ -94,7 +94,7 @@ class AlbumCoverPagerAdapter(
Card,
Fit,
Tiny,
//Classic,
Classic,
Full -> R.layout.fragment_album_full_cover
else -> {
if (PreferenceUtil.getInstance(requireContext()).carouselEffect()

View File

@ -16,7 +16,7 @@ enum class NowPlayingScreen constructor(
BlurCard(R.string.blur_card, R.drawable.np_blur_card, 9),
Card(R.string.card, R.drawable.np_card, 6),
Circle(R.string.circle, R.drawable.np_minimalistic_circle, 15),
//Classic(R.string.classic, R.drawable.np_classic, 16),
Classic(R.string.classic, R.drawable.np_classic, 16),
Color(R.string.color, R.drawable.np_color, 5),
Fit(R.string.fit, R.drawable.np_fit, 12),
Flat(R.string.flat, R.drawable.np_flat, 1),

View File

@ -51,7 +51,7 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(), ViewPager.OnPageChan
val ratio = metrics.heightPixels.toFloat() / metrics.widthPixels.toFloat()
if (nps == Full || /*nps == Classic ||*/ nps == Fit) {
if (nps == Full || nps == Classic || nps == Fit) {
viewPager.offscreenPageLimit = 2
} else if (PreferenceUtil.getInstance(requireContext()).carouselEffect()) {
viewPager.clipToPadding = false

View File

@ -1,5 +1,6 @@
package code.name.monkey.retromusic.fragments.player.classic
import android.animation.ObjectAnimator
import android.content.res.ColorStateList
import android.graphics.Color
import android.graphics.PorterDuff
@ -7,6 +8,8 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.LinearInterpolator
import android.widget.SeekBar
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import androidx.core.view.ViewCompat
@ -23,14 +26,15 @@ import code.name.monkey.retromusic.adapter.song.PlayingQueueAdapter
import code.name.monkey.retromusic.extensions.hide
import code.name.monkey.retromusic.extensions.show
import code.name.monkey.retromusic.fragments.VolumeFragment
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.service.MusicService
import code.name.monkey.retromusic.util.DensityUtil
import code.name.monkey.retromusic.util.MusicUtil
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.ViewUtil
@ -74,6 +78,7 @@ class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener,
playerQueueSheet.contentPaddingRight,
playerQueueSheet.contentPaddingBottom
)
shapeDrawable.interpolation = 1 - slideOffset
}
@ -123,13 +128,6 @@ class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener,
getQueuePanel().addBottomSheetCallback(bottomSheetCallbackList)
playerQueueSheet.setOnTouchListener { _, _ ->
(requireActivity() as AbsSlidingMusicPanelActivity).getBottomSheetBehavior()
.setAllowDragging(false)
getQueuePanel().setAllowDragging(true)
return@setOnTouchListener false
}
shapeDrawable = MaterialShapeDrawable(
ShapeAppearanceModel.builder(
requireContext(),
@ -140,6 +138,13 @@ class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener,
shapeDrawable.fillColor = ColorStateList.valueOf(ATHUtil.resolveColor(requireContext(), R.attr.colorSurface))
playerQueueSheet.background = shapeDrawable
playerQueueSheet.setOnTouchListener { _, _ ->
(requireActivity() as AbsSlidingMusicPanelActivity).getBottomSheetBehavior()
.setAllowDragging(false)
getQueuePanel().setAllowDragging(true)
return@setOnTouchListener false
}
ToolbarContentTintHelper.colorizeToolbar(
playerToolbar,
Color.WHITE,
@ -264,12 +269,13 @@ class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener,
override fun onColorChanged(color: MediaNotificationProcessor) {
lastColor = color.backgroundColor
callbacks?.onPaletteColorChanged()
lastPlaybackControlsColor = color.primaryTextColor
lastDisabledPlaybackControlsColor = ColorUtil.withAlpha(color.primaryTextColor, 0.3f)
title.setTextColor(color.primaryTextColor)
text.setTextColor(color.secondaryTextColor)
songInfo.setTextColor(color.secondaryTextColor)
playerContainer.setBackgroundColor(color.backgroundColor)
songInfo.setTextColor(color.primaryTextColor)
player_queue_sub_header.setTextColor(color.backgroundColor)
songCurrentProgress.setTextColor(lastPlaybackControlsColor)
songTotalTime.setTextColor(lastPlaybackControlsColor)
@ -277,10 +283,9 @@ class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener,
ViewUtil.setProgressDrawable(progressSlider, color.primaryTextColor, true)
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()
@ -304,13 +309,17 @@ class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener,
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.valueTo = total.toFloat()
progressSlider.value = progress.toFloat()
progressSlider.max = total
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
animator.duration = AbsPlayerControlsFragment.SLIDER_ANIMATION_TIME
animator.interpolator = LinearInterpolator()
animator.start()
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
private fun updateQueuePosition() {
playingQueueAdapter?.setCurrent(MusicPlayerRemote.position)
resetToCurrentPosition()
@ -384,15 +393,17 @@ class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener,
}
fun setUpProgressSlider() {
progressSlider.addOnChangeListener { _, value, fromUser ->
if (fromUser) {
MusicPlayerRemote.seekTo(value.toInt())
onUpdateProgressViews(
MusicPlayerRemote.songProgressMillis,
MusicPlayerRemote.songDurationMillis
)
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 setUpPlayPauseFab() {

View File

@ -11,112 +11,55 @@
tools:ignore="MissingPrefix">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/songCurrentProgress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:minWidth="40dp"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"
app:layout_constraintBottom_toBottomOf="@+id/progressSlider"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/progressSlider"
tools:ignore="RtlHardcoded,RtlSymmetry"
tools:text="00:22" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/progressContainer"
android:layout_width="match_parent"
android:layout_height="@dimen/progress_container_height"
android:background="@color/twenty_percent_black_overlay"
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.slider.Slider
android:id="@+id/progressSlider"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:haloRadius="0dp"
app:labelBehavior="gone"
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
app:layout_constraintTop_toTopOf="parent"
app:thumbRadius="@dimen/slider_thumb_radius"
app:trackHeight="@dimen/slider_track_height"
tools:ignore="RtlHardcoded,UnusedAttribute"
tools:progress="20" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/songTotalTime"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:gravity="end"
android:minWidth="40dp"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"
app:layout_constraintBottom_toBottomOf="@+id/progressSlider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="RtlHardcoded,RtlSymmetry"
tools:text="00:22" />
<LinearLayout
android:id="@+id/titleContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="@+id/text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/progressSlider">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
android:layout_width="match_parent"
android:id="@+id/songCurrentProgress"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:freezesText="true"
android:gravity="center"
android:marqueeRepeatLimit="marquee_forever"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:scrollHorizontally="true"
android:layout_marginEnd="8dp"
android:gravity="center_vertical|left|end"
android:paddingStart="8dp"
android:singleLine="true"
android:textAppearance="@style/TextViewHeadline6"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"
tools:text="@tools:sample/lorem/random" />
</LinearLayout>
android:textColor="?android:attr/textColorSecondary"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="RtlHardcoded,RtlSymmetry"
tools:text="00:22" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:paddingHorizontal="16dp"
android:paddingVertical="8dp"
android:textAppearance="@style/TextViewBody1"
android:textColor="?android:attr/textColorSecondary"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toTopOf="@+id/songInfo"
app:layout_constraintTop_toBottomOf="@+id/titleContainer"
tools:text="@tools:sample/lorem/random" />
<androidx.appcompat.widget.AppCompatSeekBar
android:id="@+id/progressSlider"
style="@style/MusicProgressSlider"
android:layout_width="0dp"
android:layout_height="match_parent"
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
tools:ignore="RtlHardcoded,UnusedAttribute" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/songTotalTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical|right|end"
android:paddingEnd="8dp"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="RtlHardcoded,RtlSymmetry"
tools:text="00:22" />
</androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.textview.MaterialTextView
android:id="@+id/songInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:ellipsize="end"
android:gravity="center"
android:maxLines="2"
android:paddingHorizontal="16dp"
android:paddingBottom="12dp"
android:textColor="?android:attr/textColorSecondary"
android:textSize="12sp"
app:layout_constraintBottom_toTopOf="@+id/playPauseButton"
app:layout_constraintTop_toBottomOf="@+id/text"
tools:text="@tools:sample/lorem/random" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/repeatButton"
@ -153,13 +96,14 @@
android:id="@+id/playPauseButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:background="?attr/roundSelector"
app:layout_constraintBottom_toTopOf="@+id/volumeFragmentContainer"
app:layout_constraintBottom_toTopOf="@+id/songInfo"
app:layout_constraintEnd_toStartOf="@+id/nextButton"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/previousButton"
app:layout_constraintTop_toBottomOf="@+id/songInfo"
app:layout_constraintTop_toBottomOf="@+id/progressContainer"
app:srcCompat="@drawable/ic_pause_white_24dp"
tools:tint="@color/md_black_1000" />
@ -193,6 +137,21 @@
tools:ignore="MissingPrefix"
tools:tint="@color/md_black_1000" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/songInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:ellipsize="end"
android:gravity="center"
android:maxLines="2"
android:paddingHorizontal="16dp"
android:textColor="?android:attr/textColorSecondary"
android:textSize="12sp"
app:layout_constraintBottom_toTopOf="@+id/volumeFragmentContainer"
app:layout_constraintTop_toBottomOf="@+id/playPauseButton"
tools:text="@tools:sample/lorem/random" />
<FrameLayout
android:id="@+id/volumeFragmentContainer"
android:layout_width="match_parent"

View File

@ -55,22 +55,14 @@
</LinearLayout>
<com.google.android.material.card.MaterialCardView
android:id="@+id/playbackControlsFragmentContainer"
<include
android:id="@+id/playerControlsContainer"
layout="@layout/fragment_classic_controls"
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>
app:layout_constraintTop_toBottomOf="@id/playerAlbumCoverFragment" />
</androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.card.MaterialCardView
@ -80,7 +72,7 @@
android:gravity="bottom"
app:behavior_hideable="false"
app:cardCornerRadius="0dp"
app:cardElevation="24dp"
app:cardElevation="12dp"
app:layout_behavior="code.name.monkey.retromusic.RetroBottomSheetBehavior">
<LinearLayout
@ -89,6 +81,38 @@
android:background="?attr/colorSurface"
android:orientation="vertical">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:freezesText="true"
android:marqueeRepeatLimit="marquee_forever"
android:paddingHorizontal="16dp"
android:paddingTop="16dp"
android:scrollHorizontally="true"
android:singleLine="true"
android:textAppearance="@style/TextViewSubtitle1"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"
tools:text="@tools:sample/lorem/random" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:paddingHorizontal="16dp"
android:textAppearance="@style/TextViewBody1"
android:textColor="?android:attr/textColorSecondary"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toTopOf="@+id/songInfo"
app:layout_constraintTop_toBottomOf="@+id/titleContainer"
tools:text="@tools:sample/lorem/random" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/player_queue_sub_header"
android:layout_width="match_parent"

View File

@ -146,10 +146,8 @@
</style>
<style name="ClassicThemeOverLay">
<item name="cornerFamily">rounded</item>
<item name="cornerFamily">cut</item>
<item name="cornerSize">0dp</item>
<item name="cornerSizeTopRight">8dp</item>
<item name="cornerSizeTopLeft">8dp</item>
</style>
<style name="TopCornerCardViewStyle" parent="@style/Widget.MaterialComponents.CardView">