Code Cleanup
This commit is contained in:
parent
aca697f6ff
commit
db01ce6ee8
15 changed files with 32 additions and 115 deletions
|
@ -20,10 +20,8 @@ import code.name.monkey.appthemehelper.ThemeStore
|
|||
import code.name.monkey.appthemehelper.util.VersionUtils
|
||||
import code.name.monkey.retromusic.Constants.PRO_VERSION_PRODUCT_ID
|
||||
import code.name.monkey.retromusic.appshortcuts.DynamicShortcutManager
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import com.anjlab.android.iab.v3.BillingProcessor
|
||||
import com.anjlab.android.iab.v3.TransactionDetails
|
||||
import com.google.android.material.color.DynamicColors
|
||||
import org.koin.android.ext.koin.androidContext
|
||||
import org.koin.core.context.startKoin
|
||||
|
||||
|
@ -47,10 +45,6 @@ class App : Application() {
|
|||
.commit()
|
||||
}
|
||||
|
||||
if (PreferenceUtil.materialYou) {
|
||||
DynamicColors.applyToActivitiesIfAvailable(this)
|
||||
}
|
||||
|
||||
if (VersionUtils.hasNougatMR())
|
||||
DynamicShortcutManager(this).initDynamicShortcuts()
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ import androidx.annotation.StringDef
|
|||
import androidx.annotation.StringRes
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||
import code.name.monkey.appthemehelper.util.MaterialUtil
|
||||
import code.name.monkey.appthemehelper.util.TintHelper
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||
|
@ -89,8 +88,6 @@ open class BugReportActivity : AbsThemeActivity() {
|
|||
|
||||
private fun initViews() {
|
||||
val accentColor = ThemeStore.accentColor(this)
|
||||
val primaryColor = ATHUtil.resolveColor(this, R.attr.colorSurface)
|
||||
binding.toolbar.setBackgroundColor(primaryColor)
|
||||
setSupportActionBar(binding.toolbar)
|
||||
ToolbarContentTintHelper.colorBackButton(binding.toolbar)
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
|
|
|
@ -21,7 +21,6 @@ import android.widget.ImageView
|
|||
import android.widget.TextView
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.fragment.app.findFragment
|
||||
import androidx.navigation.findNavController
|
||||
|
@ -31,7 +30,6 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||
import code.name.monkey.appthemehelper.util.VersionUtils
|
||||
import code.name.monkey.retromusic.*
|
||||
import code.name.monkey.retromusic.adapter.album.AlbumAdapter
|
||||
import code.name.monkey.retromusic.adapter.artist.ArtistAdapter
|
||||
|
@ -192,11 +190,7 @@ class HomeAdapter(
|
|||
)
|
||||
|
||||
fun bindView(home: Home) {
|
||||
val color = if (PreferenceUtil.materialYou && VersionUtils.hasS()) {
|
||||
ContextCompat.getColor(App.getContext(), R.color.m3_accent_color)
|
||||
} else {
|
||||
ThemeStore.accentColor(activity)
|
||||
}
|
||||
val color = ThemeStore.accentColor(activity)
|
||||
itemView.findViewById<TextView>(R.id.message).apply {
|
||||
setTextColor(color)
|
||||
setOnClickListener {
|
||||
|
|
|
@ -24,7 +24,6 @@ import android.view.ViewGroup.MarginLayoutParams
|
|||
import android.view.ViewTreeObserver
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.EditText
|
||||
import android.widget.FrameLayout
|
||||
import androidx.annotation.LayoutRes
|
||||
import androidx.core.animation.doOnEnd
|
||||
import androidx.core.animation.doOnStart
|
||||
|
@ -34,7 +33,6 @@ import code.name.monkey.appthemehelper.util.TintHelper
|
|||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import code.name.monkey.retromusic.util.RetroUtil
|
||||
import com.afollestad.materialdialogs.utils.MDUtil.updatePadding
|
||||
import com.google.android.material.appbar.AppBarLayout
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||
import com.google.android.material.imageview.ShapeableImageView
|
||||
import com.google.android.material.shape.ShapeAppearanceModel
|
||||
|
|
|
@ -20,30 +20,27 @@ import android.view.MenuInflater
|
|||
import android.view.MenuItem
|
||||
import android.view.MenuItem.SHOW_AS_ACTION_IF_ROOM
|
||||
import android.view.View
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.core.text.HtmlCompat
|
||||
import androidx.core.view.doOnPreDraw
|
||||
import androidx.navigation.fragment.FragmentNavigatorExtras
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.appthemehelper.common.ATHToolbarActivity
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||
import code.name.monkey.appthemehelper.util.VersionUtils
|
||||
import code.name.monkey.retromusic.*
|
||||
import code.name.monkey.retromusic.adapter.HomeAdapter
|
||||
import code.name.monkey.retromusic.databinding.FragmentBannerHomeBinding
|
||||
import code.name.monkey.retromusic.databinding.FragmentHomeBinding
|
||||
import code.name.monkey.retromusic.dialogs.CreatePlaylistDialog
|
||||
import code.name.monkey.retromusic.dialogs.ImportPlaylistDialog
|
||||
import code.name.monkey.retromusic.extensions.accentColor
|
||||
import code.name.monkey.retromusic.extensions.drawNextToNavbar
|
||||
import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
|
||||
import code.name.monkey.retromusic.glide.GlideApp
|
||||
import code.name.monkey.retromusic.glide.RetroGlideExtension
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import com.google.android.gms.cast.framework.CastButtonFactory
|
||||
import com.google.android.material.appbar.AppBarLayout
|
||||
import com.google.android.material.shape.MaterialShapeDrawable
|
||||
import com.google.android.material.transition.MaterialSharedAxis
|
||||
|
||||
|
@ -144,12 +141,7 @@ class HomeFragment :
|
|||
MaterialSharedAxis(MaterialSharedAxis.Z, false)
|
||||
findNavController().navigate(R.id.searchFragment, null, navOptions)
|
||||
}
|
||||
val color = if (PreferenceUtil.materialYou && VersionUtils.hasS()) {
|
||||
ContextCompat.getColor(App.getContext(), R.color.m3_accent_color)
|
||||
} else {
|
||||
ThemeStore.accentColor(requireContext())
|
||||
}
|
||||
val hexColor = String.format("#%06X", 0xFFFFFF and color)
|
||||
val hexColor = String.format("#%06X", 0xFFFFFF and accentColor())
|
||||
val appName = HtmlCompat.fromHtml(
|
||||
"Retro <span style='color:$hexColor';>Music</span>",
|
||||
HtmlCompat.FROM_HTML_MODE_COMPACT
|
||||
|
|
|
@ -23,7 +23,6 @@ import androidx.fragment.app.FragmentActivity
|
|||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.transition.Fade
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.activities.MainActivity
|
||||
|
@ -118,7 +117,7 @@ class LyricsFragment : AbsMusicServiceFragment(R.layout.fragment_lyrics) {
|
|||
}.attach()
|
||||
// lyricsPager.isUserInputEnabled = false
|
||||
|
||||
binding.tabLyrics.setSelectedTabIndicatorColor(ThemeStore.accentColor(requireContext()))
|
||||
binding.tabLyrics.setSelectedTabIndicatorColor(accentColor())
|
||||
binding.tabLyrics.setTabTextColors(textColorSecondary(), accentColor())
|
||||
}
|
||||
|
||||
|
@ -326,10 +325,10 @@ class LyricsFragment : AbsMusicServiceFragment(R.layout.fragment_lyrics) {
|
|||
|
||||
private fun setupLyricsView() {
|
||||
binding.lyricsView.apply {
|
||||
setCurrentColor(ThemeStore.accentColor(context))
|
||||
setTimeTextColor(ThemeStore.accentColor(context))
|
||||
setTimelineColor(ThemeStore.accentColor(context))
|
||||
setTimelineTextColor(ThemeStore.accentColor(context))
|
||||
setCurrentColor(accentColor())
|
||||
setTimeTextColor(accentColor())
|
||||
setTimelineColor(accentColor())
|
||||
setTimelineTextColor(accentColor())
|
||||
setDraggable(true, LrcView.OnPlayClickListener {
|
||||
MusicPlayerRemote.seekTo(it.toInt())
|
||||
return@OnPlayClickListener true
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
package code.name.monkey.retromusic.glide
|
||||
|
||||
import android.graphics.drawable.Drawable
|
||||
import androidx.core.content.ContextCompat
|
||||
import code.name.monkey.appthemehelper.ThemeStore.Companion.accentColor
|
||||
import code.name.monkey.appthemehelper.util.TintHelper
|
||||
import code.name.monkey.appthemehelper.util.VersionUtils
|
||||
import code.name.monkey.retromusic.App.Companion.getContext
|
||||
import code.name.monkey.retromusic.Constants.USER_BANNER
|
||||
import code.name.monkey.retromusic.Constants.USER_PROFILE
|
||||
|
@ -19,7 +17,6 @@ import code.name.monkey.retromusic.util.CustomArtistImageUtil.Companion.getFile
|
|||
import code.name.monkey.retromusic.util.CustomArtistImageUtil.Companion.getInstance
|
||||
import code.name.monkey.retromusic.util.MusicUtil.getMediaStoreAlbumCoverUri
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil.materialYou
|
||||
import com.bumptech.glide.GenericTransitionOptions
|
||||
import com.bumptech.glide.Priority
|
||||
import com.bumptech.glide.RequestBuilder
|
||||
|
@ -185,11 +182,7 @@ object RetroGlideExtension {
|
|||
return TintHelper.createTintedDrawable(
|
||||
getContext(),
|
||||
R.drawable.ic_account,
|
||||
if (materialYou && VersionUtils.hasS()) {
|
||||
ContextCompat.getColor(getContext(), R.color.m3_accent_color)
|
||||
} else {
|
||||
accentColor(getContext())
|
||||
}
|
||||
accentColor(getContext())
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ import code.name.monkey.appthemehelper.ThemeStore.Companion.accentColor
|
|||
import code.name.monkey.appthemehelper.util.ColorUtil.isColorLight
|
||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper.getPrimaryTextColor
|
||||
import code.name.monkey.appthemehelper.util.TintHelper
|
||||
import code.name.monkey.appthemehelper.util.VersionUtils
|
||||
import code.name.monkey.retromusic.views.PopupBackground
|
||||
import me.zhanghai.android.fastscroll.FastScroller
|
||||
import me.zhanghai.android.fastscroll.FastScrollerBuilder
|
||||
|
@ -28,11 +27,7 @@ import me.zhanghai.android.fastscroll.R
|
|||
object ThemedFastScroller {
|
||||
fun create(view: ViewGroup): FastScroller {
|
||||
val context = view.context
|
||||
val color = if (PreferenceUtil.materialYou && VersionUtils.hasS()) {
|
||||
context.getColor(code.name.monkey.retromusic.R.color.m3_accent_color)
|
||||
} else {
|
||||
accentColor(context)
|
||||
}
|
||||
val color = accentColor(context)
|
||||
val textColor = getPrimaryTextColor(context, isColorLight(color))
|
||||
val fastScrollerBuilder = FastScrollerBuilder(view)
|
||||
fastScrollerBuilder.useMd2Style()
|
||||
|
|
|
@ -4,13 +4,7 @@ import android.content.Context
|
|||
import android.content.res.ColorStateList
|
||||
import android.util.AttributeSet
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import androidx.core.content.ContextCompat
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.appthemehelper.util.VersionUtils
|
||||
import code.name.monkey.retromusic.App
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.extensions.accentColor
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
|
||||
class AccentIcon @JvmOverloads constructor(
|
||||
context: Context,
|
||||
|
@ -18,11 +12,6 @@ class AccentIcon @JvmOverloads constructor(
|
|||
defStyleAttr: Int = -1
|
||||
) : AppCompatImageView(context, attrs, defStyleAttr) {
|
||||
init {
|
||||
val color = if (PreferenceUtil.materialYou && VersionUtils.hasS()) {
|
||||
ContextCompat.getColor(context, R.color.m3_accent_color)
|
||||
} else {
|
||||
ThemeStore.accentColor(context)
|
||||
}
|
||||
imageTintList = ColorStateList.valueOf(color)
|
||||
imageTintList = ColorStateList.valueOf(ThemeStore.accentColor(context))
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue