mirror of
https://github.com/cmclark00/RetroMusicPlayer.git
synced 2025-05-19 16:45:20 +01:00
Code Cleanup
This commit is contained in:
parent
8b79d84614
commit
a072e2a629
26 changed files with 82 additions and 117 deletions
|
@ -12,7 +12,6 @@ import androidx.core.view.WindowInsetsControllerCompat
|
|||
import androidx.core.view.isGone
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import code.name.monkey.appthemehelper.ATH
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||
import code.name.monkey.appthemehelper.util.VersionUtils
|
||||
import code.name.monkey.retromusic.R
|
||||
|
@ -142,13 +141,13 @@ fun AppCompatActivity.setStatusBarColor(color: Int) {
|
|||
else -> window.statusBarColor = ColorUtil.darkenColor(color)
|
||||
}
|
||||
}
|
||||
setLightStatusBarAuto(ATHUtil.resolveColor(this, R.attr.colorSurface))
|
||||
setLightStatusBarAuto(surfaceColor())
|
||||
}
|
||||
|
||||
fun AppCompatActivity.setStatusBarColorAuto() {
|
||||
// we don't want to use statusbar color because we are doing the color darkening on our own to support KitKat
|
||||
setStatusBarColor(ATHUtil.resolveColor(this, R.attr.colorSurface))
|
||||
setLightStatusBarAuto(ATHUtil.resolveColor(this, R.attr.colorSurface))
|
||||
setStatusBarColor(surfaceColor())
|
||||
setLightStatusBarAuto(surfaceColor())
|
||||
}
|
||||
|
||||
fun AppCompatActivity.setNavigationBarColor(color: Int) {
|
||||
|
|
|
@ -65,6 +65,10 @@ fun Context.surfaceColor() = resolveColor(R.attr.colorSurface, Color.WHITE)
|
|||
|
||||
fun Fragment.surfaceColor() = resolveColor(R.attr.colorSurface, Color.WHITE)
|
||||
|
||||
fun Context.surfaceColor(fallBackColor: Int) = resolveColor(R.attr.colorSurface, fallBackColor)
|
||||
|
||||
fun Fragment.surfaceColor(fallBackColor: Int) = resolveColor(R.attr.colorSurface, fallBackColor)
|
||||
|
||||
fun Context.textColorSecondary() = resolveColor(android.R.attr.textColorSecondary)
|
||||
|
||||
fun Fragment.textColorSecondary() = resolveColor(android.R.attr.textColorSecondary)
|
||||
|
@ -77,6 +81,10 @@ fun Context.textColorPrimary() = resolveColor(android.R.attr.textColorPrimary)
|
|||
|
||||
fun Fragment.textColorPrimary() = resolveColor(android.R.attr.textColorPrimary)
|
||||
|
||||
fun Context.defaultFooterColor() = resolveColor(R.attr.defaultFooterColor)
|
||||
|
||||
fun Fragment.defaultFooterColor() = resolveColor(R.attr.defaultFooterColor)
|
||||
|
||||
fun Context.resolveColor(@AttrRes attr: Int, fallBackColor: Int = 0) =
|
||||
ATHUtil.resolveColor(this, attr, fallBackColor)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue