Added Material You accent color
parent
b281b8395a
commit
93cc50a0c3
|
@ -1,7 +1,7 @@
|
||||||
apply plugin: 'com.android.library'
|
apply plugin: 'com.android.library'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 29
|
compileSdkVersion 31
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
|
|
|
@ -6,9 +6,11 @@ import android.graphics.Color
|
||||||
import androidx.annotation.*
|
import androidx.annotation.*
|
||||||
import androidx.annotation.IntRange
|
import androidx.annotation.IntRange
|
||||||
import androidx.core.content.ContextCompat
|
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.isWindowBackgroundDark
|
||||||
import code.name.monkey.appthemehelper.util.ATHUtil.resolveColor
|
import code.name.monkey.appthemehelper.util.ATHUtil.resolveColor
|
||||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
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
|
@CheckResult
|
||||||
@ColorInt
|
@ColorInt
|
||||||
fun accentColor(context: Context): Int {
|
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 desaturatedColor = prefs(context).getBoolean("desaturated_color", false)
|
||||||
val color = prefs(context).getInt(
|
val color = prefs(context).getInt(
|
||||||
ThemeStorePrefKeys.KEY_ACCENT_COLOR,
|
ThemeStorePrefKeys.KEY_ACCENT_COLOR,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package code.name.monkey.appthemehelper.util
|
package code.name.monkey.appthemehelper.util
|
||||||
|
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
|
import androidx.annotation.ChecksSdkIntAtLeast
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Hemanth S (h4h13).
|
* @author Hemanth S (h4h13).
|
||||||
|
@ -57,4 +58,8 @@ object VersionUtils {
|
||||||
fun hasQ(): Boolean {
|
fun hasQ(): Boolean {
|
||||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q
|
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun hasS(): Boolean {
|
||||||
|
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.S
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue