pull/1395/head
gedoor 3 years ago
parent 76cb917530
commit 57ef8d9b73
  1. 17
      app/src/main/java/io/legado/app/lib/theme/MaterialValueHelper.kt

@ -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…
Cancel
Save