Fix lockscreen, playlist icon
This commit is contained in:
parent
4470a66fb2
commit
c9811ca06b
42 changed files with 350 additions and 262 deletions
|
@ -54,7 +54,7 @@ public final class RetroGlideExtension {
|
|||
@GlideOption
|
||||
public static RequestOptions artistOptions(@NonNull RequestOptions requestOptions, @NonNull Artist artist) {
|
||||
return requestOptions
|
||||
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
||||
.diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
|
||||
.error(R.drawable.default_artist_art)
|
||||
.placeholder(R.drawable.default_artist_art)
|
||||
.priority(Priority.LOW)
|
||||
|
|
|
@ -42,7 +42,10 @@ import java.util.concurrent.TimeUnit
|
|||
|
||||
class ArtistImage(val artistName: String, val skipOkHttpCache: Boolean)
|
||||
|
||||
class ArtistImageFetcher(private val context: Context, private val lastFMRestClient: LastFMRestClient, private val okHttp: OkHttpClient, private val model: ArtistImage) : DataFetcher<InputStream> {
|
||||
class ArtistImageFetcher(private val context: Context,
|
||||
private val lastFMRestClient: LastFMRestClient,
|
||||
private val okHttp: OkHttpClient,
|
||||
private val model: ArtistImage) : DataFetcher<InputStream> {
|
||||
@Volatile
|
||||
private var isCancelled: Boolean = false
|
||||
private var call: Call<LastFmArtist>? = null
|
||||
|
@ -54,7 +57,7 @@ class ArtistImageFetcher(private val context: Context, private val lastFMRestCli
|
|||
}
|
||||
|
||||
override fun getDataSource(): DataSource {
|
||||
return DataSource.MEMORY_CACHE
|
||||
return DataSource.LOCAL
|
||||
}
|
||||
|
||||
override fun loadData(priority: Priority, callback: DataFetcher.DataCallback<in InputStream>) {
|
||||
|
|
|
@ -38,7 +38,6 @@ class HomePresenter(private val view: HomeContract.HomeView) : Presenter(), Home
|
|||
private val hashSet: HashSet<Home> = HashSet()
|
||||
|
||||
override fun homeSections() {
|
||||
loadSuggestions()
|
||||
loadRecentArtists()
|
||||
loadRecentAlbums()
|
||||
loadTopArtists()
|
||||
|
@ -55,17 +54,6 @@ class HomePresenter(private val view: HomeContract.HomeView) : Presenter(), Home
|
|||
disposable.dispose()
|
||||
}
|
||||
|
||||
private fun loadSuggestions() {
|
||||
disposable += repository.suggestionSongs
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({
|
||||
if (it.isNotEmpty()) hashSet.add(Home(5, R.string.suggestion_songs, 0, it, SUGGESTIONS, R.drawable.ic_audiotrack_black_24dp))
|
||||
view.showData(ArrayList(hashSet))
|
||||
}, {
|
||||
view.showEmpty()
|
||||
})
|
||||
}
|
||||
|
||||
private fun loadRecentArtists() {
|
||||
disposable += repository.recentArtists
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
|
|
|
@ -276,7 +276,7 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailContrac
|
|||
private fun loadArtistImage() {
|
||||
GlideApp.with(this)
|
||||
.asBitmapPalette()
|
||||
.load(RetroGlideExtension.getArtistModel(artist!!, forceDownload))
|
||||
.load(RetroGlideExtension.getArtistModel(artist, forceDownload))
|
||||
.transition(RetroGlideExtension.getDefaultTransition())
|
||||
.artistOptions(artist)
|
||||
.dontAnimate()
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package code.name.monkey.retromusic.ui.activities
|
||||
|
||||
import android.app.KeyguardManager
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.WindowManager
|
||||
|
@ -14,19 +17,23 @@ import code.name.monkey.retromusic.ui.activities.base.AbsMusicServiceActivity
|
|||
import code.name.monkey.retromusic.ui.fragments.player.lockscreen.LockScreenPlayerControlsFragment
|
||||
import com.r0adkll.slidr.Slidr
|
||||
import com.r0adkll.slidr.model.SlidrConfig
|
||||
import com.r0adkll.slidr.model.SlidrListener
|
||||
import com.r0adkll.slidr.model.SlidrPosition
|
||||
import kotlinx.android.synthetic.main.activity_album.*
|
||||
|
||||
class LockScreenActivity : AbsMusicServiceActivity() {
|
||||
private var mFragment: LockScreenPlayerControlsFragment? = null
|
||||
private var fragment: LockScreenPlayerControlsFragment? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
|
||||
or WindowManager.LayoutParams.FLAG_FULLSCREEN
|
||||
or WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
|
||||
or WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||
setShowWhenLocked(true)
|
||||
setTurnScreenOn(true)
|
||||
} else {
|
||||
this.window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD or
|
||||
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
|
||||
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON)
|
||||
}
|
||||
setDrawUnderStatusBar()
|
||||
setContentView(R.layout.activity_lock_screen_old_style)
|
||||
|
||||
|
@ -37,12 +44,32 @@ class LockScreenActivity : AbsMusicServiceActivity() {
|
|||
setLightNavigationBar(true)
|
||||
|
||||
val config = SlidrConfig.Builder()
|
||||
.listener(object : SlidrListener {
|
||||
override fun onSlideStateChanged(state: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun onSlideChange(percent: Float) {
|
||||
|
||||
}
|
||||
|
||||
override fun onSlideOpened() {
|
||||
|
||||
}
|
||||
|
||||
override fun onSlideClosed() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
val keyguardManager = getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
|
||||
keyguardManager.requestDismissKeyguard(this@LockScreenActivity, null)
|
||||
}
|
||||
}
|
||||
})
|
||||
.position(SlidrPosition.BOTTOM)
|
||||
.build()
|
||||
|
||||
Slidr.attach(this, config)
|
||||
|
||||
mFragment = supportFragmentManager.findFragmentById(R.id.playback_controls_fragment) as LockScreenPlayerControlsFragment?
|
||||
fragment = supportFragmentManager.findFragmentById(R.id.playback_controls_fragment) as LockScreenPlayerControlsFragment?
|
||||
|
||||
findViewById<View>(R.id.slide).apply {
|
||||
translationY = 100f
|
||||
|
@ -77,7 +104,7 @@ class LockScreenActivity : AbsMusicServiceActivity() {
|
|||
.dontAnimate()
|
||||
.into(object : RetroMusicColoredTarget(image) {
|
||||
override fun onColorReady(color: Int) {
|
||||
mFragment!!.setDark(color)
|
||||
fragment!!.setDark(color)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -147,6 +147,9 @@ class SongFileAdapter(private val activity: AppCompatActivity, private var dataS
|
|||
}
|
||||
}
|
||||
}
|
||||
if (imageTextContainer != null) {
|
||||
imageTextContainer?.cardElevation = 0f
|
||||
}
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
|
|
|
@ -16,6 +16,7 @@ import code.name.monkey.appthemehelper.util.TintHelper
|
|||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import code.name.monkey.retromusic.util.ViewUtil
|
||||
import code.name.monkey.retromusic.volume.AudioVolumeObserver
|
||||
import code.name.monkey.retromusic.volume.OnAudioVolumeChangedListener
|
||||
import kotlinx.android.synthetic.main.fragment_volume.*
|
||||
|
@ -103,12 +104,14 @@ class VolumeFragment : Fragment(), SeekBar.OnSeekBarChangeListener, OnAudioVolum
|
|||
val iconColor = Color.WHITE
|
||||
volumeDown.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN)
|
||||
volumeUp.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN)
|
||||
TintHelper.setTintAuto(volumeSeekBar, iconColor, false)
|
||||
|
||||
ViewUtil.setProgressDrawable(volumeSeekBar, iconColor, true)
|
||||
|
||||
}
|
||||
|
||||
fun setTintable(color: Int) {
|
||||
TintHelper.setTintAuto(volumeSeekBar, color, false)
|
||||
|
||||
ViewUtil.setProgressDrawable(volumeSeekBar, color, true)
|
||||
}
|
||||
|
||||
fun removeThumb() {
|
||||
|
@ -127,7 +130,8 @@ class VolumeFragment : Fragment(), SeekBar.OnSeekBarChangeListener, OnAudioVolum
|
|||
fun setTintableColor(color: Int) {
|
||||
volumeDown.setColorFilter(color, PorterDuff.Mode.SRC_IN)
|
||||
volumeUp.setColorFilter(color, PorterDuff.Mode.SRC_IN)
|
||||
TintHelper.setTintAuto(volumeSeekBar, color, false)
|
||||
//TintHelper.setTintAuto(volumeSeekBar, color, false)
|
||||
ViewUtil.setProgressDrawable(volumeSeekBar, color, true)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -4,9 +4,11 @@ import android.os.Bundle
|
|||
import android.view.View
|
||||
import android.view.animation.AccelerateInterpolator
|
||||
import android.view.animation.DecelerateInterpolator
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
||||
import code.name.monkey.retromusic.ui.fragments.VolumeFragment
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import kotlinx.android.synthetic.main.volume_controls.*
|
||||
|
||||
|
||||
/**
|
||||
* Created by hemanths on 24/09/17.
|
||||
|
@ -56,11 +58,19 @@ abstract class AbsPlayerControlsFragment : AbsMusicServiceFragment(), MusicProgr
|
|||
hideVolumeIfAvailable()
|
||||
}
|
||||
|
||||
protected var volumeFragment: VolumeFragment? = null
|
||||
|
||||
private fun hideVolumeIfAvailable() {
|
||||
volumeFragmentContainer?.visibility = if (PreferenceUtil.getInstance().volumeToggle) View.VISIBLE else View.GONE
|
||||
if (PreferenceUtil.getInstance().volumeToggle) {
|
||||
childFragmentManager.beginTransaction().replace(R.id.volumeFragmentContainer, VolumeFragment()).commit()
|
||||
childFragmentManager.executePendingTransactions()
|
||||
|
||||
volumeFragment = childFragmentManager.findFragmentById(R.id.volumeFragmentContainer) as VolumeFragment?
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val SLIDER_ANIMATION_TIME: Long = 400
|
||||
const val VOLUME_FRAGMENT: String = "volume_fragment"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,12 +13,6 @@ import android.view.ViewGroup;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.afollestad.materialcab.MaterialCab;
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Objects;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StringRes;
|
||||
|
@ -27,6 +21,15 @@ import androidx.core.content.ContextCompat;
|
|||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.afollestad.materialcab.MaterialCab;
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Objects;
|
||||
|
||||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
import code.name.monkey.appthemehelper.common.ATHToolbarActivity;
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil;
|
||||
|
@ -64,6 +67,7 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
|
|||
private ImageView userImage;
|
||||
private CompositeDisposable disposable;
|
||||
|
||||
@NonNull
|
||||
public static Fragment newInstance(int tab) {
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(CURRENT_TAB_ID, tab);
|
||||
|
@ -72,6 +76,7 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
|
|||
return fragment;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static Fragment newInstance() {
|
||||
return new LibraryFragment();
|
||||
}
|
||||
|
@ -218,7 +223,7 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
|
|||
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
public void onCreateOptionsMenu(@NotNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
inflater.inflate(R.menu.menu_main, menu);
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ 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.ui.fragments.VolumeFragment
|
||||
import code.name.monkey.retromusic.ui.fragments.base.AbsPlayerControlsFragment
|
||||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
|
@ -31,7 +30,6 @@ class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
private var lastPlaybackControlsColor: Int = 0
|
||||
private var lastDisabledPlaybackControlsColor: Int = 0
|
||||
private var progressViewUpdateHelper: MusicProgressViewUpdateHelper? = null
|
||||
private lateinit var volumeFragment: VolumeFragment
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -47,8 +45,6 @@ class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
super.onViewCreated(view, savedInstanceState)
|
||||
setUpMusicControllers()
|
||||
|
||||
volumeFragment = childFragmentManager.findFragmentById(R.id.volumeFragment) as VolumeFragment
|
||||
|
||||
playPauseButton.setOnClickListener {
|
||||
if (MusicPlayerRemote.isPlaying) {
|
||||
MusicPlayerRemote.pauseSong()
|
||||
|
@ -109,7 +105,7 @@ class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(colorFinal)), false)
|
||||
TintHelper.setTintAuto(playPauseButton, colorFinal, true)
|
||||
ViewUtil.setProgressDrawable(progressSlider, colorFinal, true)
|
||||
volumeFragment.setTintable(colorFinal)
|
||||
volumeFragment?.setTintable(colorFinal)
|
||||
}
|
||||
|
||||
private fun updatePlayPauseColor() {
|
||||
|
|
|
@ -34,7 +34,6 @@ class BlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
private var lastPlaybackControlsColor: Int = 0
|
||||
private var lastDisabledPlaybackControlsColor: Int = 0
|
||||
private var progressViewUpdateHelper: MusicProgressViewUpdateHelper? = null
|
||||
private lateinit var volumeFragment: VolumeFragment
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -51,7 +50,6 @@ class BlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
super.onViewCreated(view, savedInstanceState)
|
||||
setUpMusicControllers()
|
||||
|
||||
|
||||
playPauseButton.setOnClickListener {
|
||||
if (MusicPlayerRemote.isPlaying) {
|
||||
MusicPlayerRemote.pauseSong()
|
||||
|
@ -61,8 +59,6 @@ class BlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
showBonceAnimation()
|
||||
}
|
||||
|
||||
volumeFragment = childFragmentManager.findFragmentById(R.id.volumeFragment) as VolumeFragment
|
||||
volumeFragment.tintWhiteColor()
|
||||
}
|
||||
|
||||
private fun updateSong() {
|
||||
|
@ -119,6 +115,7 @@ class BlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
updateRepeatState()
|
||||
updateShuffleState()
|
||||
updatePrevNextColor()
|
||||
volumeFragment?.tintWhiteColor()
|
||||
}
|
||||
|
||||
private fun setFabColor(i: Int) {
|
||||
|
|
|
@ -31,7 +31,7 @@ class CardPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
private var lastPlaybackControlsColor: Int = 0
|
||||
private var lastDisabledPlaybackControlsColor: Int = 0
|
||||
private var progressViewUpdateHelper: MusicProgressViewUpdateHelper? = null
|
||||
private lateinit var volumeFragment: VolumeFragment
|
||||
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -57,8 +57,6 @@ class CardPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
}
|
||||
showBonceAnimation(playPauseButton)
|
||||
}
|
||||
|
||||
volumeFragment = childFragmentManager.findFragmentById(R.id.volumeFragment) as VolumeFragment
|
||||
}
|
||||
|
||||
private fun setupControls() {
|
||||
|
@ -136,7 +134,7 @@ class CardPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(colorFinal)), false)
|
||||
TintHelper.setTintAuto(playPauseButton, colorFinal, true)
|
||||
|
||||
volumeFragment.setTintable(colorFinal)
|
||||
volumeFragment?.setTintable(colorFinal)
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ class CardBlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
private var lastPlaybackControlsColor: Int = 0
|
||||
private var lastDisabledPlaybackControlsColor: Int = 0
|
||||
private lateinit var progressViewUpdateHelper: MusicProgressViewUpdateHelper
|
||||
private lateinit var volumeFragment: VolumeFragment
|
||||
|
||||
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
@ -49,8 +49,6 @@ class CardBlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
setUpMusicControllers()
|
||||
setupVolumeControls()
|
||||
|
||||
}
|
||||
|
||||
override fun setDark(color: Int) {
|
||||
|
@ -63,6 +61,7 @@ class CardBlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
updateProgressTextColor()
|
||||
|
||||
ViewUtil.setProgressDrawable(progressSlider, Color.WHITE, true)
|
||||
volumeFragment?.tintWhiteColor()
|
||||
}
|
||||
|
||||
|
||||
|
@ -81,10 +80,6 @@ class CardBlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun setupVolumeControls() {
|
||||
volumeFragment = childFragmentManager.findFragmentById(R.id.volumeFragment) as VolumeFragment
|
||||
volumeFragment.tintWhiteColor()
|
||||
}
|
||||
|
||||
private fun updateProgressTextColor() {
|
||||
val color = MaterialValueHelper.getPrimaryTextColor(context, false)
|
||||
|
|
|
@ -59,7 +59,7 @@ class ClassicPlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(getActivity(), false);
|
||||
}
|
||||
|
||||
volumeFragment.setTintableColor(lastPlaybackControlsColor)
|
||||
//volumeFragment?.setTintableColor(lastPlaybackControlsColor)
|
||||
|
||||
updateRepeatState();
|
||||
updateShuffleState();
|
||||
|
@ -74,7 +74,7 @@ class ClassicPlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
|
||||
private lateinit var progressViewUpdateHelper: MusicProgressViewUpdateHelper
|
||||
|
||||
private lateinit var volumeFragment: VolumeFragment
|
||||
|
||||
|
||||
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)
|
||||
|
@ -91,7 +91,7 @@ class ClassicPlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
setUpMusicControllers()
|
||||
updateProgressTextColor()
|
||||
|
||||
volumeFragment = childFragmentManager.findFragmentById(R.id.volumeFragment) as VolumeFragment
|
||||
//volumeFragment = childFragmentManager.findFragmentById(R.id.volumeFragment) as VolumeFragment
|
||||
}
|
||||
|
||||
private fun setUpMusicControllers() {
|
||||
|
|
|
@ -20,7 +20,6 @@ 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.ui.fragments.VolumeFragment
|
||||
import code.name.monkey.retromusic.ui.fragments.base.AbsPlayerControlsFragment
|
||||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import kotlinx.android.synthetic.main.fragment_player_playback_controls.*
|
||||
|
@ -31,7 +30,6 @@ class ColorPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
private var lastPlaybackControlsColor: Int = 0
|
||||
private var lastDisabledPlaybackControlsColor: Int = 0
|
||||
private lateinit var progressViewUpdateHelper: MusicProgressViewUpdateHelper
|
||||
private lateinit var volumeFragment: VolumeFragment
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -55,8 +53,6 @@ class ColorPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
setUpMusicControllers()
|
||||
|
||||
volumeFragment = childFragmentManager.findFragmentById(R.id.volumeFragment) as VolumeFragment
|
||||
}
|
||||
|
||||
private fun updateSong() {
|
||||
|
@ -105,7 +101,7 @@ class ColorPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
|
||||
setProgressBarColor(lastPlaybackControlsColor, lastDisabledPlaybackControlsColor)
|
||||
|
||||
volumeFragment.setTintableColor(lastPlaybackControlsColor)
|
||||
volumeFragment?.setTintableColor(lastPlaybackControlsColor)
|
||||
|
||||
songCurrentProgress.setTextColor(lastDisabledPlaybackControlsColor)
|
||||
songTotalTime.setTextColor(lastDisabledPlaybackControlsColor)
|
||||
|
|
|
@ -34,7 +34,7 @@ class FitPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
private var lastPlaybackControlsColor: Int = 0
|
||||
private var lastDisabledPlaybackControlsColor: Int = 0
|
||||
private lateinit var progressViewUpdateHelper: MusicProgressViewUpdateHelper
|
||||
private lateinit var volumeFragment: VolumeFragment
|
||||
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -51,8 +51,6 @@ class FitPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
super.onViewCreated(view, savedInstanceState)
|
||||
setUpMusicControllers()
|
||||
|
||||
volumeFragment = childFragmentManager.findFragmentById(R.id.volumeFragment) as VolumeFragment
|
||||
|
||||
playPauseButton.setOnClickListener {
|
||||
if (MusicPlayerRemote.isPlaying) {
|
||||
MusicPlayerRemote.pauseSong()
|
||||
|
@ -118,7 +116,8 @@ class FitPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
} else {
|
||||
ThemeStore.accentColor(context!!)
|
||||
}
|
||||
volumeFragment.setTintable(colorFinal)
|
||||
|
||||
volumeFragment?.setTintable(colorFinal)
|
||||
|
||||
setFabColor(colorFinal)
|
||||
updateRepeatState()
|
||||
|
|
|
@ -33,7 +33,7 @@ class FlatPlaybackControlsFragment : AbsPlayerControlsFragment(), Callback {
|
|||
private var lastPlaybackControlsColor: Int = 0
|
||||
private var lastDisabledPlaybackControlsColor: Int = 0
|
||||
private lateinit var progressViewUpdateHelper: MusicProgressViewUpdateHelper
|
||||
private lateinit var volumeFragment: VolumeFragment
|
||||
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -48,8 +48,6 @@ class FlatPlaybackControlsFragment : AbsPlayerControlsFragment(), Callback {
|
|||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
setUpMusicControllers()
|
||||
|
||||
volumeFragment = childFragmentManager.findFragmentById(R.id.volumeFragment) as VolumeFragment
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
|
@ -109,7 +107,7 @@ class FlatPlaybackControlsFragment : AbsPlayerControlsFragment(), Callback {
|
|||
}
|
||||
|
||||
updateTextColors(colorFinal)
|
||||
volumeFragment.setTintable(colorFinal)
|
||||
volumeFragment?.setTintable(colorFinal)
|
||||
|
||||
ViewUtil.setProgressDrawable(progressSlider, colorFinal, true)
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ 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.ui.fragments.VolumeFragment
|
||||
import code.name.monkey.retromusic.ui.fragments.base.AbsPlayerControlsFragment
|
||||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
|
@ -55,14 +54,11 @@ class FullPlaybackControlsFragment : AbsPlayerControlsFragment(), PopupMenu.OnMe
|
|||
return inflater.inflate(R.layout.fragment_full_player_controls, container, false)
|
||||
}
|
||||
|
||||
private lateinit var volumeFragment: VolumeFragment
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
setUpMusicControllers()
|
||||
|
||||
volumeFragment = childFragmentManager.findFragmentById(R.id.volumeFragment) as VolumeFragment
|
||||
|
||||
songTotalTime.setTextColor(Color.WHITE)
|
||||
songCurrentProgress.setTextColor(Color.WHITE)
|
||||
|
||||
|
@ -117,7 +113,7 @@ class FullPlaybackControlsFragment : AbsPlayerControlsFragment(), PopupMenu.OnMe
|
|||
} else {
|
||||
ThemeStore.accentColor(context!!)
|
||||
}
|
||||
volumeFragment.setTintableColor(colorFinal)
|
||||
volumeFragment?.setTintableColor(colorFinal)
|
||||
text.setTextColor(colorFinal)
|
||||
|
||||
ViewUtil.setProgressDrawable(progressSlider, colorFinal, true)
|
||||
|
|
|
@ -9,6 +9,7 @@ import android.view.ViewGroup
|
|||
import android.view.animation.DecelerateInterpolator
|
||||
import android.view.animation.LinearInterpolator
|
||||
import android.widget.SeekBar
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||
|
@ -21,6 +22,8 @@ import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
|
|||
import code.name.monkey.retromusic.service.MusicService
|
||||
import code.name.monkey.retromusic.ui.fragments.base.AbsPlayerControlsFragment
|
||||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import code.name.monkey.retromusic.util.ViewUtil
|
||||
import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.*
|
||||
import kotlinx.android.synthetic.main.media_button.*
|
||||
import kotlinx.android.synthetic.main.player_time.*
|
||||
|
@ -94,7 +97,6 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
|
|||
}
|
||||
|
||||
override fun setDark(color: Int) {
|
||||
setProgressBarColor(progressSlider, color)
|
||||
|
||||
val colorBg = ATHUtil.resolveColor(context!!, android.R.attr.colorBackground)
|
||||
if (ColorUtil.isColorLight(colorBg)) {
|
||||
|
@ -105,6 +107,14 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
|
|||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(context!!, false)
|
||||
}
|
||||
|
||||
val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) {
|
||||
color
|
||||
} else {
|
||||
ThemeStore.textColorSecondary(context!!)
|
||||
}
|
||||
volumeFragment?.setTintable(colorFinal)
|
||||
ViewUtil.setProgressDrawable(progressSlider, ColorUtil.stripAlpha(colorFinal), true)
|
||||
|
||||
updatePrevNextColor()
|
||||
|
||||
val isDark = ColorUtil.isColorLight(color)
|
||||
|
|
|
@ -33,7 +33,7 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
|
|||
private var lastPlaybackControlsColor: Int = 0
|
||||
private var lastDisabledPlaybackControlsColor: Int = 0
|
||||
private lateinit var progressViewUpdateHelper: MusicProgressViewUpdateHelper
|
||||
private lateinit var volumeFragment: VolumeFragment
|
||||
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -48,8 +48,6 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
|
|||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
setUpMusicControllers()
|
||||
|
||||
volumeFragment = childFragmentManager.findFragmentById(R.id.volumeFragment) as VolumeFragment
|
||||
}
|
||||
|
||||
private fun updateSong() {
|
||||
|
@ -114,7 +112,7 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
|
|||
text.setTextColor(colorFinal)
|
||||
ViewUtil.setProgressDrawable(progressSlider, ColorUtil.stripAlpha(colorFinal), true)
|
||||
|
||||
volumeFragment.setTintable(colorFinal)
|
||||
volumeFragment?.setTintable(colorFinal)
|
||||
|
||||
updatePlayPauseColor()
|
||||
updatePrevNextColor()
|
||||
|
|
|
@ -20,7 +20,6 @@ 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.ui.fragments.VolumeFragment
|
||||
import code.name.monkey.retromusic.ui.fragments.base.AbsPlayerControlsFragment
|
||||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
|
@ -33,7 +32,6 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
private var lastPlaybackControlsColor: Int = 0
|
||||
private var lastDisabledPlaybackControlsColor: Int = 0
|
||||
private lateinit var progressViewUpdateHelper: MusicProgressViewUpdateHelper
|
||||
private lateinit var volumeFragment: VolumeFragment
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -50,8 +48,6 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
super.onViewCreated(view, savedInstanceState)
|
||||
setUpMusicControllers()
|
||||
|
||||
volumeFragment = childFragmentManager.findFragmentById(R.id.volumeFragment) as VolumeFragment
|
||||
|
||||
playPauseButton.setOnClickListener {
|
||||
if (MusicPlayerRemote.isPlaying) {
|
||||
MusicPlayerRemote.pauseSong()
|
||||
|
@ -83,8 +79,7 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
TintHelper.setTintAuto(playPauseButton, colorFinal, true)
|
||||
ViewUtil.setProgressDrawable(progressSlider, colorFinal)
|
||||
|
||||
volumeFragment.setTintable(colorFinal)
|
||||
|
||||
volumeFragment?.setTintable(colorFinal)
|
||||
|
||||
updateRepeatState()
|
||||
updateShuffleState()
|
||||
|
|
|
@ -39,7 +39,7 @@ class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
private var lastPlaybackControlsColor: Int = 0
|
||||
private var lastDisabledPlaybackControlsColor: Int = 0
|
||||
private lateinit var progressViewUpdateHelper: MusicProgressViewUpdateHelper
|
||||
private lateinit var volumeFragment: VolumeFragment
|
||||
|
||||
|
||||
override fun onPlayStateChanged() {
|
||||
updatePlayPauseDrawableState()
|
||||
|
@ -84,8 +84,6 @@ class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
super.onViewCreated(view, savedInstanceState)
|
||||
setUpMusicControllers()
|
||||
|
||||
volumeFragment = childFragmentManager.findFragmentById(R.id.volumeFragment) as VolumeFragment
|
||||
|
||||
playPauseButton.setOnClickListener {
|
||||
if (MusicPlayerRemote.isPlaying) {
|
||||
MusicPlayerRemote.pauseSong()
|
||||
|
@ -135,7 +133,7 @@ class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
} else {
|
||||
ThemeStore.accentColor(context!!)
|
||||
}
|
||||
volumeFragment.setTintable(colorFinal)
|
||||
volumeFragment?.setTintable(colorFinal)
|
||||
|
||||
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context!!, ColorUtil.isColorLight(colorFinal)), false)
|
||||
TintHelper.setTintAuto(playPauseButton, colorFinal, true)
|
||||
|
|
|
@ -16,7 +16,6 @@ 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.service.MusicService
|
||||
import code.name.monkey.retromusic.ui.fragments.VolumeFragment
|
||||
import code.name.monkey.retromusic.ui.fragments.base.AbsPlayerControlsFragment
|
||||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
|
@ -32,7 +31,6 @@ class SimplePlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
private var lastPlaybackControlsColor: Int = 0
|
||||
private var lastDisabledPlaybackControlsColor: Int = 0
|
||||
private lateinit var progressViewUpdateHelper: MusicProgressViewUpdateHelper
|
||||
private lateinit var volumeFragment: VolumeFragment
|
||||
|
||||
|
||||
override fun onPlayStateChanged() {
|
||||
|
@ -78,8 +76,6 @@ class SimplePlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
super.onViewCreated(view, savedInstanceState)
|
||||
setUpMusicControllers()
|
||||
|
||||
volumeFragment = childFragmentManager.findFragmentById(R.id.volumeFragment) as VolumeFragment
|
||||
|
||||
playPauseButton.setOnClickListener {
|
||||
if (MusicPlayerRemote.isPlaying) {
|
||||
MusicPlayerRemote.pauseSong()
|
||||
|
@ -198,7 +194,7 @@ class SimplePlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
ThemeStore.accentColor(context!!)
|
||||
}
|
||||
|
||||
volumeFragment.setTintable(colorFinal)
|
||||
volumeFragment?.setTintable(colorFinal)
|
||||
|
||||
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context!!, ColorUtil.isColorLight(colorFinal)), false)
|
||||
TintHelper.setTintAuto(playPauseButton, colorFinal, true)
|
||||
|
|
|
@ -132,7 +132,7 @@ class SlidePlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.C
|
|||
songAdapter.swapDataSet(MusicPlayerRemote.playingQueue)
|
||||
}
|
||||
|
||||
private lateinit var volumeFragment: VolumeFragment
|
||||
|
||||
|
||||
|
||||
private fun updatePlayPauseDrawableState() {
|
||||
|
@ -204,7 +204,6 @@ class SlidePlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.C
|
|||
}
|
||||
|
||||
|
||||
volumeFragment.setTintable(colorFinal)
|
||||
text.setTextColor(colorFinal)
|
||||
playerQueueSubHeader.setTextColor(colorFinal)
|
||||
TintHelper.setTintAuto(playPauseButton, lastPlaybackControlsColor, false)
|
||||
|
@ -230,8 +229,6 @@ class SlidePlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.C
|
|||
setUpShuffleButton()
|
||||
setUpProgressSlider()
|
||||
setUpRecyclerView()
|
||||
volumeFragment = childFragmentManager.findFragmentById(R.id.volumeFragment) as VolumeFragment
|
||||
volumeFragmentToggle.visibility = if (PreferenceUtil.getInstance().volumeToggle) View.VISIBLE else View.GONE
|
||||
}
|
||||
|
||||
private lateinit var songAdapter: SimpleSongAdapter
|
||||
|
|
|
@ -16,25 +16,28 @@ package code.name.monkey.retromusic.views;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Canvas;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public class StatusBarView extends View {
|
||||
|
||||
|
||||
public StatusBarView(Context context) {
|
||||
public StatusBarView(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public StatusBarView(Context context, AttributeSet attrs) {
|
||||
public StatusBarView(@NonNull Context context, @NonNull AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public StatusBarView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
public StatusBarView(@NonNull Context context, @NonNull AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
public static int getStatusBarHeight(Resources r) {
|
||||
public static int getStatusBarHeight(@NonNull Resources r) {
|
||||
int result = 0;
|
||||
int resourceId = r.getIdentifier("status_bar_height", "dimen", "android");
|
||||
if (resourceId > 0) {
|
||||
|
@ -45,7 +48,6 @@ public class StatusBarView extends View {
|
|||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
setMeasuredDimension(
|
||||
MeasureSpec.getSize(widthMeasureSpec), getStatusBarHeight(getResources()));
|
||||
setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), getStatusBarHeight(getResources()));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue