Added safeStorageContext

This commit is contained in:
merkost
2023-05-29 17:01:23 +10:00
parent fc6bee9df7
commit 0b3bf0a750
3 changed files with 17 additions and 12 deletions

View File

@ -225,9 +225,9 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
mLabelTextSize = resources.getDimension(R.dimen.label_text_size).toInt()
mPreviewHeight = resources.getDimension(R.dimen.key_height).toInt()
mSpaceMoveThreshold = resources.getDimension(R.dimen.medium_margin).toInt()
mTextColor = context.getProperTextColor()
mBackgroundColor = context.getProperBackgroundColor()
mPrimaryColor = context.getProperPrimaryColor()
mTextColor = context.safeStorageContext.getProperTextColor()
mBackgroundColor = context.safeStorageContext.getProperBackgroundColor()
mPrimaryColor = context.safeStorageContext.getProperPrimaryColor()
mPreviewPopup = PopupWindow(context)
mPreviewText = inflater.inflate(resources.getLayout(R.layout.keyboard_key_preview), null) as TextView
@ -374,12 +374,15 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
}
fun setupKeyboard(changedView: View? = null) {
mTextColor = context.getProperTextColor()
mBackgroundColor = context.getProperBackgroundColor()
mPrimaryColor = context.getProperPrimaryColor()
with(context.safeStorageContext) {
mTextColor = getProperTextColor()
mBackgroundColor = getProperBackgroundColor()
mPrimaryColor = getProperPrimaryColor()
mShowKeyBorders = config.showKeyBorders
mUsingSystemTheme = config.isUsingSystemTheme
}
mShowKeyBorders = context.config.showKeyBorders
mUsingSystemTheme = context.config.isUsingSystemTheme
val isMainKeyboard = changedView == null || changedView != mini_keyboard_view
mKeyBackground = if (mShowKeyBorders && isMainKeyboard) {