Changed toggle switch to outline

This commit is contained in:
h4h13 2019-05-19 22:40:21 +05:30
parent ee59be16c4
commit 9c363a6b28
13 changed files with 22 additions and 84 deletions

View file

@ -11,7 +11,6 @@ import androidx.fragment.app.Fragment
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ColorUtil
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.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.plain.PlainPlayerFragment
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.helper.MusicPlayerRemote
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.views.BottomNavigationBarTinted
import com.sothree.slidinguppanel.SlidingUpPanelLayout
@ -264,7 +263,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), Sliding
super.setLightNavigationBar(true)
super.setLightStatusbar(isColorLight)
} else if (currentNowPlayingScreen == FULL || currentNowPlayingScreen == CARD ||
currentNowPlayingScreen == FIT || /*currentNowPlayingScreen == NowPlayingScreen.CLASSIC ||*/
currentNowPlayingScreen == FIT || currentNowPlayingScreen == CLASSIC ||
currentNowPlayingScreen == BLUR || currentNowPlayingScreen == BLUR_CARD) {
super.setLightStatusbar(false)
super.setLightNavigationBar(true)

View file

@ -7,39 +7,29 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.DecelerateInterpolator
import android.view.animation.LinearInterpolator
import android.widget.SeekBar
import androidx.annotation.NonNull
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper
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.MusicProgressViewUpdateHelper
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
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.views.PlayPauseDrawable
import kotlinx.android.synthetic.main.fragment_classic_player_playback_controls.*
class ClassicPlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
public override fun show() {
playerPlayPauseFab.animate()
.scaleX(1f)
.scaleY(1f)
.setInterpolator(DecelerateInterpolator())
.start()
}
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)
}
//volumeFragment?.setTintableColor(lastPlaybackControlsColor)
volumeFragment?.setTintableColor(ColorUtil.stripAlpha(lastPlaybackControlsColor))
updateRepeatState()
updateShuffleState()
@ -64,7 +54,6 @@ class ClassicPlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
updateProgressTextColor()
}
private var playerFabPlayPauseDrawable: PlayPauseDrawable? = null
private var lastPlaybackControlsColor = 0
private var lastDisabledPlaybackControlsColor = 0
@ -72,8 +61,7 @@ class ClassicPlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
private lateinit var progressViewUpdateHelper: MusicProgressViewUpdateHelper
override fun onCreateView(@NonNull inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
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)
}
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() {
val fabColor = Color.WHITE
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.setOnClickListener(PlayPauseButtonOnClickHandler())
playerPlayPauseFab.post {
@ -204,13 +197,13 @@ class ClassicPlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
}
override fun onServiceConnected() {
updatePlayPauseDrawableState(false)
updatePlayPauseDrawableState( )
updateRepeatState()
updateShuffleState()
}
override fun onPlayStateChanged() {
updatePlayPauseDrawableState(true)
updatePlayPauseDrawableState( )
}
override fun onRepeatModeChanged() {
@ -220,13 +213,4 @@ class ClassicPlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
override fun onShuffleModeChanged() {
updateShuffleState()
}
fun updatePlayPauseDrawableState(animate: Boolean) {
if (MusicPlayerRemote.isPlaying) {
playerFabPlayPauseDrawable?.setPause(animate)
} else {
playerFabPlayPauseDrawable?.setPlay(animate)
}
}
}

View file

@ -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();
}
}