mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
40 lines
1.1 KiB
Kotlin
40 lines
1.1 KiB
Kotlin
package org.futo.inputmethod.latin.uix
|
|
|
|
import android.content.res.TypedArray
|
|
import android.graphics.drawable.Drawable
|
|
import androidx.annotation.ColorInt
|
|
|
|
interface DynamicThemeProvider {
|
|
val primaryKeyboardColor: Int
|
|
|
|
val keyboardBackground: Drawable
|
|
val keyBackground: Drawable
|
|
val spaceBarBackground: Drawable
|
|
|
|
val keyFeedback: Drawable
|
|
|
|
val moreKeysTextColor: Int
|
|
val moreKeysKeyboardBackground: Drawable
|
|
val popupKey: Drawable
|
|
val actionPopupKey: Drawable
|
|
|
|
@ColorInt
|
|
fun getColor(i: Int): Int?
|
|
|
|
fun getDrawable(i: Int): Drawable?
|
|
|
|
fun getIcon(iconName: String): Drawable?
|
|
|
|
fun getKeyboardHeightMultiplier(): Float
|
|
|
|
companion object {
|
|
@ColorInt
|
|
fun getColorOrDefault(i: Int, @ColorInt default: Int, keyAttr: TypedArray, provider: DynamicThemeProvider?): Int {
|
|
return (provider?.getColor(i)) ?: keyAttr.getColor(i, default)
|
|
}
|
|
|
|
fun getDrawableOrDefault(i: Int, keyAttr: TypedArray, provider: DynamicThemeProvider?): Drawable? {
|
|
return (provider?.getDrawable(i)) ?: keyAttr.getDrawable(i)
|
|
}
|
|
}
|
|
} |