Added Material You accent color
This commit is contained in:
parent
b281b8395a
commit
93cc50a0c3
3 changed files with 11 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
|||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
compileSdkVersion 31
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 29
|
||||
|
|
|
@ -6,9 +6,11 @@ import android.graphics.Color
|
|||
import androidx.annotation.*
|
||||
import androidx.annotation.IntRange
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil.isWindowBackgroundDark
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil.resolveColor
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||
import code.name.monkey.appthemehelper.util.VersionUtils
|
||||
|
||||
|
||||
/**
|
||||
|
@ -204,6 +206,9 @@ private constructor(private val mContext: Context) : ThemeStorePrefKeys, ThemeSt
|
|||
@CheckResult
|
||||
@ColorInt
|
||||
fun accentColor(context: Context): Int {
|
||||
if (VersionUtils.hasS()) {
|
||||
return ContextCompat.getColor(context, android.R.color.system_accent1_600)
|
||||
}
|
||||
val desaturatedColor = prefs(context).getBoolean("desaturated_color", false)
|
||||
val color = prefs(context).getInt(
|
||||
ThemeStorePrefKeys.KEY_ACCENT_COLOR,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package code.name.monkey.appthemehelper.util
|
||||
|
||||
import android.os.Build
|
||||
import androidx.annotation.ChecksSdkIntAtLeast
|
||||
|
||||
/**
|
||||
* @author Hemanth S (h4h13).
|
||||
|
@ -57,4 +58,8 @@ object VersionUtils {
|
|||
fun hasQ(): Boolean {
|
||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q
|
||||
}
|
||||
|
||||
fun hasS(): Boolean {
|
||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.S
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue