fix color issues in (more) suggestions for border theme

This commit is contained in:
Helium314 2023-07-31 07:22:22 +02:00
parent cf47f22c9e
commit 093280b513
4 changed files with 12 additions and 5 deletions

View file

@ -40,6 +40,7 @@ import org.dslul.openboard.inputmethod.latin.R;
import org.dslul.openboard.inputmethod.latin.common.Colors; import org.dslul.openboard.inputmethod.latin.common.Colors;
import org.dslul.openboard.inputmethod.latin.common.Constants; import org.dslul.openboard.inputmethod.latin.common.Constants;
import org.dslul.openboard.inputmethod.latin.settings.Settings; import org.dslul.openboard.inputmethod.latin.settings.Settings;
import org.dslul.openboard.inputmethod.latin.suggestions.MoreSuggestionsView;
import org.dslul.openboard.inputmethod.latin.utils.TypefaceUtils; import org.dslul.openboard.inputmethod.latin.utils.TypefaceUtils;
import java.util.HashSet; import java.util.HashSet;
@ -644,11 +645,13 @@ public class KeyboardView extends View {
DrawableCompat.setTintList(background, mColors.spaceBarStateList); DrawableCompat.setTintList(background, mColors.spaceBarStateList);
} else if (key.isFunctional()) { // shift, 123, delete,... } else if (key.isFunctional()) { // shift, 123, delete,...
DrawableCompat.setTintList(background, mColors.functionalKeyStateList); DrawableCompat.setTintList(background, mColors.functionalKeyStateList);
} else if (this.getClass() == MoreSuggestionsView.class) { // more suggestions popup, should not use keyStateList
DrawableCompat.setTintList(background, mColors.backgroundStateList);
} else if (this.getClass() == MoreKeysKeyboardView.class) { // more keys popup (except on action key, which is handled above) } else if (this.getClass() == MoreKeysKeyboardView.class) { // more keys popup (except on action key, which is handled above)
DrawableCompat.setTintList(background, mColors.adjustedBackgroundStateList); DrawableCompat.setTintList(background, mColors.adjustedBackgroundStateList);
} else if (key.getBackgroundType() == Key.BACKGROUND_TYPE_NORMAL) { // normal keys } else if (key.getBackgroundType() == Key.BACKGROUND_TYPE_NORMAL) { // normal keys
DrawableCompat.setTintList(background, mColors.keyStateList); DrawableCompat.setTintList(background, mColors.keyStateList);
} else if (keyboard.mId.mElementId >= 10 && keyboard.mId.mElementId <= 26) { // emoji keyboard keys } else if (keyboard.mId.mElementId >= 10 && keyboard.mId.mElementId <= 26) { // emoji keyboard keys, maybe rather check for EmojiPageKeyboardView.class?
DrawableCompat.setTintList(background, mColors.backgroundStateList); DrawableCompat.setTintList(background, mColors.backgroundStateList);
} }
} }

View file

@ -188,9 +188,10 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
if (colors.isCustom) { if (colors.isCustom) {
// this only works with backgrounds of SuggestionStripView.LXX_Base and SuggestionWord.LXX_Base // this only works with backgrounds of SuggestionStripView.LXX_Base and SuggestionWord.LXX_Base
// set to keyboard_background_lxx_base (just white drawable), but NOT when set to // set to keyboard_background_lxx_base (just white drawable), but NOT when set to
// btn_suggestion_lxx_base (state drawable with selector) // btn_suggestion_lxx_base (state drawable with selector) or keyboard_suggest_strip_lxx_base_border (layer-list)
// why is this? then i have to set tint list for voice/clipboard/other keys and word views separately // why is this? then it's necessary to set tint list for voice/clipboard/other keys and all word views separately
// anyway, the only loss is that pressed state can't have a different shape // 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
DrawableCompat.setTintList(getBackground(), colors.backgroundStateList); DrawableCompat.setTintList(getBackground(), colors.backgroundStateList);
DrawableCompat.setTintMode(getBackground(), PorterDuff.Mode.MULTIPLY); DrawableCompat.setTintMode(getBackground(), PorterDuff.Mode.MULTIPLY);

View file

@ -62,7 +62,8 @@
<style <style
name="SuggestionStripView.LXX_Base_Border" name="SuggestionStripView.LXX_Base_Border"
parent="SuggestionStripView.LXX_Base"> parent="SuggestionStripView.LXX_Base">
<item name="android:background">@drawable/keyboard_suggest_strip_lxx_base_border</item> <!-- todo (later): after fixing issue with SuggestionStripView revert to <item name="android:background">@drawable/keyboard_suggest_strip_lxx_base_border</item> -->
<item name="android:background">@drawable/keyboard_background_lxx_base</item>
</style> </style>
</resources> </resources>

View file

@ -120,6 +120,7 @@
<item name="centerSuggestionPercentile">@fraction/config_center_suggestion_percentile</item> <item name="centerSuggestionPercentile">@fraction/config_center_suggestion_percentile</item>
<item name="maxMoreSuggestionsRow">@integer/config_max_more_suggestions_row</item> <item name="maxMoreSuggestionsRow">@integer/config_max_more_suggestions_row</item>
<item name="minMoreSuggestionsWidth">@fraction/config_min_more_suggestions_width</item> <item name="minMoreSuggestionsWidth">@fraction/config_min_more_suggestions_width</item>
<!-- todo (later): after fixing issue with SuggestionStripView revert to <item name="android:background">@drawable/btn_suggestion_lxx_base</item> -->
<item name="android:background">@drawable/keyboard_background_lxx_base</item> <item name="android:background">@drawable/keyboard_background_lxx_base</item>
<item name="android:src">@drawable/suggestions_strip_divider_lxx_light</item> <item name="android:src">@drawable/suggestions_strip_divider_lxx_light</item>
<item name="suggestionStripOptions">autoCorrectBold|validTypedWordBold</item> <item name="suggestionStripOptions">autoCorrectBold|validTypedWordBold</item>
@ -133,6 +134,7 @@
name="SuggestionWord.LXX_Base" name="SuggestionWord.LXX_Base"
parent="SuggestionWord" parent="SuggestionWord"
> >
<!-- todo (later): after fixing issue with SuggestionStripView revert to <item name="android:background">@drawable/keyboard_suggest_strip_lxx_base</item> -->
<item name="android:background">@drawable/keyboard_background_lxx_base</item> <item name="android:background">@drawable/keyboard_background_lxx_base</item>
<item name="android:textColor">@color/highlight_color_lxx_light</item> <item name="android:textColor">@color/highlight_color_lxx_light</item>
</style> </style>