mirror of
https://github.com/gedoor/legado.git
synced 2024-09-01 09:34:25 +08:00
优化
This commit is contained in:
parent
76cb917530
commit
57ef8d9b73
@ -2,7 +2,6 @@
|
||||
|
||||
package io.legado.app.lib.theme
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import androidx.annotation.ColorInt
|
||||
@ -15,7 +14,6 @@ import io.legado.app.utils.dp
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
@SuppressLint("PrivateResource")
|
||||
@ColorInt
|
||||
fun Context.getPrimaryTextColor(dark: Boolean): Int {
|
||||
return if (dark) {
|
||||
@ -23,28 +21,31 @@ fun Context.getPrimaryTextColor(dark: Boolean): Int {
|
||||
} else ContextCompat.getColor(this, R.color.primary_text_default_material_dark)
|
||||
}
|
||||
|
||||
@SuppressLint("PrivateResource")
|
||||
@ColorInt
|
||||
fun Context.getSecondaryTextColor(dark: Boolean): Int {
|
||||
return if (dark) {
|
||||
ContextCompat.getColor(this, R.color.secondary_text_default_material_light)
|
||||
} else ContextCompat.getColor(this, R.color.secondary_text_default_material_dark)
|
||||
} else {
|
||||
ContextCompat.getColor(this, R.color.secondary_text_default_material_dark)
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("PrivateResource")
|
||||
@ColorInt
|
||||
fun Context.getPrimaryDisabledTextColor(dark: Boolean): Int {
|
||||
return if (dark) {
|
||||
ContextCompat.getColor(this, R.color.primary_text_disabled_material_light)
|
||||
} else ContextCompat.getColor(this, R.color.primary_text_disabled_material_dark)
|
||||
} else {
|
||||
ContextCompat.getColor(this, R.color.primary_text_disabled_material_dark)
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("PrivateResource")
|
||||
@ColorInt
|
||||
fun Context.getSecondaryDisabledTextColor(dark: Boolean): Int {
|
||||
return if (dark) {
|
||||
ContextCompat.getColor(this, R.color.secondary_text_disabled_material_light)
|
||||
} else ContextCompat.getColor(this, R.color.secondary_text_disabled_material_dark)
|
||||
} else {
|
||||
ContextCompat.getColor(this, R.color.secondary_text_disabled_material_dark)
|
||||
}
|
||||
}
|
||||
|
||||
val Context.primaryColor: Int
|
||||
|
Loading…
Reference in New Issue
Block a user