From a757b00922d5824f2f231ebd71ff2d330c987def Mon Sep 17 00:00:00 2001 From: Helium314 Date: Mon, 4 Sep 2023 09:35:01 +0200 Subject: [PATCH] fix bad workaround for suggestion strip word background --- .../latin/suggestions/SuggestionStripView.java | 11 ++--------- app/src/main/res/values/themes-lxx-base.xml | 6 ++---- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/org/dslul/openboard/inputmethod/latin/suggestions/SuggestionStripView.java b/app/src/main/java/org/dslul/openboard/inputmethod/latin/suggestions/SuggestionStripView.java index 04b0163d7..200ad71df 100644 --- a/app/src/main/java/org/dslul/openboard/inputmethod/latin/suggestions/SuggestionStripView.java +++ b/app/src/main/java/org/dslul/openboard/inputmethod/latin/suggestions/SuggestionStripView.java @@ -131,6 +131,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick public SuggestionStripView(final Context context, final AttributeSet attrs, final int defStyle) { super(context, attrs, defStyle); + final Colors colors = Settings.getInstance().getCurrent().mColors; final LayoutInflater inflater = LayoutInflater.from(context); inflater.inflate(R.layout.suggestions_strip, this); @@ -146,6 +147,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick word.setContentDescription(getResources().getString(R.string.spoken_empty_suggestion)); word.setOnClickListener(this); word.setOnLongClickListener(this); + colors.setBackgroundColor(word.getBackground(), Colors.TYPE_BACKGROUND); mWordViews.add(word); final View divider = inflater.inflate(R.layout.suggestion_divider, null); mDividerViews.add(divider); @@ -183,16 +185,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick mOtherKey.setImageDrawable(iconIncognito); - final Colors colors = Settings.getInstance().getCurrent().mColors; - // this only works when backgrounds of SuggestionStripView.LXX_Base and SuggestionWord.LXX_Base - // are set to keyboard_background_lxx_base (just white drawable), but NOT when set to - // btn_suggestion_lxx_base (state drawable with selector) or keyboard_suggest_strip_lxx_base_border (layer-list) - // why is this? then it's necessary to set tint list for voice/clipboard/other keys and all word views separately - // it seems to work in other places, e.g. for btn_keyboard_spacebar_lxx_base... though maybe that's the weirdly nested layer list? - // todo (later): when fixing this, revert changes in themes-lxx-base[-border] (in todo) - // this would allow having a different background shape in pressed state colors.setBackgroundColor(getBackground(), Colors.TYPE_BACKGROUND); - mClipboardKey.setColorFilter(colors.keyText); mVoiceKey.setColorFilter(colors.keyText); mOtherKey.setColorFilter(colors.keyText); diff --git a/app/src/main/res/values/themes-lxx-base.xml b/app/src/main/res/values/themes-lxx-base.xml index dfddf5e45..6a3358918 100644 --- a/app/src/main/res/values/themes-lxx-base.xml +++ b/app/src/main/res/values/themes-lxx-base.xml @@ -123,8 +123,7 @@ @fraction/config_center_suggestion_percentile @integer/config_max_more_suggestions_row @fraction/config_min_more_suggestions_width - - @drawable/keyboard_background_lxx_base + @drawable/btn_suggestion_lxx_base @drawable/suggestions_strip_divider_lxx_light autoCorrectBold|validTypedWordBold @color/typed_word_color_lxx_light @@ -137,8 +136,7 @@ name="SuggestionWord.LXX_Base" parent="SuggestionWord" > - - @drawable/keyboard_background_lxx_base + @drawable/btn_suggestion_lxx_base @color/highlight_color_lxx_light \ No newline at end of file