Added color pickers
This commit is contained in:
parent
b42303f33a
commit
5ae53c2dc1
19 changed files with 70 additions and 72 deletions
|
@ -27,6 +27,7 @@ import code.name.monkey.retromusic.dialogs.AddToPlaylistDialog
|
|||
import code.name.monkey.retromusic.dialogs.DeleteSongsDialog
|
||||
import code.name.monkey.retromusic.extensions.ripAlpha
|
||||
import code.name.monkey.retromusic.extensions.show
|
||||
import code.name.monkey.retromusic.extensions.surfaceColor
|
||||
import code.name.monkey.retromusic.glide.AlbumGlideRequest
|
||||
import code.name.monkey.retromusic.glide.ArtistGlideRequest
|
||||
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
|
||||
|
@ -276,8 +277,8 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C
|
|||
MaterialUtil.setTint(button = shuffleAction, color = buttonColor)
|
||||
MaterialUtil.setTint(button = playAction, color = buttonColor)
|
||||
|
||||
val toolbarColor = ATHUtil.resolveColor(this, R.attr.colorSurface)
|
||||
toolbar.setBackgroundColor(toolbarColor)
|
||||
|
||||
toolbar.setBackgroundColor(surfaceColor())
|
||||
setSupportActionBar(toolbar)
|
||||
supportActionBar?.title = null
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import code.name.monkey.retromusic.adapter.song.SimpleSongAdapter
|
|||
import code.name.monkey.retromusic.dialogs.AddToPlaylistDialog
|
||||
import code.name.monkey.retromusic.extensions.ripAlpha
|
||||
import code.name.monkey.retromusic.extensions.show
|
||||
import code.name.monkey.retromusic.extensions.surfaceColor
|
||||
import code.name.monkey.retromusic.glide.ArtistGlideRequest
|
||||
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
|
@ -262,8 +263,8 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView,
|
|||
MaterialUtil.setTint(button = shuffleAction, color = buttonColor)
|
||||
MaterialUtil.setTint(button = playAction, color = buttonColor)
|
||||
|
||||
val toolbarColor = ATHUtil.resolveColor(this, R.attr.colorSurface)
|
||||
toolbar.setBackgroundColor(toolbarColor)
|
||||
|
||||
toolbar.setBackgroundColor(surfaceColor())
|
||||
setSupportActionBar(toolbar)
|
||||
supportActionBar?.title = null
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@ import code.name.monkey.retromusic.App
|
|||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity
|
||||
import code.name.monkey.retromusic.activities.tageditor.WriteTagsAsyncTask
|
||||
import code.name.monkey.retromusic.extensions.surfaceColor
|
||||
import code.name.monkey.retromusic.extensions.textColorSecondary
|
||||
import code.name.monkey.retromusic.fragments.base.AbsMusicServiceFragment
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
||||
|
@ -33,9 +35,7 @@ import code.name.monkey.retromusic.util.LyricUtil
|
|||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import code.name.monkey.retromusic.util.RetroUtil
|
||||
import com.afollestad.materialdialogs.LayoutMode
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
|
||||
import com.afollestad.materialdialogs.input.getInputLayout
|
||||
import com.afollestad.materialdialogs.input.input
|
||||
import kotlinx.android.synthetic.main.activity_lyrics.*
|
||||
|
@ -111,9 +111,9 @@ class LyricsActivity : AbsMusicServiceActivity(), View.OnClickListener,
|
|||
addOnPageChangeListener(this@LyricsActivity)
|
||||
}
|
||||
|
||||
val toolbarColor = ATHUtil.resolveColor(this, R.attr.colorSurface)
|
||||
toolbar.setBackgroundColor(toolbarColor)
|
||||
tabs.setBackgroundColor(toolbarColor)
|
||||
|
||||
toolbar.setBackgroundColor(surfaceColor())
|
||||
tabs.setBackgroundColor(surfaceColor())
|
||||
ToolbarContentTintHelper.colorBackButton(toolbar)
|
||||
setSupportActionBar(toolbar)
|
||||
tabs.setupWithViewPager(viewPager)
|
||||
|
@ -126,7 +126,7 @@ class LyricsActivity : AbsMusicServiceActivity(), View.OnClickListener,
|
|||
)
|
||||
)
|
||||
tabs.setTabTextColors(
|
||||
ATHUtil.resolveColor(this, android.R.attr.textColorSecondary),
|
||||
textColorSecondary(),
|
||||
ThemeStore.accentColor(this)
|
||||
)
|
||||
tabs.setSelectedTabIndicatorColor(ThemeStore.accentColor(this))
|
||||
|
|
|
@ -5,13 +5,13 @@ import android.os.Bundle
|
|||
import android.view.MenuItem
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
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
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity
|
||||
import code.name.monkey.retromusic.adapter.song.PlayingQueueAdapter
|
||||
import code.name.monkey.retromusic.extensions.accentColor
|
||||
import code.name.monkey.retromusic.extensions.surfaceColor
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import com.h6ah4i.android.widget.advrecyclerview.animator.DraggableItemAnimator
|
||||
|
@ -174,13 +174,11 @@ open class PlayingQueueActivity : AbsMusicServiceActivity() {
|
|||
|
||||
private fun setupToolbar() {
|
||||
toolbar.subtitle = getUpNextAndQueueTime()
|
||||
|
||||
toolbar.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorSurface))
|
||||
toolbar.setBackgroundColor(surfaceColor())
|
||||
setSupportActionBar(toolbar)
|
||||
val accentColor = ThemeStore.accentColor(this)
|
||||
clearQueue.backgroundTintList = ColorStateList.valueOf(accentColor)
|
||||
clearQueue.backgroundTintList = ColorStateList.valueOf(accentColor())
|
||||
ColorStateList.valueOf(
|
||||
MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(accentColor))
|
||||
MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(accentColor()))
|
||||
).apply {
|
||||
clearQueue.setTextColor(this)
|
||||
clearQueue.iconTint = this
|
||||
|
|
|
@ -13,6 +13,7 @@ import code.name.monkey.retromusic.activities.base.AbsSlidingMusicPanelActivity
|
|||
import code.name.monkey.retromusic.adapter.song.OrderablePlaylistSongAdapter
|
||||
import code.name.monkey.retromusic.adapter.song.PlaylistSongAdapter
|
||||
import code.name.monkey.retromusic.adapter.song.SongAdapter
|
||||
import code.name.monkey.retromusic.extensions.applyToolbar
|
||||
import code.name.monkey.retromusic.helper.menu.PlaylistMenuHelper
|
||||
import code.name.monkey.retromusic.interfaces.CabHolder
|
||||
import code.name.monkey.retromusic.loaders.PlaylistLoader
|
||||
|
@ -117,8 +118,7 @@ class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, Playli
|
|||
}
|
||||
|
||||
private fun setUpToolBar() {
|
||||
toolbar.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorSurface))
|
||||
setSupportActionBar(toolbar)
|
||||
applyToolbar(toolbar)
|
||||
title = playlist.name
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import code.name.monkey.appthemehelper.util.ATHUtil
|
|||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.activities.base.AbsBaseActivity
|
||||
import code.name.monkey.retromusic.extensions.applyToolbar
|
||||
import code.name.monkey.retromusic.fragments.settings.MainSettingsFragment
|
||||
import kotlinx.android.synthetic.main.activity_settings.*
|
||||
|
||||
|
@ -33,12 +34,7 @@ class SettingsActivity : AbsBaseActivity() {
|
|||
|
||||
private fun setupToolbar() {
|
||||
setTitle(R.string.action_settings)
|
||||
toolbar.apply {
|
||||
setBackgroundColor(ATHUtil.resolveColor(this@SettingsActivity, R.attr.colorSurface))
|
||||
setNavigationOnClickListener { onBackPressed() }
|
||||
ToolbarContentTintHelper.colorBackButton(toolbar)
|
||||
}
|
||||
setSupportActionBar(toolbar)
|
||||
applyToolbar(toolbar)
|
||||
}
|
||||
|
||||
fun setupFragment(fragment: Fragment, @StringRes titleName: Int) {
|
||||
|
|
|
@ -212,9 +212,9 @@ class SkuDetailsAdapter(
|
|||
val titleTextColor = if (purchased) ATHUtil.resolveColor(
|
||||
donationsDialog,
|
||||
android.R.attr.textColorHint
|
||||
) else textColorPrimary(donationsDialog)
|
||||
) else donationsDialog.textColorPrimary()
|
||||
val contentTextColor =
|
||||
if (purchased) titleTextColor else textColorSecondary(donationsDialog)
|
||||
if (purchased) titleTextColor else donationsDialog.textColorSecondary()
|
||||
|
||||
viewHolder.title.setTextColor(titleTextColor)
|
||||
viewHolder.text.setTextColor(contentTextColor)
|
||||
|
|
|
@ -14,7 +14,6 @@ import android.text.TextUtils
|
|||
import android.view.MenuItem
|
||||
import android.widget.Toast
|
||||
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.MaterialUtil
|
||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||
|
@ -23,12 +22,11 @@ import code.name.monkey.retromusic.Constants.USER_BANNER
|
|||
import code.name.monkey.retromusic.Constants.USER_PROFILE
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.activities.base.AbsBaseActivity
|
||||
import code.name.monkey.retromusic.extensions.applyToolbar
|
||||
import code.name.monkey.retromusic.util.Compressor
|
||||
import code.name.monkey.retromusic.util.ImageUtil.getResizedBitmap
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import com.afollestad.materialdialogs.LayoutMode
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
|
||||
import com.afollestad.materialdialogs.list.listItems
|
||||
import kotlinx.android.synthetic.main.activity_user_info.*
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
|
@ -49,9 +47,7 @@ class UserInfoActivity : AbsBaseActivity() {
|
|||
setTaskDescriptionColorAuto()
|
||||
setLightNavigationBar(true)
|
||||
|
||||
toolbar.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorSurface))
|
||||
setSupportActionBar(toolbar)
|
||||
|
||||
applyToolbar(toolbar)
|
||||
MaterialUtil.setTint(nameContainer, false)
|
||||
name.setText(PreferenceUtil.getInstance(this).userName)
|
||||
|
||||
|
@ -91,7 +87,8 @@ class UserInfoActivity : AbsBaseActivity() {
|
|||
{ _, position, _ ->
|
||||
when (position) {
|
||||
0 -> selectBannerImage()
|
||||
1 -> PreferenceUtil.getInstance(this@UserInfoActivity).setBannerImagePath("")
|
||||
1 -> PreferenceUtil.getInstance(this@UserInfoActivity)
|
||||
.setBannerImagePath("")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,9 +11,6 @@ import android.webkit.WebView;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.widget.NestedScrollView;
|
||||
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
|
@ -58,14 +55,9 @@ public class WhatsNewActivity extends AbsBaseActivity {
|
|||
|
||||
WebView webView = findViewById(R.id.webView);
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
AppBarLayout appBarLayout = findViewById(R.id.appBarLayout);
|
||||
|
||||
toolbar.setBackgroundColor(ATHUtil.INSTANCE.resolveColor(this, R.attr.colorSurface));
|
||||
//setSupportActionBar(toolbar);
|
||||
|
||||
toolbar.setNavigationOnClickListener(v -> onBackPressed());
|
||||
ToolbarContentTintHelper.colorBackButton(toolbar);
|
||||
NestedScrollView nestedScrollView = findViewById(R.id.container);
|
||||
|
||||
try {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
|
|
|
@ -14,10 +14,13 @@
|
|||
|
||||
package code.name.monkey.retromusic.extensions
|
||||
|
||||
import android.app.Dialog
|
||||
import android.content.Context
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.Color
|
||||
import androidx.annotation.AttrRes
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import androidx.fragment.app.Fragment
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||
|
@ -27,28 +30,38 @@ fun Int.ripAlpha(): Int {
|
|||
return ColorUtil.stripAlpha(this)
|
||||
}
|
||||
|
||||
fun Context.accentColor(): Int {
|
||||
return ThemeStore.accentColor(this)
|
||||
}
|
||||
|
||||
fun Context.surfaceColor(): Int {
|
||||
return ATHUtil.resolveColor(this, R.attr.colorSurface, Color.WHITE)
|
||||
}
|
||||
|
||||
fun Dialog.colorControlNormal() = resolveColor(android.R.attr.colorControlNormal)
|
||||
fun Toolbar.backgroundTintList() {
|
||||
val surfaceColor = ATHUtil.resolveColor(context, R.attr.colorSurface, Color.BLACK)
|
||||
val colorStateList = ColorStateList.valueOf(surfaceColor)
|
||||
backgroundTintList = colorStateList
|
||||
}
|
||||
|
||||
fun Context.textColorSecondary(): Int {
|
||||
return ATHUtil.resolveColor(this, android.R.attr.textColorSecondary)
|
||||
}
|
||||
fun Context.accentColor() = ThemeStore.accentColor(this)
|
||||
|
||||
fun Context.colorControlNormal(): Int {
|
||||
return ATHUtil.resolveColor(this, android.R.attr.colorControlNormal)
|
||||
}
|
||||
fun Fragment.accentColor() = ThemeStore.accentColor(requireContext())
|
||||
|
||||
fun Context.textColorPrimary(): Int {
|
||||
return ATHUtil.resolveColor(this, android.R.attr.textColorPrimary)
|
||||
}
|
||||
fun Context.surfaceColor() = resolveColor(R.attr.colorSurface, Color.WHITE)
|
||||
|
||||
fun Fragment.surfaceColor() = resolveColor(R.attr.colorSurface, Color.WHITE)
|
||||
|
||||
fun Context.textColorSecondary() = resolveColor(android.R.attr.textColorSecondary)
|
||||
|
||||
fun Fragment.textColorSecondary() = resolveColor(android.R.attr.textColorSecondary)
|
||||
|
||||
fun Context.colorControlNormal() = resolveColor(android.R.attr.colorControlNormal)
|
||||
|
||||
fun Fragment.colorControlNormal() = resolveColor(android.R.attr.colorControlNormal)
|
||||
|
||||
fun Context.textColorPrimary() = resolveColor(android.R.attr.textColorPrimary)
|
||||
|
||||
fun Fragment.textColorPrimary() = resolveColor(android.R.attr.textColorPrimary)
|
||||
|
||||
fun Context.resolveColor(@AttrRes attr: Int, fallBackColor: Int = 0) =
|
||||
ATHUtil.resolveColor(this, attr, fallBackColor)
|
||||
|
||||
fun Fragment.resolveColor(@AttrRes attr: Int, fallBackColor: Int = 0) =
|
||||
ATHUtil.resolveColor(requireContext(), attr, fallBackColor)
|
||||
|
||||
fun Dialog.resolveColor(@AttrRes attr: Int, fallBackColor: Int = 0) =
|
||||
ATHUtil.resolveColor(context, attr, fallBackColor)
|
||||
|
|
|
@ -84,10 +84,10 @@ open class MiniPlayerFragment : AbsMusicServiceFragment(), MusicProgressViewUpda
|
|||
|
||||
val song = MusicPlayerRemote.currentSong
|
||||
val title = SpannableString(song.title)
|
||||
title.setSpan(ForegroundColorSpan(textColorPrimary(requireContext())), 0, title.length, 0)
|
||||
title.setSpan(ForegroundColorSpan(textColorPrimary()), 0, title.length, 0)
|
||||
|
||||
val text = SpannableString(song.artistName)
|
||||
text.setSpan(ForegroundColorSpan(textColorSecondary(requireContext())), 0, text.length, 0)
|
||||
text.setSpan(ForegroundColorSpan(textColorSecondary()), 0, text.length, 0)
|
||||
|
||||
builder.append(title).append(" • ").append(text)
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import androidx.appcompat.widget.Toolbar
|
|||
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.extensions.surfaceColor
|
||||
import code.name.monkey.retromusic.extensions.textColorPrimary
|
||||
import code.name.monkey.retromusic.extensions.textColorSecondary
|
||||
import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
|
||||
|
@ -154,13 +155,12 @@ class AdaptiveFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Call
|
|||
}
|
||||
|
||||
private fun setUpPlayerToolbar() {
|
||||
val primaryColor = ATHUtil.resolveColor(requireContext(), R.attr.colorPrimary)
|
||||
playerToolbar.apply {
|
||||
inflateMenu(R.menu.menu_player)
|
||||
setNavigationOnClickListener { requireActivity().onBackPressed() }
|
||||
ToolbarContentTintHelper.colorizeToolbar(this, primaryColor, requireActivity())
|
||||
setTitleTextColor(textColorPrimary(requireContext()))
|
||||
setSubtitleTextColor(textColorSecondary(requireContext()))
|
||||
ToolbarContentTintHelper.colorizeToolbar(this, surfaceColor(), requireActivity())
|
||||
setTitleTextColor(textColorPrimary())
|
||||
setSubtitleTextColor(textColorSecondary())
|
||||
setOnMenuItemClickListener(this@AdaptiveFragment)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
|
|||
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
|
||||
color.primaryTextColor
|
||||
} else {
|
||||
textColorSecondary(requireContext())
|
||||
textColorSecondary( )
|
||||
}.ripAlpha()
|
||||
|
||||
volumeFragment?.setTintable(colorFinal)
|
||||
|
|
|
@ -116,7 +116,7 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
|
|||
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
|
||||
lastPlaybackControlsColor
|
||||
} else {
|
||||
textColorSecondary(requireContext())
|
||||
textColorSecondary( )
|
||||
}.ripAlpha()
|
||||
|
||||
text.setTextColor(colorFinal)
|
||||
|
|
|
@ -59,7 +59,7 @@ class AlbumCoverStylePreference @JvmOverloads constructor(
|
|||
init {
|
||||
icon?.colorFilter =
|
||||
BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
|
||||
colorControlNormal(context),
|
||||
context.colorControlNormal(),
|
||||
SRC_IN
|
||||
)
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ class BlacklistPreference @JvmOverloads constructor(
|
|||
init {
|
||||
icon?.colorFilter =
|
||||
BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
|
||||
colorControlNormal(context),
|
||||
context.colorControlNormal(),
|
||||
SRC_IN
|
||||
)
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ class LibraryPreference @JvmOverloads constructor(
|
|||
init {
|
||||
icon?.colorFilter =
|
||||
BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
|
||||
colorControlNormal(context),
|
||||
context.colorControlNormal(),
|
||||
SRC_IN
|
||||
)
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ class MaterialListPreference @JvmOverloads constructor(
|
|||
|
||||
init {
|
||||
icon?.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
|
||||
colorControlNormal(context),
|
||||
context.colorControlNormal(),
|
||||
SRC_IN
|
||||
)
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ class NowPlayingScreenPreference @JvmOverloads constructor(
|
|||
|
||||
init {
|
||||
icon?.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
|
||||
colorControlNormal(context),
|
||||
context.colorControlNormal(),
|
||||
SRC_IN
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue