Changed toggle switch to outline
This commit is contained in:
parent
ee59be16c4
commit
9c363a6b28
13 changed files with 22 additions and 84 deletions
|
@ -11,7 +11,6 @@ import androidx.fragment.app.Fragment
|
||||||
import code.name.monkey.appthemehelper.ThemeStore
|
import code.name.monkey.appthemehelper.ThemeStore
|
||||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
|
||||||
import code.name.monkey.retromusic.fragments.MiniPlayerFragment
|
import code.name.monkey.retromusic.fragments.MiniPlayerFragment
|
||||||
import code.name.monkey.retromusic.fragments.NowPlayingScreen
|
import code.name.monkey.retromusic.fragments.NowPlayingScreen
|
||||||
import code.name.monkey.retromusic.fragments.NowPlayingScreen.*
|
import code.name.monkey.retromusic.fragments.NowPlayingScreen.*
|
||||||
|
@ -29,8 +28,8 @@ 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.normal.PlayerFragment
|
||||||
import code.name.monkey.retromusic.fragments.player.plain.PlainPlayerFragment
|
import code.name.monkey.retromusic.fragments.player.plain.PlainPlayerFragment
|
||||||
import code.name.monkey.retromusic.fragments.player.simple.SimplePlayerFragment
|
import code.name.monkey.retromusic.fragments.player.simple.SimplePlayerFragment
|
||||||
import code.name.monkey.retromusic.fragments.player.slide.SlidePlayerFragment
|
|
||||||
import code.name.monkey.retromusic.fragments.player.tiny.TinyPlayerFragment
|
import code.name.monkey.retromusic.fragments.player.tiny.TinyPlayerFragment
|
||||||
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import code.name.monkey.retromusic.views.BottomNavigationBarTinted
|
import code.name.monkey.retromusic.views.BottomNavigationBarTinted
|
||||||
import com.sothree.slidinguppanel.SlidingUpPanelLayout
|
import com.sothree.slidinguppanel.SlidingUpPanelLayout
|
||||||
|
@ -264,7 +263,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), Sliding
|
||||||
super.setLightNavigationBar(true)
|
super.setLightNavigationBar(true)
|
||||||
super.setLightStatusbar(isColorLight)
|
super.setLightStatusbar(isColorLight)
|
||||||
} else if (currentNowPlayingScreen == FULL || currentNowPlayingScreen == CARD ||
|
} else if (currentNowPlayingScreen == FULL || currentNowPlayingScreen == CARD ||
|
||||||
currentNowPlayingScreen == FIT || /*currentNowPlayingScreen == NowPlayingScreen.CLASSIC ||*/
|
currentNowPlayingScreen == FIT || currentNowPlayingScreen == CLASSIC ||
|
||||||
currentNowPlayingScreen == BLUR || currentNowPlayingScreen == BLUR_CARD) {
|
currentNowPlayingScreen == BLUR || currentNowPlayingScreen == BLUR_CARD) {
|
||||||
super.setLightStatusbar(false)
|
super.setLightStatusbar(false)
|
||||||
super.setLightNavigationBar(true)
|
super.setLightNavigationBar(true)
|
||||||
|
|
|
@ -7,39 +7,29 @@ import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.animation.DecelerateInterpolator
|
|
||||||
import android.view.animation.LinearInterpolator
|
import android.view.animation.LinearInterpolator
|
||||||
import android.widget.SeekBar
|
import android.widget.SeekBar
|
||||||
import androidx.annotation.NonNull
|
|
||||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||||
import code.name.monkey.appthemehelper.util.TintHelper
|
import code.name.monkey.appthemehelper.util.TintHelper
|
||||||
|
import code.name.monkey.retromusic.R
|
||||||
|
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
||||||
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
||||||
import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
|
import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
|
||||||
import code.name.monkey.retromusic.service.MusicService
|
import code.name.monkey.retromusic.service.MusicService
|
||||||
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
|
|
||||||
import code.name.monkey.retromusic.util.MusicUtil
|
import code.name.monkey.retromusic.util.MusicUtil
|
||||||
import code.name.monkey.retromusic.views.PlayPauseDrawable
|
|
||||||
import kotlinx.android.synthetic.main.fragment_classic_player_playback_controls.*
|
import kotlinx.android.synthetic.main.fragment_classic_player_playback_controls.*
|
||||||
|
|
||||||
|
|
||||||
class ClassicPlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
class ClassicPlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
public override fun show() {
|
public override fun show() {
|
||||||
playerPlayPauseFab.animate()
|
|
||||||
.scaleX(1f)
|
|
||||||
.scaleY(1f)
|
|
||||||
.setInterpolator(DecelerateInterpolator())
|
|
||||||
.start()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun hide() {
|
public override fun hide() {
|
||||||
if (playerPlayPauseFab != null) {
|
|
||||||
playerPlayPauseFab.scaleX = 0f
|
|
||||||
playerPlayPauseFab.scaleY = 0f
|
|
||||||
playerPlayPauseFab.rotation = 0f
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,7 +46,7 @@ class ClassicPlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(activity, false)
|
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(activity, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
//volumeFragment?.setTintableColor(lastPlaybackControlsColor)
|
volumeFragment?.setTintableColor(ColorUtil.stripAlpha(lastPlaybackControlsColor))
|
||||||
|
|
||||||
updateRepeatState()
|
updateRepeatState()
|
||||||
updateShuffleState()
|
updateShuffleState()
|
||||||
|
@ -64,7 +54,6 @@ class ClassicPlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
updateProgressTextColor()
|
updateProgressTextColor()
|
||||||
}
|
}
|
||||||
|
|
||||||
private var playerFabPlayPauseDrawable: PlayPauseDrawable? = null
|
|
||||||
|
|
||||||
private var lastPlaybackControlsColor = 0
|
private var lastPlaybackControlsColor = 0
|
||||||
private var lastDisabledPlaybackControlsColor = 0
|
private var lastDisabledPlaybackControlsColor = 0
|
||||||
|
@ -72,8 +61,7 @@ class ClassicPlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
private lateinit var progressViewUpdateHelper: MusicProgressViewUpdateHelper
|
private lateinit var progressViewUpdateHelper: MusicProgressViewUpdateHelper
|
||||||
|
|
||||||
|
|
||||||
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||||
override fun onCreateView(@NonNull inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
|
||||||
return inflater.inflate(code.name.monkey.retromusic.R.layout.fragment_classic_player_playback_controls, container, false)
|
return inflater.inflate(code.name.monkey.retromusic.R.layout.fragment_classic_player_playback_controls, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,13 +93,18 @@ class ClassicPlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
playerSongCurrentProgress.setTextColor(color)
|
playerSongCurrentProgress.setTextColor(color)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun updatePlayPauseDrawableState() {
|
||||||
|
if (MusicPlayerRemote.isPlaying) {
|
||||||
|
playerPlayPauseFab.setImageResource(R.drawable.ic_pause_white_24dp)
|
||||||
|
} else {
|
||||||
|
playerPlayPauseFab.setImageResource(R.drawable.ic_play_arrow_white_24dp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun setUpPlayPauseFab() {
|
private fun setUpPlayPauseFab() {
|
||||||
val fabColor = Color.WHITE
|
val fabColor = Color.WHITE
|
||||||
TintHelper.setTintAuto(playerPlayPauseFab, fabColor, true)
|
TintHelper.setTintAuto(playerPlayPauseFab, fabColor, true)
|
||||||
|
|
||||||
playerFabPlayPauseDrawable = PlayPauseDrawable(activity!!)
|
|
||||||
|
|
||||||
playerPlayPauseFab.setImageDrawable(playerFabPlayPauseDrawable) // Note: set the drawable AFTER TintHelper.setTintAuto() was called
|
|
||||||
playerPlayPauseFab.setColorFilter(MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(fabColor)), PorterDuff.Mode.SRC_IN)
|
playerPlayPauseFab.setColorFilter(MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(fabColor)), PorterDuff.Mode.SRC_IN)
|
||||||
playerPlayPauseFab.setOnClickListener(PlayPauseButtonOnClickHandler())
|
playerPlayPauseFab.setOnClickListener(PlayPauseButtonOnClickHandler())
|
||||||
playerPlayPauseFab.post {
|
playerPlayPauseFab.post {
|
||||||
|
@ -204,13 +197,13 @@ class ClassicPlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onServiceConnected() {
|
override fun onServiceConnected() {
|
||||||
updatePlayPauseDrawableState(false)
|
updatePlayPauseDrawableState( )
|
||||||
updateRepeatState()
|
updateRepeatState()
|
||||||
updateShuffleState()
|
updateShuffleState()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPlayStateChanged() {
|
override fun onPlayStateChanged() {
|
||||||
updatePlayPauseDrawableState(true)
|
updatePlayPauseDrawableState( )
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onRepeatModeChanged() {
|
override fun onRepeatModeChanged() {
|
||||||
|
@ -220,13 +213,4 @@ class ClassicPlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
override fun onShuffleModeChanged() {
|
override fun onShuffleModeChanged() {
|
||||||
updateShuffleState()
|
updateShuffleState()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updatePlayPauseDrawableState(animate: Boolean) {
|
|
||||||
if (MusicPlayerRemote.isPlaying) {
|
|
||||||
playerFabPlayPauseDrawable?.setPause(animate)
|
|
||||||
} else {
|
|
||||||
playerFabPlayPauseDrawable?.setPlay(animate)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,39 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2019 Hemanth Savarala.
|
|
||||||
*
|
|
||||||
* Licensed under the GNU General Public License v3
|
|
||||||
*
|
|
||||||
* This is free software: you can redistribute it and/or modify it under
|
|
||||||
* the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
||||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
* See the GNU General Public License for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package code.name.monkey.retromusic.util;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.view.animation.AnimationUtils;
|
|
||||||
import android.view.animation.LayoutAnimationController;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
import code.name.monkey.retromusic.R;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Hemanth S (h4h13).
|
|
||||||
*/
|
|
||||||
public class AnimationUtil {
|
|
||||||
|
|
||||||
public static void runLayoutAnimation(final @NonNull RecyclerView recyclerView) {
|
|
||||||
final Context context = recyclerView.getContext();
|
|
||||||
final LayoutAnimationController controller =
|
|
||||||
AnimationUtils.loadLayoutAnimation(context, R.anim.layout_animation_slide_from_bottom);
|
|
||||||
|
|
||||||
recyclerView.setLayoutAnimation(controller);
|
|
||||||
recyclerView.getAdapter().notifyDataSetChanged();
|
|
||||||
recyclerView.scheduleLayoutAnimation();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:animation="@anim/item_animation_slide_from_bottom"
|
|
||||||
android:animationOrder="normal"
|
|
||||||
android:delay="15%" />
|
|
|
@ -59,6 +59,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
app:fontFamily="@font/circular"
|
||||||
android:paddingTop="8dp"
|
android:paddingTop="8dp"
|
||||||
android:text="@string/history" />
|
android:text="@string/history" />
|
||||||
|
|
||||||
|
|
|
@ -127,8 +127,7 @@
|
||||||
android:id="@+id/playerPlayPauseFab"
|
android:id="@+id/playerPlayPauseFab"
|
||||||
style="@style/Fab"
|
style="@style/Fab"
|
||||||
android:layout_centerInParent="true"
|
android:layout_centerInParent="true"
|
||||||
app:elevation="4dp"
|
app:elevation="4dp" />
|
||||||
app:pressedTranslationZ="2dp" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
<style name="Theme.RetroMusic.DayNight" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
<style name="Theme.RetroMusic.DayNight" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||||
|
|
||||||
|
|
||||||
<item name="md_corner_radius">16dp</item>
|
<item name="md_corner_radius">16dp</item>
|
||||||
<item name="md_font_title">@font/circular</item>
|
<item name="md_font_title">@font/circular</item>
|
||||||
<item name="md_font_body">@font/circular</item>
|
<item name="md_font_body">@font/circular</item>
|
||||||
|
|
|
@ -6,5 +6,5 @@
|
||||||
android:viewportHeight="24">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="@color/md_white_1000"
|
android:fillColor="@color/md_white_1000"
|
||||||
android:pathData="M17,7H7c-2.76,0-5,2.24-5,5s2.24,5,5,5h10c2.76,0,5-2.24,5-5S19.76,7,17,7z M17,15c-1.66,0-3-1.34-3-3s1.34-3,3-3 s3,1.34,3,3S18.66,15,17,15z" />
|
android:pathData="M17 6H7c-3.31 0-6 2.69-6 6s2.69 6 6 6h10c3.31 0 6-2.69 6-6s-2.69-6-6-6zm0 10H7c-2.21 0-4-1.79-4-4s1.79-4 4-4h10c2.21 0 4 1.79 4 4s-1.79 4-4 4zm0-7c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z" />
|
||||||
</vector>
|
</vector>
|
|
@ -7,5 +7,5 @@
|
||||||
|
|
||||||
<path
|
<path
|
||||||
android:fillColor="@color/md_white_1000"
|
android:fillColor="@color/md_white_1000"
|
||||||
android:pathData="M17,7H7c-2.76,0-5,2.24-5,5s2.24,5,5,5h10c2.76,0,5-2.24,5-5S19.76,7,17,7z M7,15c-1.66,0-3-1.34-3-3s1.34-3,3-3 s3,1.34,3,3S8.66,15,7,15z" />
|
android:pathData="M17 6H7c-3.31 0-6 2.69-6 6s2.69 6 6 6h10c3.31 0 6-2.69 6-6s-2.69-6-6-6zm0 10H7c-2.21 0-4-1.79-4-4s1.79-4 4-4h10c2.21 0 4 1.79 4 4s-1.79 4-4 4zM7 9c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z" />
|
||||||
</vector>
|
</vector>
|
Loading…
Reference in a new issue