Fix alignment controls
This commit is contained in:
parent
8cc32140d5
commit
1b57adde6b
27 changed files with 925 additions and 299 deletions
|
@ -23,6 +23,7 @@ import code.name.monkey.retromusic.Constants.TRANSLATE
|
|||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.activities.base.AbsBaseActivity
|
||||
import code.name.monkey.retromusic.adapter.ContributorAdapter
|
||||
import code.name.monkey.retromusic.glide.GlideApp
|
||||
import code.name.monkey.retromusic.model.Contributor
|
||||
import code.name.monkey.retromusic.util.NavigationUtil
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
|
@ -110,6 +111,7 @@ class AboutActivity : AbsBaseActivity(), View.OnClickListener {
|
|||
openSource.setOnClickListener(this)
|
||||
pinterestLink.setOnClickListener(this)
|
||||
bugReportLink.setOnClickListener(this)
|
||||
|
||||
}
|
||||
|
||||
override fun onClick(view: View) {
|
||||
|
|
|
@ -27,8 +27,6 @@ import code.name.monkey.retromusic.service.MusicService
|
|||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import kotlinx.android.synthetic.main.fragment_blur_player_playback_controls.*
|
||||
import kotlinx.android.synthetic.main.media_button.*
|
||||
|
||||
|
||||
class BlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||
|
||||
|
@ -124,7 +122,7 @@ class BlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
|
||||
text.setTextColor(colorFinal)
|
||||
TintHelper.setTintAuto(progressSlider, colorFinal, false)
|
||||
volumeFragment?.setTintableColor(colorFinal)
|
||||
volumeFragment?.setTintableColor(Color.WHITE)
|
||||
setFabColor(colorFinal)
|
||||
}
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ class ClassicPlayerFragment : AbsPlayerFragment(), PlayerAlbumCoverFragment.Call
|
|||
})
|
||||
|
||||
// for some reason the xml attribute doesn't get applied here.
|
||||
playingQueueCard.setCardBackgroundColor(ATHUtil.resolveColor(activity, code.name.monkey.retromusic.R.attr.cardBackgroundColor))
|
||||
playingQueueCard.setCardBackgroundColor(ThemeStore.primaryColor(requireContext()))
|
||||
}
|
||||
|
||||
private fun setUpPlayerToolbar() {
|
||||
|
|
|
@ -197,13 +197,13 @@ class ClassicPlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
}
|
||||
|
||||
override fun onServiceConnected() {
|
||||
updatePlayPauseDrawableState( )
|
||||
updatePlayPauseDrawableState()
|
||||
updateRepeatState()
|
||||
updateShuffleState()
|
||||
}
|
||||
|
||||
override fun onPlayStateChanged() {
|
||||
updatePlayPauseDrawableState( )
|
||||
updatePlayPauseDrawableState()
|
||||
}
|
||||
|
||||
override fun onRepeatModeChanged() {
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
package code.name.monkey.retromusic.fragments.player.color
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.Color
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.drawable.LayerDrawable
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
|
@ -23,14 +21,13 @@ import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
|
|||
import code.name.monkey.retromusic.service.MusicService
|
||||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import code.name.monkey.retromusic.util.ViewUtil
|
||||
import kotlinx.android.synthetic.main.fragment_color_player_playback_controls.*
|
||||
import kotlinx.android.synthetic.main.fragment_color_player_playback_controls.progressSlider
|
||||
import kotlinx.android.synthetic.main.fragment_color_player_playback_controls.songCurrentProgress
|
||||
import kotlinx.android.synthetic.main.fragment_color_player_playback_controls.songTotalTime
|
||||
import kotlinx.android.synthetic.main.fragment_color_player_playback_controls.text
|
||||
import kotlinx.android.synthetic.main.fragment_color_player_playback_controls.title
|
||||
import kotlinx.android.synthetic.main.fragment_player_playback_controls.*
|
||||
import kotlinx.android.synthetic.main.media_button.*
|
||||
|
||||
|
||||
class ColorPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||
|
||||
|
@ -106,9 +103,9 @@ class ColorPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
title!!.setTextColor(lastPlaybackControlsColor)
|
||||
text!!.setTextColor(lastDisabledPlaybackControlsColor)
|
||||
|
||||
ViewUtil.setProgressDrawable(progressSlider, lastPlaybackControlsColor)
|
||||
ViewUtil.setProgressDrawable(progressSlider, lastPlaybackControlsColor, true)
|
||||
|
||||
volumeFragment?.setTintableColor(lastPlaybackControlsColor)
|
||||
volumeFragment?.setTintableColor(color)
|
||||
|
||||
songCurrentProgress.setTextColor(lastDisabledPlaybackControlsColor)
|
||||
songTotalTime.setTextColor(lastDisabledPlaybackControlsColor)
|
||||
|
|
|
@ -26,7 +26,6 @@ import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
|
|||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import kotlinx.android.synthetic.main.fragment_player_playback_controls.*
|
||||
import kotlinx.android.synthetic.main.media_button.*
|
||||
|
||||
class FitPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ 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.*
|
||||
|
||||
|
||||
/**
|
||||
* @author Hemanth S (h4h13).
|
||||
|
@ -70,7 +70,6 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
|
|||
|
||||
private fun updateSong() {
|
||||
val song = MusicPlayerRemote.currentSong
|
||||
|
||||
title.text = song.title
|
||||
text.text = String.format("%s - %s", song.artistName, song.albumName)
|
||||
|
||||
|
@ -112,29 +111,31 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
|
|||
|
||||
override fun setDark(color: Int) {
|
||||
|
||||
val colorBg = ATHUtil.resolveColor(context!!, android.R.attr.colorBackground)
|
||||
val colorBg = ATHUtil.resolveColor(requireContext(), android.R.attr.colorBackground)
|
||||
if (ColorUtil.isColorLight(colorBg)) {
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(context!!, true)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(context!!, true)
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(requireContext(), true)
|
||||
} else {
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(context!!, false)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(context!!, false)
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(requireContext(), false)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(requireContext(), false)
|
||||
}
|
||||
|
||||
val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) {
|
||||
color
|
||||
} else {
|
||||
ThemeStore.textColorSecondary(context!!)
|
||||
}
|
||||
ThemeStore.textColorSecondary(requireContext())
|
||||
}.ripAlpha()
|
||||
|
||||
volumeFragment?.setTintable(colorFinal)
|
||||
ViewUtil.setProgressDrawable(progressSlider, colorFinal.ripAlpha(), true)
|
||||
ViewUtil.setProgressDrawable(progressSlider, colorFinal, true)
|
||||
|
||||
updatePrevNextColor()
|
||||
|
||||
val isDark = ColorUtil.isColorLight(color)
|
||||
text!!.setTextColor(color)
|
||||
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context!!, isDark), false)
|
||||
TintHelper.setTintAuto(playPauseButton, color, true)
|
||||
val isDark = ColorUtil.isColorLight(colorFinal)
|
||||
text.setTextColor(colorFinal)
|
||||
|
||||
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(requireContext(), isDark), false)
|
||||
TintHelper.setTintAuto(playPauseButton, colorFinal, true)
|
||||
}
|
||||
|
||||
private fun setUpPlayPauseFab() {
|
||||
|
|
|
@ -26,7 +26,7 @@ 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_player_playback_controls.*
|
||||
import kotlinx.android.synthetic.main.media_button.*
|
||||
|
||||
|
||||
class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package code.name.monkey.retromusic.fragments.player.plain
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.PorterDuff
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
|
@ -18,21 +17,16 @@ 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.extensions.ripAlpha
|
||||
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.util.PreferenceUtil
|
||||
import code.name.monkey.retromusic.util.ViewUtil
|
||||
import kotlinx.android.synthetic.main.fragment_flat_player_playback_controls.*
|
||||
import kotlinx.android.synthetic.main.fragment_plain_controls_fragment.*
|
||||
import kotlinx.android.synthetic.main.fragment_plain_controls_fragment.progressSlider
|
||||
import kotlinx.android.synthetic.main.fragment_plain_controls_fragment.songCurrentProgress
|
||||
import kotlinx.android.synthetic.main.fragment_plain_controls_fragment.songTotalTime
|
||||
import kotlinx.android.synthetic.main.media_button.*
|
||||
import kotlinx.android.synthetic.main.media_button.playPauseButton
|
||||
import kotlinx.android.synthetic.main.media_button.repeatButton
|
||||
import kotlinx.android.synthetic.main.media_button.shuffleButton
|
||||
|
|
|
@ -20,7 +20,6 @@ import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
|
|||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import kotlinx.android.synthetic.main.fragment_simple_controls_fragment.*
|
||||
import kotlinx.android.synthetic.main.media_button.*
|
||||
|
||||
/**
|
||||
* @author Hemanth S (h4h13).
|
||||
|
|
|
@ -46,7 +46,7 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
|
|||
val categoryColor: ATEPreferenceCategory? = findPreference("category_color")
|
||||
val primaryColorPref = ATEColorPreference(preferenceScreen.context)
|
||||
|
||||
val primaryColor = ThemeStore.primaryColor(activity!!)
|
||||
val primaryColor = ThemeStore.primaryColor(requireContext())
|
||||
|
||||
primaryColorPref.apply {
|
||||
key = "primary_color"
|
||||
|
@ -57,7 +57,7 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
|
|||
setIcon(R.drawable.ic_colorize_white_24dp)
|
||||
setColor(primaryColor, ColorUtil.darkenColor(primaryColor))
|
||||
setOnPreferenceClickListener {
|
||||
MaterialDialog(activity!!, BottomSheet()).show {
|
||||
MaterialDialog(requireContext(), BottomSheet()).show {
|
||||
title(R.string.primary_color)
|
||||
positiveButton(R.string.set)
|
||||
colorChooser(initialSelection = BLUE,
|
||||
|
@ -74,7 +74,7 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
|
|||
|
||||
if (VersionUtils.hasNougatMR())
|
||||
DynamicShortcutManager(context).updateDynamicShortcuts()
|
||||
activity!!.recreate()
|
||||
requireActivity().recreate()
|
||||
}
|
||||
}
|
||||
true
|
||||
|
@ -96,19 +96,19 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
|
|||
setSummary(generalTheme, newValue)
|
||||
|
||||
when (theme) {
|
||||
"light" -> ThemeStore.editTheme(context!!).primaryColor(Color.WHITE).commit()
|
||||
"black" -> ThemeStore.editTheme(context!!).primaryColor(Color.BLACK).commit()
|
||||
"dark" -> ThemeStore.editTheme(context!!).primaryColor(ContextCompat.getColor(context!!, R.color.md_grey_900)).commit()
|
||||
"color" -> ThemeStore.editTheme(context!!).primaryColor(ContextCompat.getColor(context!!, R.color.md_blue_grey_800)).commit()
|
||||
"light" -> ThemeStore.editTheme(requireContext()).primaryColor(Color.WHITE).commit()
|
||||
"black" -> ThemeStore.editTheme(requireContext()).primaryColor(Color.BLACK).commit()
|
||||
"dark" -> ThemeStore.editTheme(requireContext()).primaryColor(ContextCompat.getColor(requireContext(), R.color.md_grey_900)).commit()
|
||||
"color" -> ThemeStore.editTheme(requireContext()).primaryColor(ContextCompat.getColor(requireContext(), R.color.md_blue_grey_800)).commit()
|
||||
}
|
||||
|
||||
ThemeStore.editTheme(activity!!)
|
||||
ThemeStore.editTheme(requireContext())
|
||||
.activityTheme(PreferenceUtil.getThemeResFromPrefValue(theme))
|
||||
.commit()
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
|
||||
activity?.setTheme(PreferenceUtil.getThemeResFromPrefValue(theme))
|
||||
DynamicShortcutManager(activity!!).updateDynamicShortcuts()
|
||||
DynamicShortcutManager(requireContext()).updateDynamicShortcuts()
|
||||
}
|
||||
activity?.recreate()
|
||||
true
|
||||
|
@ -116,11 +116,11 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
|
|||
}
|
||||
|
||||
val accentColorPref: ATEColorPreference = findPreference("accent_color")!!
|
||||
val accentColor = ThemeStore.accentColor(activity!!)
|
||||
val accentColor = ThemeStore.accentColor(requireContext())
|
||||
accentColorPref.setColor(accentColor, ColorUtil.darkenColor(accentColor))
|
||||
|
||||
accentColorPref.setOnPreferenceClickListener {
|
||||
MaterialDialog(activity!!, BottomSheet()).show {
|
||||
MaterialDialog(requireContext(), BottomSheet()).show {
|
||||
title(R.string.accent_color)
|
||||
positiveButton(R.string.set)
|
||||
colorChooser(colors = ACCENT_COLORS, allowCustomArgb = true, subColors = ACCENT_COLORS_SUB) { _, color ->
|
||||
|
@ -131,7 +131,7 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
|
|||
ThemeStore.editTheme(context).accentColor(color).commit()
|
||||
if (VersionUtils.hasNougatMR())
|
||||
DynamicShortcutManager(context).updateDynamicShortcuts()
|
||||
activity!!.recreate()
|
||||
requireActivity().recreate()
|
||||
}
|
||||
}
|
||||
return@setOnPreferenceClickListener true
|
||||
|
@ -145,7 +145,7 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
|
|||
colorAppShortcuts.setOnPreferenceChangeListener { _, newValue ->
|
||||
// Save preference
|
||||
PreferenceUtil.getInstance().setColoredAppShortcuts(newValue as Boolean)
|
||||
DynamicShortcutManager(activity!!).updateDynamicShortcuts()
|
||||
DynamicShortcutManager(requireContext()).updateDynamicShortcuts()
|
||||
true
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue