mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-29 19:18:07 +00:00
adjust colors, so the three main view have a common background
also slightly changes appearance of top strip, now all views use the same background
This commit is contained in:
parent
ac71f8724f
commit
171c1f451b
8 changed files with 60 additions and 49 deletions
|
@ -122,9 +122,8 @@ class ClipboardHistoryView @JvmOverloads constructor(
|
||||||
it.setOnTouchListener(this@ClipboardHistoryView)
|
it.setOnTouchListener(this@ClipboardHistoryView)
|
||||||
it.setOnClickListener(this@ClipboardHistoryView)
|
it.setOnClickListener(this@ClipboardHistoryView)
|
||||||
colors.setColor(it, ColorType.TOOL_BAR_KEY)
|
colors.setColor(it, ColorType.TOOL_BAR_KEY)
|
||||||
colors.setBackground(it, ColorType.BACKGROUND)
|
colors.setBackground(it, ColorType.STRIP_BACKGROUND)
|
||||||
}
|
}
|
||||||
colors.setBackground(clipboardStrip, ColorType.BACKGROUND)
|
|
||||||
initialized = true
|
initialized = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,7 +197,6 @@ class ClipboardHistoryView @JvmOverloads constructor(
|
||||||
adapter = clipboardAdapter
|
adapter = clipboardAdapter
|
||||||
layoutParams.width = ResourceUtils.getKeyboardWidth(context.resources, Settings.getInstance().current)
|
layoutParams.width = ResourceUtils.getKeyboardWidth(context.resources, Settings.getInstance().current)
|
||||||
}
|
}
|
||||||
Settings.getInstance().current.mColors.setBackground(this, ColorType.CLIPBOARD_BACKGROUND)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun stopClipboardHistory() {
|
fun stopClipboardHistory() {
|
||||||
|
|
|
@ -146,7 +146,7 @@ public final class EmojiPalettesView extends LinearLayout
|
||||||
// and the attrs categoryIndicatorDrawable, categoryIndicatorEnabled, categoryIndicatorBackground (and the connected drawables)
|
// and the attrs categoryIndicatorDrawable, categoryIndicatorEnabled, categoryIndicatorBackground (and the connected drawables)
|
||||||
private void addTab(final LinearLayout host, final int categoryId) {
|
private void addTab(final LinearLayout host, final int categoryId) {
|
||||||
final ImageView iconView = new ImageView(getContext());
|
final ImageView iconView = new ImageView(getContext());
|
||||||
mColors.setBackground(iconView, ColorType.EMOJI_CATEGORY_BACKGROUND);
|
mColors.setBackground(iconView, ColorType.STRIP_BACKGROUND);
|
||||||
mColors.setColor(iconView, ColorType.EMOJI_CATEGORY);
|
mColors.setColor(iconView, ColorType.EMOJI_CATEGORY);
|
||||||
iconView.setScaleType(ImageView.ScaleType.CENTER);
|
iconView.setScaleType(ImageView.ScaleType.CENTER);
|
||||||
iconView.setImageResource(mEmojiCategory.getCategoryTabIcon(categoryId));
|
iconView.setImageResource(mEmojiCategory.getCategoryTabIcon(categoryId));
|
||||||
|
@ -249,7 +249,7 @@ public final class EmojiPalettesView extends LinearLayout
|
||||||
mColors.setBackground(mAlphabetKeyLeft, ColorType.FUNCTIONAL_KEY_BACKGROUND);
|
mColors.setBackground(mAlphabetKeyLeft, ColorType.FUNCTIONAL_KEY_BACKGROUND);
|
||||||
mColors.setBackground(mDeleteKey, ColorType.FUNCTIONAL_KEY_BACKGROUND);
|
mColors.setBackground(mDeleteKey, ColorType.FUNCTIONAL_KEY_BACKGROUND);
|
||||||
mColors.setBackground(mSpacebar, ColorType.SPACE_BAR_BACKGROUND);
|
mColors.setBackground(mSpacebar, ColorType.SPACE_BAR_BACKGROUND);
|
||||||
mEmojiCategoryPageIndicatorView.setColors(mColors.get(ColorType.EMOJI_CATEGORY_SELECTED), mColors.get(ColorType.EMOJI_CATEGORY_BACKGROUND));
|
mEmojiCategoryPageIndicatorView.setColors(mColors.get(ColorType.EMOJI_CATEGORY_SELECTED), mColors.get(ColorType.STRIP_BACKGROUND));
|
||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,7 +368,6 @@ public final class EmojiPalettesView extends LinearLayout
|
||||||
mEmojiRecyclerView.setAdapter(mEmojiPalettesAdapter);
|
mEmojiRecyclerView.setAdapter(mEmojiPalettesAdapter);
|
||||||
setCurrentCategoryAndPageId(mEmojiCategory.getCurrentCategoryId(), mEmojiCategory.getCurrentCategoryPageId(), true);
|
setCurrentCategoryAndPageId(mEmojiCategory.getCurrentCategoryId(), mEmojiCategory.getCurrentCategoryPageId(), true);
|
||||||
}
|
}
|
||||||
mColors.setBackground(this, ColorType.EMOJI_BACKGROUND);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopEmojiPalettes() {
|
public void stopEmojiPalettes() {
|
||||||
|
|
|
@ -13,8 +13,12 @@ import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
|
import androidx.core.view.ViewKt;
|
||||||
|
|
||||||
import org.dslul.openboard.inputmethod.accessibility.AccessibilityUtils;
|
import org.dslul.openboard.inputmethod.accessibility.AccessibilityUtils;
|
||||||
import org.dslul.openboard.inputmethod.keyboard.MainKeyboardView;
|
import org.dslul.openboard.inputmethod.keyboard.MainKeyboardView;
|
||||||
|
import org.dslul.openboard.inputmethod.latin.common.ColorType;
|
||||||
|
import org.dslul.openboard.inputmethod.latin.settings.Settings;
|
||||||
import org.dslul.openboard.inputmethod.latin.suggestions.MoreSuggestionsView;
|
import org.dslul.openboard.inputmethod.latin.suggestions.MoreSuggestionsView;
|
||||||
import org.dslul.openboard.inputmethod.latin.suggestions.SuggestionStripView;
|
import org.dslul.openboard.inputmethod.latin.suggestions.SuggestionStripView;
|
||||||
|
|
||||||
|
@ -39,6 +43,10 @@ public final class InputView extends FrameLayout {
|
||||||
mMainKeyboardView, suggestionStripView);
|
mMainKeyboardView, suggestionStripView);
|
||||||
mMoreSuggestionsViewCanceler = new MoreSuggestionsViewCanceler(
|
mMoreSuggestionsViewCanceler = new MoreSuggestionsViewCanceler(
|
||||||
mMainKeyboardView, suggestionStripView);
|
mMainKeyboardView, suggestionStripView);
|
||||||
|
ViewKt.doOnNextLayout(this, v -> {
|
||||||
|
Settings.getInstance().getCurrent().mColors.setBackground(findViewById(R.id.main_keyboard_frame), ColorType.MAIN_BACKGROUND);
|
||||||
|
return null;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKeyboardTopPadding(final int keyboardTopPadding) {
|
public void setKeyboardTopPadding(final int keyboardTopPadding) {
|
||||||
|
|
|
@ -95,10 +95,9 @@ class KeyboardWrapperView @JvmOverloads constructor(
|
||||||
colors.setColor(stopOneHandedModeBtn, ColorType.ONE_HANDED_MODE_BUTTON)
|
colors.setColor(stopOneHandedModeBtn, ColorType.ONE_HANDED_MODE_BUTTON)
|
||||||
colors.setColor(switchOneHandedModeBtn, ColorType.ONE_HANDED_MODE_BUTTON)
|
colors.setColor(switchOneHandedModeBtn, ColorType.ONE_HANDED_MODE_BUTTON)
|
||||||
colors.setColor(resizeOneHandedModeBtn, ColorType.ONE_HANDED_MODE_BUTTON)
|
colors.setColor(resizeOneHandedModeBtn, ColorType.ONE_HANDED_MODE_BUTTON)
|
||||||
colors.setBackground(stopOneHandedModeBtn, ColorType.BACKGROUND)
|
colors.setBackground(stopOneHandedModeBtn, ColorType.ONE_HANDED_MODE_BUTTON)
|
||||||
colors.setBackground(switchOneHandedModeBtn, ColorType.BACKGROUND)
|
colors.setBackground(switchOneHandedModeBtn, ColorType.ONE_HANDED_MODE_BUTTON)
|
||||||
colors.setBackground(resizeOneHandedModeBtn, ColorType.BACKGROUND)
|
colors.setBackground(resizeOneHandedModeBtn, ColorType.ONE_HANDED_MODE_BUTTON)
|
||||||
colors.setBackground(this, ColorType.KEYBOARD_WRAPPER_BACKGROUND)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("RtlHardcoded")
|
@SuppressLint("RtlHardcoded")
|
||||||
|
|
|
@ -123,7 +123,7 @@ class DynamicColors(context: Context, override val themeStyle: String, override
|
||||||
private val actionKeyStateList: ColorStateList
|
private val actionKeyStateList: ColorStateList
|
||||||
private val spaceBarStateList: ColorStateList
|
private val spaceBarStateList: ColorStateList
|
||||||
private val adjustedBackgroundStateList: ColorStateList
|
private val adjustedBackgroundStateList: ColorStateList
|
||||||
private val suggestionBackgroundList: ColorStateList
|
private val stripBackgroundList: ColorStateList
|
||||||
private val toolbarKeyStateList = activatedStateList(keyText, darken(darken(keyText)))
|
private val toolbarKeyStateList = activatedStateList(keyText, darken(darken(keyText)))
|
||||||
|
|
||||||
/** custom drawable used for keyboard background */
|
/** custom drawable used for keyboard background */
|
||||||
|
@ -179,10 +179,14 @@ class DynamicColors(context: Context, override val themeStyle: String, override
|
||||||
stateList(accent, Color.WHITE)
|
stateList(accent, Color.WHITE)
|
||||||
}
|
}
|
||||||
|
|
||||||
suggestionBackgroundList = if (!hasKeyBorders && themeStyle == STYLE_MATERIAL)
|
val stripBackground = if (keyboardBackground == null && !hasKeyBorders) {
|
||||||
stateList(doubleAdjustedBackground, Color.TRANSPARENT)
|
if (isDarkColor(background)) 0x16ffffff else 0x11000000
|
||||||
else
|
} else {
|
||||||
stateList(adjustedBackground, Color.TRANSPARENT)
|
Color.TRANSPARENT
|
||||||
|
}
|
||||||
|
val pressedStripElementBackground = if (keyboardBackground == null) adjustedBackground
|
||||||
|
else if (isDarkColor(background)) 0x22ffffff else 0x11000000
|
||||||
|
stripBackgroundList = stateList(pressedStripElementBackground, stripBackground)
|
||||||
|
|
||||||
adjustedBackgroundFilter =
|
adjustedBackgroundFilter =
|
||||||
if (themeStyle == STYLE_HOLO) colorFilter(adjustedBackground)
|
if (themeStyle == STYLE_HOLO) colorFilter(adjustedBackground)
|
||||||
|
@ -245,7 +249,7 @@ class DynamicColors(context: Context, override val themeStyle: String, override
|
||||||
override fun get(color: ColorType): Int = when (color) {
|
override fun get(color: ColorType): Int = when (color) {
|
||||||
TOOL_BAR_KEY_ENABLED_BACKGROUND, EMOJI_CATEGORY_SELECTED, ACTION_KEY_BACKGROUND,
|
TOOL_BAR_KEY_ENABLED_BACKGROUND, EMOJI_CATEGORY_SELECTED, ACTION_KEY_BACKGROUND,
|
||||||
CLIPBOARD_PIN, SHIFT_KEY_ICON -> accent
|
CLIPBOARD_PIN, SHIFT_KEY_ICON -> accent
|
||||||
AUTOFILL_BACKGROUND_CHIP, EMOJI_CATEGORY_BACKGROUND, GESTURE_PREVIEW, MORE_KEYS_BACKGROUND, MORE_SUGGESTIONS_BACKGROUND, KEY_PREVIEW -> adjustedBackground
|
AUTOFILL_BACKGROUND_CHIP, GESTURE_PREVIEW, MORE_KEYS_BACKGROUND, MORE_SUGGESTIONS_BACKGROUND, KEY_PREVIEW -> adjustedBackground
|
||||||
TOOL_BAR_EXPAND_KEY_BACKGROUND -> if (!isNight) accent else doubleAdjustedBackground
|
TOOL_BAR_EXPAND_KEY_BACKGROUND -> if (!isNight) accent else doubleAdjustedBackground
|
||||||
GESTURE_TRAIL -> gesture
|
GESTURE_TRAIL -> gesture
|
||||||
KEY_TEXT, SUGGESTION_AUTO_CORRECT, REMOVE_SUGGESTION_ICON,
|
KEY_TEXT, SUGGESTION_AUTO_CORRECT, REMOVE_SUGGESTION_ICON,
|
||||||
|
@ -254,10 +258,10 @@ class DynamicColors(context: Context, override val themeStyle: String, override
|
||||||
SPACE_BAR_TEXT -> spaceBarText
|
SPACE_BAR_TEXT -> spaceBarText
|
||||||
FUNCTIONAL_KEY_BACKGROUND -> functionalKey
|
FUNCTIONAL_KEY_BACKGROUND -> functionalKey
|
||||||
SPACE_BAR_BACKGROUND -> spaceBar
|
SPACE_BAR_BACKGROUND -> spaceBar
|
||||||
BACKGROUND, KEYBOARD_WRAPPER_BACKGROUND, CLIPBOARD_BACKGROUND, EMOJI_BACKGROUND, KEYBOARD_BACKGROUND -> background
|
BACKGROUND, KEYBOARD_BACKGROUND, MAIN_BACKGROUND -> background
|
||||||
KEY_BACKGROUND -> keyBackground
|
KEY_BACKGROUND -> keyBackground
|
||||||
ACTION_KEY_MORE_KEYS_BACKGROUND -> if (themeStyle == STYLE_HOLO) adjustedBackground else accent
|
ACTION_KEY_MORE_KEYS_BACKGROUND -> if (themeStyle == STYLE_HOLO) adjustedBackground else accent
|
||||||
SUGGESTION_BACKGROUND -> if (!hasKeyBorders && themeStyle == STYLE_MATERIAL) adjustedBackground else background
|
STRIP_BACKGROUND -> if (!hasKeyBorders && themeStyle == STYLE_MATERIAL) adjustedBackground else background
|
||||||
NAVIGATION_BAR -> navBar
|
NAVIGATION_BAR -> navBar
|
||||||
MORE_SUGGESTIONS_HINT, SUGGESTED_WORD, SUGGESTION_TYPED_WORD, SUGGESTION_VALID_WORD -> adjustedKeyText
|
MORE_SUGGESTIONS_HINT, SUGGESTED_WORD, SUGGESTION_TYPED_WORD, SUGGESTION_VALID_WORD -> adjustedKeyText
|
||||||
ACTION_KEY_ICON, TOOL_BAR_EXPAND_KEY -> Color.WHITE
|
ACTION_KEY_ICON, TOOL_BAR_EXPAND_KEY -> Color.WHITE
|
||||||
|
@ -271,7 +275,7 @@ class DynamicColors(context: Context, override val themeStyle: String, override
|
||||||
ACTION_KEY_BACKGROUND -> actionKeyStateList
|
ACTION_KEY_BACKGROUND -> actionKeyStateList
|
||||||
SPACE_BAR_BACKGROUND -> spaceBarStateList
|
SPACE_BAR_BACKGROUND -> spaceBarStateList
|
||||||
MORE_KEYS_BACKGROUND -> adjustedBackgroundStateList
|
MORE_KEYS_BACKGROUND -> adjustedBackgroundStateList
|
||||||
SUGGESTION_BACKGROUND -> backgroundStateList
|
STRIP_BACKGROUND -> stripBackgroundList
|
||||||
ACTION_KEY_MORE_KEYS_BACKGROUND -> if (themeStyle == STYLE_HOLO) adjustedBackgroundStateList
|
ACTION_KEY_MORE_KEYS_BACKGROUND -> if (themeStyle == STYLE_HOLO) adjustedBackgroundStateList
|
||||||
else actionKeyStateList
|
else actionKeyStateList
|
||||||
TOOL_BAR_KEY -> toolbarKeyStateList
|
TOOL_BAR_KEY -> toolbarKeyStateList
|
||||||
|
@ -304,7 +308,7 @@ class DynamicColors(context: Context, override val themeStyle: String, override
|
||||||
|
|
||||||
override fun selectAndColorDrawable(attr: TypedArray, color: ColorType): Drawable {
|
override fun selectAndColorDrawable(attr: TypedArray, color: ColorType): Drawable {
|
||||||
val drawable = when (color) {
|
val drawable = when (color) {
|
||||||
KEY_BACKGROUND, BACKGROUND, SUGGESTION_BACKGROUND, ACTION_KEY_MORE_KEYS_BACKGROUND, MORE_KEYS_BACKGROUND ->
|
KEY_BACKGROUND, BACKGROUND, ACTION_KEY_MORE_KEYS_BACKGROUND, MORE_KEYS_BACKGROUND ->
|
||||||
attr.getDrawable(R.styleable.KeyboardView_keyBackground)
|
attr.getDrawable(R.styleable.KeyboardView_keyBackground)
|
||||||
FUNCTIONAL_KEY_BACKGROUND -> attr.getDrawable(R.styleable.KeyboardView_functionalKeyBackground)
|
FUNCTIONAL_KEY_BACKGROUND -> attr.getDrawable(R.styleable.KeyboardView_functionalKeyBackground)
|
||||||
SPACE_BAR_BACKGROUND -> {
|
SPACE_BAR_BACKGROUND -> {
|
||||||
|
@ -326,18 +330,18 @@ class DynamicColors(context: Context, override val themeStyle: String, override
|
||||||
|
|
||||||
override fun setBackground(view: View, color: ColorType) {
|
override fun setBackground(view: View, color: ColorType) {
|
||||||
if (view.background == null)
|
if (view.background == null)
|
||||||
view.setBackgroundColor(Color.WHITE) // set white to make the color filters word
|
view.setBackgroundColor(Color.WHITE) // set white to make the color filters work
|
||||||
when (color) {
|
when (color) {
|
||||||
EMOJI_CATEGORY_BACKGROUND -> view.setBackgroundColor(get(color))
|
|
||||||
KEY_PREVIEW -> view.background.colorFilter = adjustedBackgroundFilter
|
KEY_PREVIEW -> view.background.colorFilter = adjustedBackgroundFilter
|
||||||
FUNCTIONAL_KEY_BACKGROUND, KEY_BACKGROUND, BACKGROUND, SPACE_BAR_BACKGROUND, SUGGESTION_BACKGROUND -> setColor(view.background, color)
|
FUNCTIONAL_KEY_BACKGROUND, KEY_BACKGROUND, BACKGROUND, SPACE_BAR_BACKGROUND, STRIP_BACKGROUND -> setColor(view.background, color)
|
||||||
|
ONE_HANDED_MODE_BUTTON -> setColor(view.background, if (keyboardBackground == null) BACKGROUND else STRIP_BACKGROUND)
|
||||||
MORE_SUGGESTIONS_BACKGROUND -> view.background.colorFilter = backgroundFilter
|
MORE_SUGGESTIONS_BACKGROUND -> view.background.colorFilter = backgroundFilter
|
||||||
MORE_KEYS_BACKGROUND ->
|
MORE_KEYS_BACKGROUND ->
|
||||||
if (themeStyle != STYLE_HOLO)
|
if (themeStyle != STYLE_HOLO)
|
||||||
setColor(view.background, MORE_KEYS_BACKGROUND)
|
setColor(view.background, MORE_KEYS_BACKGROUND)
|
||||||
else view.background.colorFilter = adjustedBackgroundFilter
|
else view.background.colorFilter = adjustedBackgroundFilter
|
||||||
KEYBOARD_BACKGROUND -> view.setBackgroundColor(Color.TRANSPARENT)
|
KEYBOARD_BACKGROUND -> view.setBackgroundColor(Color.TRANSPARENT)
|
||||||
EMOJI_BACKGROUND, CLIPBOARD_BACKGROUND, KEYBOARD_WRAPPER_BACKGROUND -> {
|
MAIN_BACKGROUND -> {
|
||||||
if (keyboardBackground != null) view.background = keyboardBackground
|
if (keyboardBackground != null) view.background = keyboardBackground
|
||||||
else view.background.colorFilter = backgroundFilter
|
else view.background.colorFilter = backgroundFilter
|
||||||
}
|
}
|
||||||
|
@ -383,7 +387,7 @@ class DefaultColors (
|
||||||
private val actionKeyStateList: ColorStateList
|
private val actionKeyStateList: ColorStateList
|
||||||
private val spaceBarStateList: ColorStateList
|
private val spaceBarStateList: ColorStateList
|
||||||
private val adjustedBackgroundStateList: ColorStateList
|
private val adjustedBackgroundStateList: ColorStateList
|
||||||
private val suggestionBackgroundList: ColorStateList
|
private val stripBackgroundList: ColorStateList
|
||||||
private val toolbarKeyStateList = activatedStateList(suggestionText, darken(darken(suggestionText)))
|
private val toolbarKeyStateList = activatedStateList(suggestionText, darken(darken(suggestionText)))
|
||||||
|
|
||||||
/** custom drawable used for keyboard background */
|
/** custom drawable used for keyboard background */
|
||||||
|
@ -409,10 +413,15 @@ class DefaultColors (
|
||||||
doubleAdjustedBackground = darken(adjustedBackground)
|
doubleAdjustedBackground = darken(adjustedBackground)
|
||||||
}
|
}
|
||||||
adjustedBackgroundStateList = stateList(doubleAdjustedBackground, adjustedBackground)
|
adjustedBackgroundStateList = stateList(doubleAdjustedBackground, adjustedBackground)
|
||||||
suggestionBackgroundList = if (!hasKeyBorders && themeStyle == STYLE_MATERIAL)
|
|
||||||
stateList(doubleAdjustedBackground, Color.TRANSPARENT)
|
val stripBackground = if (keyboardBackground == null && !hasKeyBorders) {
|
||||||
else
|
if (isDarkColor(background)) 0x16ffffff else 0x11000000
|
||||||
stateList(adjustedBackground, Color.TRANSPARENT)
|
} else {
|
||||||
|
Color.TRANSPARENT
|
||||||
|
}
|
||||||
|
val pressedStripElementBackground = if (keyboardBackground == null) adjustedBackground
|
||||||
|
else if (isDarkColor(background)) 0x22ffffff else 0x11000000
|
||||||
|
stripBackgroundList = stateList(pressedStripElementBackground, stripBackground)
|
||||||
|
|
||||||
adjustedBackgroundFilter = colorFilter(adjustedBackground)
|
adjustedBackgroundFilter = colorFilter(adjustedBackground)
|
||||||
if (hasKeyBorders) {
|
if (hasKeyBorders) {
|
||||||
|
@ -446,7 +455,7 @@ class DefaultColors (
|
||||||
TOOL_BAR_KEY_ENABLED_BACKGROUND, EMOJI_CATEGORY_SELECTED, ACTION_KEY_BACKGROUND,
|
TOOL_BAR_KEY_ENABLED_BACKGROUND, EMOJI_CATEGORY_SELECTED, ACTION_KEY_BACKGROUND,
|
||||||
CLIPBOARD_PIN, SHIFT_KEY_ICON -> accent
|
CLIPBOARD_PIN, SHIFT_KEY_ICON -> accent
|
||||||
AUTOFILL_BACKGROUND_CHIP -> if (themeStyle == STYLE_MATERIAL && !hasKeyBorders) background else adjustedBackground
|
AUTOFILL_BACKGROUND_CHIP -> if (themeStyle == STYLE_MATERIAL && !hasKeyBorders) background else adjustedBackground
|
||||||
EMOJI_CATEGORY_BACKGROUND, GESTURE_PREVIEW, MORE_KEYS_BACKGROUND, MORE_SUGGESTIONS_BACKGROUND, KEY_PREVIEW -> adjustedBackground
|
GESTURE_PREVIEW, MORE_KEYS_BACKGROUND, MORE_SUGGESTIONS_BACKGROUND, KEY_PREVIEW -> adjustedBackground
|
||||||
TOOL_BAR_EXPAND_KEY_BACKGROUND -> doubleAdjustedBackground
|
TOOL_BAR_EXPAND_KEY_BACKGROUND -> doubleAdjustedBackground
|
||||||
GESTURE_TRAIL -> gesture
|
GESTURE_TRAIL -> gesture
|
||||||
KEY_TEXT, REMOVE_SUGGESTION_ICON, FUNCTIONAL_KEY_TEXT, KEY_ICON -> keyText
|
KEY_TEXT, REMOVE_SUGGESTION_ICON, FUNCTIONAL_KEY_TEXT, KEY_ICON -> keyText
|
||||||
|
@ -454,10 +463,10 @@ class DefaultColors (
|
||||||
SPACE_BAR_TEXT -> spaceBarText
|
SPACE_BAR_TEXT -> spaceBarText
|
||||||
FUNCTIONAL_KEY_BACKGROUND -> functionalKey
|
FUNCTIONAL_KEY_BACKGROUND -> functionalKey
|
||||||
SPACE_BAR_BACKGROUND -> spaceBar
|
SPACE_BAR_BACKGROUND -> spaceBar
|
||||||
BACKGROUND, KEYBOARD_WRAPPER_BACKGROUND, CLIPBOARD_BACKGROUND, EMOJI_BACKGROUND, KEYBOARD_BACKGROUND -> background
|
BACKGROUND, KEYBOARD_BACKGROUND, MAIN_BACKGROUND -> background
|
||||||
KEY_BACKGROUND -> keyBackground
|
KEY_BACKGROUND -> keyBackground
|
||||||
ACTION_KEY_MORE_KEYS_BACKGROUND -> if (themeStyle == STYLE_HOLO) adjustedBackground else accent
|
ACTION_KEY_MORE_KEYS_BACKGROUND -> if (themeStyle == STYLE_HOLO) adjustedBackground else accent
|
||||||
SUGGESTION_BACKGROUND -> if (!hasKeyBorders && themeStyle == STYLE_MATERIAL) adjustedBackground else background
|
STRIP_BACKGROUND -> if (!hasKeyBorders && themeStyle == STYLE_MATERIAL) adjustedBackground else background
|
||||||
NAVIGATION_BAR -> navBar
|
NAVIGATION_BAR -> navBar
|
||||||
SUGGESTION_AUTO_CORRECT, EMOJI_CATEGORY, TOOL_BAR_KEY, TOOL_BAR_EXPAND_KEY, ONE_HANDED_MODE_BUTTON -> suggestionText
|
SUGGESTION_AUTO_CORRECT, EMOJI_CATEGORY, TOOL_BAR_KEY, TOOL_BAR_EXPAND_KEY, ONE_HANDED_MODE_BUTTON -> suggestionText
|
||||||
MORE_SUGGESTIONS_HINT, SUGGESTED_WORD, SUGGESTION_TYPED_WORD, SUGGESTION_VALID_WORD -> adjustedSuggestionText
|
MORE_SUGGESTIONS_HINT, SUGGESTED_WORD, SUGGESTION_TYPED_WORD, SUGGESTION_VALID_WORD -> adjustedSuggestionText
|
||||||
|
@ -472,8 +481,7 @@ class DefaultColors (
|
||||||
ACTION_KEY_BACKGROUND -> actionKeyStateList
|
ACTION_KEY_BACKGROUND -> actionKeyStateList
|
||||||
SPACE_BAR_BACKGROUND -> spaceBarStateList
|
SPACE_BAR_BACKGROUND -> spaceBarStateList
|
||||||
MORE_KEYS_BACKGROUND -> adjustedBackgroundStateList
|
MORE_KEYS_BACKGROUND -> adjustedBackgroundStateList
|
||||||
SUGGESTION_BACKGROUND -> if (!hasKeyBorders && themeStyle == STYLE_MATERIAL) adjustedBackgroundStateList
|
STRIP_BACKGROUND -> stripBackgroundList
|
||||||
else backgroundStateList
|
|
||||||
ACTION_KEY_MORE_KEYS_BACKGROUND -> if (themeStyle == STYLE_HOLO) adjustedBackgroundStateList
|
ACTION_KEY_MORE_KEYS_BACKGROUND -> if (themeStyle == STYLE_HOLO) adjustedBackgroundStateList
|
||||||
else actionKeyStateList
|
else actionKeyStateList
|
||||||
TOOL_BAR_KEY -> toolbarKeyStateList
|
TOOL_BAR_KEY -> toolbarKeyStateList
|
||||||
|
@ -497,14 +505,14 @@ class DefaultColors (
|
||||||
|
|
||||||
override fun setBackground(view: View, color: ColorType) {
|
override fun setBackground(view: View, color: ColorType) {
|
||||||
if (view.background == null)
|
if (view.background == null)
|
||||||
view.setBackgroundColor(Color.WHITE) // set white to make the color filters word
|
view.setBackgroundColor(Color.WHITE) // set white to make the color filters work
|
||||||
when (color) {
|
when (color) {
|
||||||
EMOJI_CATEGORY_BACKGROUND -> view.setBackgroundColor(get(color))
|
|
||||||
KEY_PREVIEW, MORE_KEYS_BACKGROUND -> view.background.colorFilter = adjustedBackgroundFilter
|
KEY_PREVIEW, MORE_KEYS_BACKGROUND -> view.background.colorFilter = adjustedBackgroundFilter
|
||||||
FUNCTIONAL_KEY_BACKGROUND, KEY_BACKGROUND, BACKGROUND, SPACE_BAR_BACKGROUND, SUGGESTION_BACKGROUND -> setColor(view.background, color)
|
FUNCTIONAL_KEY_BACKGROUND, KEY_BACKGROUND, BACKGROUND, SPACE_BAR_BACKGROUND, STRIP_BACKGROUND -> setColor(view.background, color)
|
||||||
KEYBOARD_BACKGROUND -> view.setBackgroundColor(Color.TRANSPARENT)
|
ONE_HANDED_MODE_BUTTON -> setColor(view.background, if (keyboardBackground == null) BACKGROUND else STRIP_BACKGROUND)
|
||||||
MORE_SUGGESTIONS_BACKGROUND -> view.background.colorFilter = backgroundFilter
|
MORE_SUGGESTIONS_BACKGROUND -> view.background.colorFilter = backgroundFilter
|
||||||
EMOJI_BACKGROUND, CLIPBOARD_BACKGROUND, KEYBOARD_WRAPPER_BACKGROUND -> {
|
KEYBOARD_BACKGROUND -> view.setBackgroundColor(Color.TRANSPARENT)
|
||||||
|
MAIN_BACKGROUND -> {
|
||||||
if (keyboardBackground != null) view.background = keyboardBackground
|
if (keyboardBackground != null) view.background = keyboardBackground
|
||||||
else view.background.colorFilter = backgroundFilter
|
else view.background.colorFilter = backgroundFilter
|
||||||
}
|
}
|
||||||
|
@ -523,7 +531,7 @@ class DefaultColors (
|
||||||
|
|
||||||
override fun selectAndColorDrawable(attr: TypedArray, color: ColorType): Drawable {
|
override fun selectAndColorDrawable(attr: TypedArray, color: ColorType): Drawable {
|
||||||
val drawable = when (color) {
|
val drawable = when (color) {
|
||||||
KEY_BACKGROUND, BACKGROUND, SUGGESTION_BACKGROUND, ACTION_KEY_MORE_KEYS_BACKGROUND, MORE_KEYS_BACKGROUND ->
|
KEY_BACKGROUND, BACKGROUND, ACTION_KEY_MORE_KEYS_BACKGROUND, MORE_KEYS_BACKGROUND ->
|
||||||
attr.getDrawable(R.styleable.KeyboardView_keyBackground)
|
attr.getDrawable(R.styleable.KeyboardView_keyBackground)
|
||||||
FUNCTIONAL_KEY_BACKGROUND -> attr.getDrawable(R.styleable.KeyboardView_functionalKeyBackground)
|
FUNCTIONAL_KEY_BACKGROUND -> attr.getDrawable(R.styleable.KeyboardView_functionalKeyBackground)
|
||||||
SPACE_BAR_BACKGROUND -> {
|
SPACE_BAR_BACKGROUND -> {
|
||||||
|
@ -566,10 +574,7 @@ enum class ColorType {
|
||||||
AUTOFILL_BACKGROUND_CHIP,
|
AUTOFILL_BACKGROUND_CHIP,
|
||||||
BACKGROUND,
|
BACKGROUND,
|
||||||
CLIPBOARD_PIN,
|
CLIPBOARD_PIN,
|
||||||
CLIPBOARD_BACKGROUND,
|
|
||||||
EMOJI_BACKGROUND,
|
|
||||||
EMOJI_CATEGORY,
|
EMOJI_CATEGORY,
|
||||||
EMOJI_CATEGORY_BACKGROUND,
|
|
||||||
EMOJI_CATEGORY_SELECTED,
|
EMOJI_CATEGORY_SELECTED,
|
||||||
FUNCTIONAL_KEY_TEXT,
|
FUNCTIONAL_KEY_TEXT,
|
||||||
FUNCTIONAL_KEY_BACKGROUND,
|
FUNCTIONAL_KEY_BACKGROUND,
|
||||||
|
@ -581,7 +586,6 @@ enum class ColorType {
|
||||||
KEY_HINT_TEXT,
|
KEY_HINT_TEXT,
|
||||||
KEY_PREVIEW,
|
KEY_PREVIEW,
|
||||||
KEYBOARD_BACKGROUND,
|
KEYBOARD_BACKGROUND,
|
||||||
KEYBOARD_WRAPPER_BACKGROUND,
|
|
||||||
MORE_SUGGESTIONS_HINT,
|
MORE_SUGGESTIONS_HINT,
|
||||||
MORE_SUGGESTIONS_BACKGROUND,
|
MORE_SUGGESTIONS_BACKGROUND,
|
||||||
MORE_KEYS_BACKGROUND,
|
MORE_KEYS_BACKGROUND,
|
||||||
|
@ -591,13 +595,14 @@ enum class ColorType {
|
||||||
SPACE_BAR_TEXT,
|
SPACE_BAR_TEXT,
|
||||||
ONE_HANDED_MODE_BUTTON,
|
ONE_HANDED_MODE_BUTTON,
|
||||||
REMOVE_SUGGESTION_ICON,
|
REMOVE_SUGGESTION_ICON,
|
||||||
|
STRIP_BACKGROUND,
|
||||||
SUGGESTED_WORD,
|
SUGGESTED_WORD,
|
||||||
SUGGESTION_AUTO_CORRECT,
|
SUGGESTION_AUTO_CORRECT,
|
||||||
SUGGESTION_BACKGROUND,
|
|
||||||
SUGGESTION_TYPED_WORD,
|
SUGGESTION_TYPED_WORD,
|
||||||
SUGGESTION_VALID_WORD,
|
SUGGESTION_VALID_WORD,
|
||||||
TOOL_BAR_EXPAND_KEY,
|
TOOL_BAR_EXPAND_KEY,
|
||||||
TOOL_BAR_EXPAND_KEY_BACKGROUND,
|
TOOL_BAR_EXPAND_KEY_BACKGROUND,
|
||||||
TOOL_BAR_KEY,
|
TOOL_BAR_KEY,
|
||||||
TOOL_BAR_KEY_ENABLED_BACKGROUND,
|
TOOL_BAR_KEY_ENABLED_BACKGROUND,
|
||||||
|
MAIN_BACKGROUND,
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,7 +164,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
||||||
word.setContentDescription(getResources().getString(R.string.spoken_empty_suggestion));
|
word.setContentDescription(getResources().getString(R.string.spoken_empty_suggestion));
|
||||||
word.setOnClickListener(this);
|
word.setOnClickListener(this);
|
||||||
word.setOnLongClickListener(this);
|
word.setOnLongClickListener(this);
|
||||||
colors.setBackground(word, ColorType.SUGGESTION_BACKGROUND);
|
colors.setBackground(word, ColorType.STRIP_BACKGROUND);
|
||||||
mWordViews.add(word);
|
mWordViews.add(word);
|
||||||
final View divider = inflater.inflate(R.layout.suggestion_divider, null);
|
final View divider = inflater.inflate(R.layout.suggestion_divider, null);
|
||||||
mDividerViews.add(divider);
|
mDividerViews.add(divider);
|
||||||
|
@ -204,7 +204,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
||||||
final int toolbarHeight = Math.min(mToolbarExpandKey.getLayoutParams().height, (int) getResources().getDimension(R.dimen.config_suggestions_strip_height));
|
final int toolbarHeight = Math.min(mToolbarExpandKey.getLayoutParams().height, (int) getResources().getDimension(R.dimen.config_suggestions_strip_height));
|
||||||
mToolbarExpandKey.getLayoutParams().height = toolbarHeight;
|
mToolbarExpandKey.getLayoutParams().height = toolbarHeight;
|
||||||
mToolbarExpandKey.getLayoutParams().width = toolbarHeight; // we want it square
|
mToolbarExpandKey.getLayoutParams().width = toolbarHeight; // we want it square
|
||||||
colors.setBackground(mToolbarExpandKey, ColorType.SUGGESTION_BACKGROUND);
|
colors.setBackground(mToolbarExpandKey, ColorType.STRIP_BACKGROUND);
|
||||||
mDefaultBackground = mToolbarExpandKey.getBackground();
|
mDefaultBackground = mToolbarExpandKey.getBackground();
|
||||||
mEnabledToolKeyBackground.setColors(new int[] {colors.get(ColorType.TOOL_BAR_KEY_ENABLED_BACKGROUND) | 0xFF000000, Color.TRANSPARENT}); // ignore alpha on accent color
|
mEnabledToolKeyBackground.setColors(new int[] {colors.get(ColorType.TOOL_BAR_KEY_ENABLED_BACKGROUND) | 0xFF000000, Color.TRANSPARENT}); // ignore alpha on accent color
|
||||||
mEnabledToolKeyBackground.setGradientType(GradientDrawable.RADIAL_GRADIENT);
|
mEnabledToolKeyBackground.setGradientType(GradientDrawable.RADIAL_GRADIENT);
|
||||||
|
@ -228,7 +228,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
||||||
pinnedKeyInToolbar.setBackground(mEnabledToolKeyBackground);
|
pinnedKeyInToolbar.setBackground(mEnabledToolKeyBackground);
|
||||||
}
|
}
|
||||||
|
|
||||||
colors.setBackground(this, ColorType.SUGGESTION_BACKGROUND);
|
colors.setBackground(this, ColorType.STRIP_BACKGROUND);
|
||||||
keyboardAttr.recycle();
|
keyboardAttr.recycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -714,6 +714,6 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
||||||
view.setOnClickListener(this);
|
view.setOnClickListener(this);
|
||||||
view.setOnLongClickListener(this);
|
view.setOnLongClickListener(this);
|
||||||
colors.setColor(view, ColorType.TOOL_BAR_KEY);
|
colors.setColor(view, ColorType.TOOL_BAR_KEY);
|
||||||
colors.setBackground(view, ColorType.SUGGESTION_BACKGROUND);
|
colors.setBackground(view, ColorType.STRIP_BACKGROUND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
style="?attr/clipboardHistoryViewStyle">
|
style="?attr/clipboardHistoryViewStyle">
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
style="?attr/emojiPalettesViewStyle"
|
style="?attr/emojiPalettesViewStyle"
|
||||||
>
|
>
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
|
Loading…
Add table
Reference in a new issue