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