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.Constants;
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 java.util.HashSet;
@ -644,11 +645,13 @@ public class KeyboardView extends View {
DrawableCompat.setTintList(background, mColors.spaceBarStateList);
} else if (key.isFunctional()) { // shift, 123, delete,...
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)
DrawableCompat.setTintList(background, mColors.adjustedBackgroundStateList);
} else if (key.getBackgroundType() == Key.BACKGROUND_TYPE_NORMAL) { // normal keys
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);
}
}

View file

@ -188,9 +188,10 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
if (colors.isCustom) {
// 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
// btn_suggestion_lxx_base (state drawable with selector)
// why is this? then i have to set tint list for voice/clipboard/other keys and word views separately
// anyway, the only loss is that pressed state can't have a different shape
// 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
// 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.setTintMode(getBackground(), PorterDuff.Mode.MULTIPLY);