diff --git a/app/src/main/java/org/dslul/openboard/inputmethod/latin/KeyboardWrapperView.kt b/app/src/main/java/org/dslul/openboard/inputmethod/latin/KeyboardWrapperView.kt index 9135c9d88..e0d6e257d 100644 --- a/app/src/main/java/org/dslul/openboard/inputmethod/latin/KeyboardWrapperView.kt +++ b/app/src/main/java/org/dslul/openboard/inputmethod/latin/KeyboardWrapperView.kt @@ -60,6 +60,8 @@ class KeyboardWrapperView @JvmOverloads constructor( switchOneHandedModeBtn.colorFilter = colors.keyTextFilter colors.setBackgroundColor(stopOneHandedModeBtn.background, BackgroundType.BACKGROUND) colors.setBackgroundColor(switchOneHandedModeBtn.background, BackgroundType.BACKGROUND) + setBackgroundColor(Color.WHITE) // otherwise background might be null + colors.setKeyboardBackground(this) } @SuppressLint("RtlHardcoded") @@ -93,7 +95,6 @@ class KeyboardWrapperView @JvmOverloads constructor( override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) { if (!oneHandedModeEnabled) { super.onLayout(changed, left, top, right, bottom) - Settings.getInstance().current.mColors.setKeyboardBackground(keyboardView) // otherwise issue in clipboard view after switching oneHandedMode return } @@ -122,7 +123,6 @@ class KeyboardWrapperView @JvmOverloads constructor( buttonsLeft + (spareWidth + switchOneHandedModeBtn.measuredWidth) / 2, 2 * stopOneHandedModeBtn.measuredHeight + switchOneHandedModeBtn.measuredHeight ) - Settings.getInstance().current.mColors.setKeyboardBackground(this) } init { @@ -131,8 +131,5 @@ class KeyboardWrapperView @JvmOverloads constructor( iconStopOneHandedModeId = keyboardAttr.getResourceId(R.styleable.Keyboard_iconStopOneHandedMode, 0) iconSwitchOneHandedModeId = keyboardAttr.getResourceId(R.styleable.Keyboard_iconSwitchOneHandedMode, 0) keyboardAttr.recycle() - - setBackgroundColor(Color.WHITE) - Settings.getInstance().current.mColors.setKeyboardBackground(this) } } diff --git a/app/src/main/java/org/dslul/openboard/inputmethod/latin/common/Colors.kt b/app/src/main/java/org/dslul/openboard/inputmethod/latin/common/Colors.kt index f8e0f9e65..ae036df30 100644 --- a/app/src/main/java/org/dslul/openboard/inputmethod/latin/common/Colors.kt +++ b/app/src/main/java/org/dslul/openboard/inputmethod/latin/common/Colors.kt @@ -13,8 +13,12 @@ import androidx.core.graphics.BlendModeCompat import androidx.core.graphics.drawable.DrawableCompat import org.dslul.openboard.inputmethod.keyboard.KeyboardTheme.THEME_STYLE_HOLO import org.dslul.openboard.inputmethod.keyboard.KeyboardTheme.THEME_STYLE_MATERIAL +import org.dslul.openboard.inputmethod.keyboard.MainKeyboardView import org.dslul.openboard.inputmethod.keyboard.MoreKeysKeyboardView +import org.dslul.openboard.inputmethod.keyboard.clipboard.ClipboardHistoryView import org.dslul.openboard.inputmethod.keyboard.emoji.EmojiPageKeyboardView +import org.dslul.openboard.inputmethod.keyboard.emoji.EmojiPalettesView +import org.dslul.openboard.inputmethod.latin.KeyboardWrapperView import org.dslul.openboard.inputmethod.latin.R import org.dslul.openboard.inputmethod.latin.suggestions.MoreSuggestionsView import org.dslul.openboard.inputmethod.latin.suggestions.SuggestionStripView @@ -171,10 +175,14 @@ class Colors ( when (view) { is MoreSuggestionsView -> view.background.colorFilter = backgroundFilter is MoreKeysKeyboardView -> view.background.colorFilter = adjustedBackgroundFilter - is EmojiPageKeyboardView -> view.setBackgroundColor(Color.TRANSPARENT) // to make EmojiPalettesView background visible, which does not scroll is SuggestionStripView -> setBackgroundColor(view.background, BackgroundType.SUGGESTION) - else -> if (keyboardBackground != null) view.background = keyboardBackground + is EmojiPageKeyboardView, // to make EmojiPalettesView background visible, which does not scroll + is MainKeyboardView -> view.setBackgroundColor(Color.TRANSPARENT) // otherwise causes issues with wrapper view when using one-handed mode + is KeyboardWrapperView, is EmojiPalettesView, is ClipboardHistoryView -> { + if (keyboardBackground != null) view.background = keyboardBackground else view.background.colorFilter = backgroundFilter + } + else -> view.background.colorFilter = backgroundFilter } }