user-adjustable colors

This commit is contained in:
Helium314 2023-06-28 18:54:23 +02:00
parent ae69ffe648
commit cdabf650c6
19 changed files with 425 additions and 9 deletions

View file

@ -19,7 +19,11 @@ Plan / to do:
* ~suggestion fixes, https://github.com/openboard-team/openboard/pull/694, https://github.com/openboard-team/openboard/issues/795, https://github.com/openboard-team/openboard/issues/660~ * ~suggestion fixes, https://github.com/openboard-team/openboard/pull/694, https://github.com/openboard-team/openboard/issues/795, https://github.com/openboard-team/openboard/issues/660~
* ~improve auto-space insertion, https://github.com/openboard-team/openboard/pull/576~ * ~improve auto-space insertion, https://github.com/openboard-team/openboard/pull/576~
* emoji prediction/search, either https://github.com/openboard-team/openboard/pull/749 (using emoji dictionaries already possible) * emoji prediction/search, either https://github.com/openboard-team/openboard/pull/749 (using emoji dictionaries already possible)
* theming, https://github.com/openboard-team/openboard/issues/124 * ~theming, https://github.com/openboard-team/openboard/issues/124~
* fix emoji view not themed properly
* fix ABC buttons in emoji and clipboard view have wrong text color
* fix buttons on long-press action key not themed
* allow adjusting colors without requiring manual reload of keyboard
* delete suggestions, https://github.com/openboard-team/openboard/issues/106 * delete suggestions, https://github.com/openboard-team/openboard/issues/106
* ~gesture typing, https://github.com/openboard-team/openboard/issues/3~ * ~gesture typing, https://github.com/openboard-team/openboard/issues/3~
* ~license issues, require using an external library~ * ~license issues, require using an external library~
@ -43,6 +47,7 @@ Changes:
* Allow loading an external library to enable gesture typing, https://github.com/openboard-team/openboard/issues/3 * Allow loading an external library to enable gesture typing, https://github.com/openboard-team/openboard/issues/3
* based on wordmage's work https://github.com/openboard-team/openboard/tree/57d33791d7674e3fe0600eddb72f6b4317b5df00 * based on wordmage's work https://github.com/openboard-team/openboard/tree/57d33791d7674e3fe0600eddb72f6b4317b5df00
* tested with Google libraries and [others](https://github.com/openboard-team/openboard/issues/3#issuecomment-1200456262) (when building with the [rename](https://github.com/openboard-team/openboard/tree/57d33791d7674e3fe0600eddb72f6b4317b5df00)) * tested with Google libraries and [others](https://github.com/openboard-team/openboard/issues/3#issuecomment-1200456262) (when building with the [rename](https://github.com/openboard-team/openboard/tree/57d33791d7674e3fe0600eddb72f6b4317b5df00))
* Allow adjusting keyboard colors, https://github.com/openboard-team/openboard/issues/124
----- -----

View file

@ -549,6 +549,12 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
mClipboardHistoryView.setHardwareAcceleratedDrawingEnabled( mClipboardHistoryView.setHardwareAcceleratedDrawingEnabled(
isHardwareAcceleratedDrawingEnabled); isHardwareAcceleratedDrawingEnabled);
mClipboardHistoryView.setKeyboardActionListener(mLatinIME); mClipboardHistoryView.setKeyboardActionListener(mLatinIME);
// set background color here, otherwise there is a narrow white line between keyboard and suggestion strip
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
if (settingsValues.mUserTheme)
mKeyboardViewWrapper.getBackground().setColorFilter(settingsValues.mBackgroundColorFilter);
return mCurrentInputView; return mCurrentInputView;
} }

View file

@ -38,15 +38,17 @@ public final class KeyboardTheme implements Comparable<KeyboardTheme> {
public static final String THEME_VARIANT_DARK = "Dark"; public static final String THEME_VARIANT_DARK = "Dark";
public static final String THEME_VARIANT_WHITE = "White"; public static final String THEME_VARIANT_WHITE = "White";
public static final String THEME_VARIANT_BLUE = "Blue"; public static final String THEME_VARIANT_BLUE = "Blue";
public static final String THEME_VARIANT_USER = "User-defined";
public static final String THEME_VARIANT_HOLO_USER = "User-defined (Holo)";
public static final String[] THEME_FAMILIES = {THEME_FAMILY_MATERIAL, THEME_FAMILY_HOLO}; public static final String[] THEME_FAMILIES = {THEME_FAMILY_MATERIAL, THEME_FAMILY_HOLO};
public static final Map<String, String[]> THEME_VARIANTS = new HashMap<>(); public static final Map<String, String[]> THEME_VARIANTS = new HashMap<>();
static { static {
THEME_VARIANTS.put(THEME_FAMILY_MATERIAL, THEME_VARIANTS.put(THEME_FAMILY_MATERIAL,
new String[] {THEME_VARIANT_LIGHT, THEME_VARIANT_DARK}); new String[] {THEME_VARIANT_LIGHT, THEME_VARIANT_DARK, THEME_VARIANT_USER});
THEME_VARIANTS.put(THEME_FAMILY_HOLO, THEME_VARIANTS.put(THEME_FAMILY_HOLO,
new String[] {THEME_VARIANT_WHITE, THEME_VARIANT_BLUE}); new String[] {THEME_VARIANT_WHITE, THEME_VARIANT_BLUE, THEME_VARIANT_HOLO_USER});
} }
private static final String TAG = KeyboardTheme.class.getSimpleName(); private static final String TAG = KeyboardTheme.class.getSimpleName();
@ -58,6 +60,7 @@ public final class KeyboardTheme implements Comparable<KeyboardTheme> {
// attributes' values in attrs.xml. // attributes' values in attrs.xml.
public static final int THEME_ID_ICS = 0; public static final int THEME_ID_ICS = 0;
public static final int THEME_ID_KLP = 2; public static final int THEME_ID_KLP = 2;
public static final int THEME_ID_KLP_USER = 13;
public static final int THEME_ID_LXX_LIGHT = 3; public static final int THEME_ID_LXX_LIGHT = 3;
public static final int THEME_ID_LXX_DARK_AMOLED = 4; public static final int THEME_ID_LXX_DARK_AMOLED = 4;
public static final int THEME_ID_LXX_AUTO_AMOLED = 10; public static final int THEME_ID_LXX_AUTO_AMOLED = 10;
@ -66,6 +69,8 @@ public final class KeyboardTheme implements Comparable<KeyboardTheme> {
public static final int THEME_ID_LXX_DARK = 7; public static final int THEME_ID_LXX_DARK = 7;
public static final int THEME_ID_LXX_AUTO = 9; public static final int THEME_ID_LXX_AUTO = 9;
public static final int THEME_ID_LXX_AUTO_BORDER = 8; public static final int THEME_ID_LXX_AUTO_BORDER = 8;
public static final int THEME_ID_LXX_USER = 11;
public static final int THEME_ID_LXX_USER_BORDER = 12;
public static final int DEFAULT_THEME_ID = THEME_ID_LXX_DARK_BORDER; public static final int DEFAULT_THEME_ID = THEME_ID_LXX_DARK_BORDER;
private static KeyboardTheme[] AVAILABLE_KEYBOARD_THEMES; private static KeyboardTheme[] AVAILABLE_KEYBOARD_THEMES;
@ -102,6 +107,15 @@ public final class KeyboardTheme implements Comparable<KeyboardTheme> {
new KeyboardTheme(THEME_ID_LXX_AUTO_AMOLED, "LXXAutoAmoled", R.style.KeyboardTheme_LXX_Auto_Amoled, new KeyboardTheme(THEME_ID_LXX_AUTO_AMOLED, "LXXAutoAmoled", R.style.KeyboardTheme_LXX_Auto_Amoled,
// This has never been selected as default theme. // This has never been selected as default theme.
VERSION_CODES.LOLLIPOP), VERSION_CODES.LOLLIPOP),
new KeyboardTheme(THEME_ID_LXX_USER, "LXXUser", R.style.KeyboardTheme_LXX_Light,
// This has never been selected as default theme.
VERSION_CODES.LOLLIPOP),
new KeyboardTheme(THEME_ID_LXX_USER_BORDER, "LXXUserBorder", R.style.KeyboardTheme_LXX_Light_Border,
// This has never been selected as default theme.
VERSION_CODES.LOLLIPOP),
new KeyboardTheme(THEME_ID_KLP_USER, "KLPUser", R.style.KeyboardTheme_KLP,
// This has never been selected as default theme.
VERSION_CODES.BASE),
}; };
static { static {
@ -237,7 +251,7 @@ public final class KeyboardTheme implements Comparable<KeyboardTheme> {
} }
public static String getThemeFamily(int themeId) { public static String getThemeFamily(int themeId) {
if (themeId == THEME_ID_ICS || themeId == THEME_ID_KLP) return THEME_FAMILY_HOLO; if (themeId == THEME_ID_ICS || themeId == THEME_ID_KLP || themeId == THEME_ID_KLP_USER) return THEME_FAMILY_HOLO;
return THEME_FAMILY_MATERIAL; return THEME_FAMILY_MATERIAL;
} }
@ -254,6 +268,11 @@ public final class KeyboardTheme implements Comparable<KeyboardTheme> {
return THEME_VARIANT_WHITE; return THEME_VARIANT_WHITE;
case THEME_ID_ICS: case THEME_ID_ICS:
return THEME_VARIANT_BLUE; return THEME_VARIANT_BLUE;
case THEME_ID_LXX_USER:
case THEME_ID_LXX_USER_BORDER:
return THEME_VARIANT_USER;
case THEME_ID_KLP_USER:
return THEME_VARIANT_HOLO_USER;
default: default:
return null; return null;
} }
@ -264,6 +283,7 @@ public final class KeyboardTheme implements Comparable<KeyboardTheme> {
case THEME_ID_LXX_DARK_BORDER: case THEME_ID_LXX_DARK_BORDER:
case THEME_ID_LXX_LIGHT_BORDER: case THEME_ID_LXX_LIGHT_BORDER:
case THEME_ID_LXX_AUTO_BORDER: case THEME_ID_LXX_AUTO_BORDER:
case THEME_ID_LXX_USER_BORDER:
case THEME_ID_ICS: case THEME_ID_ICS:
case THEME_ID_KLP: case THEME_ID_KLP:
return true; return true;
@ -272,6 +292,17 @@ public final class KeyboardTheme implements Comparable<KeyboardTheme> {
} }
} }
public static boolean getIsUser(int themeId) {
switch (themeId) {
case THEME_ID_LXX_USER:
case THEME_ID_LXX_USER_BORDER:
case THEME_ID_KLP_USER:
return true;
default:
return false;
}
}
public static boolean getIsDayNight(int themeId) { public static boolean getIsDayNight(int themeId) {
switch (themeId) { switch (themeId) {
case THEME_ID_LXX_AUTO: case THEME_ID_LXX_AUTO:
@ -297,6 +328,7 @@ public final class KeyboardTheme implements Comparable<KeyboardTheme> {
boolean keyBorders, boolean dayNight, boolean amoledMode) { boolean keyBorders, boolean dayNight, boolean amoledMode) {
if (THEME_FAMILY_HOLO.equals(family)) { if (THEME_FAMILY_HOLO.equals(family)) {
if (THEME_VARIANT_BLUE.equals(variant)) return THEME_ID_ICS; if (THEME_VARIANT_BLUE.equals(variant)) return THEME_ID_ICS;
if (THEME_VARIANT_HOLO_USER.equals(variant)) return THEME_ID_KLP_USER;
return THEME_ID_KLP; return THEME_ID_KLP;
} }
if (dayNight) { if (dayNight) {
@ -309,6 +341,10 @@ public final class KeyboardTheme implements Comparable<KeyboardTheme> {
if (amoledMode) return THEME_ID_LXX_DARK_AMOLED; if (amoledMode) return THEME_ID_LXX_DARK_AMOLED;
return THEME_ID_LXX_DARK; return THEME_ID_LXX_DARK;
} }
if (THEME_VARIANT_USER.equals(variant)) {
if (keyBorders) return THEME_ID_LXX_USER_BORDER;
return THEME_ID_LXX_USER;
}
if (keyBorders) return THEME_ID_LXX_LIGHT_BORDER; if (keyBorders) return THEME_ID_LXX_LIGHT_BORDER;
return THEME_ID_LXX_LIGHT; return THEME_ID_LXX_LIGHT;
} }

View file

@ -21,6 +21,7 @@ import android.content.res.TypedArray;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.Paint.Align; import android.graphics.Paint.Align;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
@ -32,11 +33,15 @@ import android.text.TextUtils;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View; import android.view.View;
import androidx.core.graphics.BlendModeColorFilterCompat;
import androidx.core.graphics.BlendModeCompat;
import org.dslul.openboard.inputmethod.keyboard.internal.KeyDrawParams; import org.dslul.openboard.inputmethod.keyboard.internal.KeyDrawParams;
import org.dslul.openboard.inputmethod.keyboard.internal.KeyVisualAttributes; import org.dslul.openboard.inputmethod.keyboard.internal.KeyVisualAttributes;
import org.dslul.openboard.inputmethod.latin.R; import org.dslul.openboard.inputmethod.latin.R;
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.settings.SettingsValues;
import org.dslul.openboard.inputmethod.latin.utils.TypefaceUtils; import org.dslul.openboard.inputmethod.latin.utils.TypefaceUtils;
import java.util.HashSet; import java.util.HashSet;
@ -96,6 +101,11 @@ public class KeyboardView extends View {
private final float mSpacebarIconWidthRatio; private final float mSpacebarIconWidthRatio;
private final Rect mKeyBackgroundPadding = new Rect(); private final Rect mKeyBackgroundPadding = new Rect();
private static final float KET_TEXT_SHADOW_RADIUS_DISABLED = -1.0f; private static final float KET_TEXT_SHADOW_RADIUS_DISABLED = -1.0f;
private final ColorFilter keyHintTextColorFilter;
private final ColorFilter keyTextColorFilter;
private final ColorFilter keyBgFilter;
private final ColorFilter accentColorFilter;
private final boolean mUserTheme;
// The maximum key label width in the proportion to the key width. // The maximum key label width in the proportion to the key width.
private static final float MAX_LABEL_RATIO = 0.90f; private static final float MAX_LABEL_RATIO = 0.90f;
@ -166,6 +176,22 @@ public class KeyboardView extends View {
keyAttr.recycle(); keyAttr.recycle();
mPaint.setAntiAlias(true); mPaint.setAntiAlias(true);
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
mUserTheme = settingsValues.mUserTheme;
if (mUserTheme) {
getBackground().setColorFilter(settingsValues.mBackgroundColorFilter);
keyBgFilter = settingsValues.mKeyBackgroundColorFilter;
keyHintTextColorFilter = settingsValues.mHintTextColorFilter;
keyTextColorFilter = settingsValues.mKeyTextColorFilter;
accentColorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(settingsValues.mUserThemeColorAccent, BlendModeCompat.SRC_ATOP);
} else {
keyHintTextColorFilter = null;
keyTextColorFilter = null;
keyBgFilter = null;
accentColorFilter = null;
}
} }
@Nullable @Nullable
@ -370,6 +396,27 @@ public class KeyboardView extends View {
bgX = -padding.left; bgX = -padding.left;
bgY = -padding.top; bgY = -padding.top;
} }
/* if (mUserTheme) {
// color filter is applied to background, which is re-used
// but we don't want it applied to "blue" keys
// so we always need to select the color filter dependent on the current key
if (key.isActionKey()
|| (key.getBackgroundType() == Key.BACKGROUND_TYPE_NORMAL && key.getCode() < 0 && key.getCode() != Constants.CODE_SWITCH_ALPHA_SYMBOL))
background.clearColorFilter();
else
background.setColorFilter(keyBgFilter);
}*/
if (mUserTheme) {
// color filter is applied to background, which is re-used
// but we don't want it applied to "blue" keys
// so we always need to select the color filter dependent on the current key
if (key.isActionKey())
background.setColorFilter(accentColorFilter);
else if (key.getBackgroundType() == Key.BACKGROUND_TYPE_NORMAL && key.getCode() < 0 && key.getCode() != Constants.CODE_SWITCH_ALPHA_SYMBOL)
background.clearColorFilter();
else
background.setColorFilter(keyBgFilter);
}
background.setBounds(0, 0, bgWidth, bgHeight); background.setBounds(0, 0, bgWidth, bgHeight);
canvas.translate(bgX, bgY); canvas.translate(bgX, bgY);
background.draw(canvas); background.draw(canvas);
@ -422,6 +469,11 @@ public class KeyboardView extends View {
if (key.isEnabled()) { if (key.isEnabled()) {
paint.setColor(key.selectTextColor(params)); paint.setColor(key.selectTextColor(params));
if (mUserTheme) {
// set key color only if not in emoji keyboard range
if (keyboard != null && (keyboard.mId.mElementId < 10 || keyboard.mId.mElementId > 26))
paint.setColorFilter(keyTextColorFilter);
}
// Set a drop shadow for the text if the shadow radius is positive value. // Set a drop shadow for the text if the shadow radius is positive value.
if (mKeyTextShadowRadius > 0.0f) { if (mKeyTextShadowRadius > 0.0f) {
paint.setShadowLayer(mKeyTextShadowRadius, 0.0f, 0.0f, params.mTextShadowColor); paint.setShadowLayer(mKeyTextShadowRadius, 0.0f, 0.0f, params.mTextShadowColor);
@ -445,6 +497,8 @@ public class KeyboardView extends View {
if (hintLabel != null && mShowsHints) { if (hintLabel != null && mShowsHints) {
paint.setTextSize(key.selectHintTextSize(params)); paint.setTextSize(key.selectHintTextSize(params));
paint.setColor(key.selectHintTextColor(params)); paint.setColor(key.selectHintTextColor(params));
if (mUserTheme)
paint.setColorFilter(keyHintTextColorFilter);
// TODO: Should add a way to specify type face for hint letters // TODO: Should add a way to specify type face for hint letters
paint.setTypeface(Typeface.DEFAULT_BOLD); paint.setTypeface(Typeface.DEFAULT_BOLD);
blendAlpha(paint, params.mAnimAlpha); blendAlpha(paint, params.mAnimAlpha);
@ -497,6 +551,9 @@ public class KeyboardView extends View {
iconY = (keyHeight - iconHeight) / 2; // Align vertically center. iconY = (keyHeight - iconHeight) / 2; // Align vertically center.
} }
final int iconX = (keyWidth - iconWidth) / 2; // Align horizontally center. final int iconX = (keyWidth - iconWidth) / 2; // Align horizontally center.
if (mUserTheme && key.getBackgroundType() != Key.BACKGROUND_TYPE_NORMAL && !key.isActionKey() && !key.isShift())
// no color for shift (because of state indicator) and accent color keys (action and popup)
icon.setColorFilter(keyTextColorFilter);
drawIcon(canvas, icon, iconX, iconY, iconWidth, iconHeight); drawIcon(canvas, icon, iconX, iconY, iconWidth, iconHeight);
} }

View file

@ -1,6 +1,7 @@
package org.dslul.openboard.inputmethod.keyboard.clipboard package org.dslul.openboard.inputmethod.keyboard.clipboard
import android.content.Context import android.content.Context
import android.graphics.Color
import android.util.AttributeSet import android.util.AttributeSet
import android.util.TypedValue import android.util.TypedValue
import android.view.MotionEvent import android.view.MotionEvent
@ -9,6 +10,8 @@ import android.widget.FrameLayout
import android.widget.ImageButton import android.widget.ImageButton
import android.widget.LinearLayout import android.widget.LinearLayout
import android.widget.TextView import android.widget.TextView
import androidx.core.graphics.BlendModeColorFilterCompat
import androidx.core.graphics.BlendModeCompat
import androidx.recyclerview.widget.StaggeredGridLayoutManager import androidx.recyclerview.widget.StaggeredGridLayoutManager
import org.dslul.openboard.inputmethod.keyboard.KeyboardActionListener import org.dslul.openboard.inputmethod.keyboard.KeyboardActionListener
import org.dslul.openboard.inputmethod.keyboard.internal.KeyDrawParams import org.dslul.openboard.inputmethod.keyboard.internal.KeyDrawParams
@ -17,6 +20,7 @@ import org.dslul.openboard.inputmethod.keyboard.internal.KeyboardIconsSet
import org.dslul.openboard.inputmethod.latin.ClipboardHistoryManager import org.dslul.openboard.inputmethod.latin.ClipboardHistoryManager
import org.dslul.openboard.inputmethod.latin.R import org.dslul.openboard.inputmethod.latin.R
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.utils.ResourceUtils import org.dslul.openboard.inputmethod.latin.utils.ResourceUtils
class ClipboardHistoryView @JvmOverloads constructor( class ClipboardHistoryView @JvmOverloads constructor(
@ -89,16 +93,22 @@ class ClipboardHistoryView @JvmOverloads constructor(
findViewById<FrameLayout>(R.id.clipboard_action_bar)?.apply { findViewById<FrameLayout>(R.id.clipboard_action_bar)?.apply {
clipboardLayoutParams.setActionBarProperties(this) clipboardLayoutParams.setActionBarProperties(this)
} }
val cf = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(Color.CYAN, BlendModeCompat.MODULATE)
val settingsValues = Settings.getInstance().current
alphabetKey = findViewById<TextView>(R.id.clipboard_keyboard_alphabet).apply { alphabetKey = findViewById<TextView>(R.id.clipboard_keyboard_alphabet).apply {
tag = Constants.CODE_ALPHA_FROM_CLIPBOARD tag = Constants.CODE_ALPHA_FROM_CLIPBOARD
setBackgroundResource(functionalKeyBackgroundId) setBackgroundResource(functionalKeyBackgroundId)
setOnTouchListener(this@ClipboardHistoryView) setOnTouchListener(this@ClipboardHistoryView)
setOnClickListener(this@ClipboardHistoryView) setOnClickListener(this@ClipboardHistoryView)
background.colorFilter = settingsValues.mKeyBackgroundColorFilter
setTextColor(settingsValues.mKeyTextColor)
} }
clearKey = findViewById<ImageButton>(R.id.clipboard_clear).apply { clearKey = findViewById<ImageButton>(R.id.clipboard_clear).apply {
setOnTouchListener(this@ClipboardHistoryView) setOnTouchListener(this@ClipboardHistoryView)
setOnClickListener(this@ClipboardHistoryView) setOnClickListener(this@ClipboardHistoryView)
colorFilter = settingsValues.mKeyTextColorFilter
} }
background.colorFilter = settingsValues.mBackgroundColorFilter
} }
private fun setupAlphabetKey(key: TextView?, label: String, params: KeyDrawParams) { private fun setupAlphabetKey(key: TextView?, label: String, params: KeyDrawParams) {

View file

@ -20,6 +20,7 @@ import android.content.Context;
import android.content.res.Resources; import android.content.res.Resources;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.ColorFilter;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -34,6 +35,8 @@ import android.widget.TabWidget;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.graphics.BlendModeColorFilterCompat;
import androidx.core.graphics.BlendModeCompat;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import org.dslul.openboard.inputmethod.compat.TabHostCompat; import org.dslul.openboard.inputmethod.compat.TabHostCompat;
@ -262,6 +265,11 @@ public final class EmojiPalettesView extends LinearLayout
mSpacebar.setTag(Constants.CODE_SPACE); mSpacebar.setTag(Constants.CODE_SPACE);
mSpacebar.setOnTouchListener(this); mSpacebar.setOnTouchListener(this);
mSpacebar.setOnClickListener(this); mSpacebar.setOnClickListener(this);
final ColorFilter cf = Settings.getInstance().getCurrent().mKeyBackgroundColorFilter;
mAlphabetKeyLeft.getBackground().setColorFilter(cf);
mAlphabetKeyLeft.setTextColor(Settings.getInstance().getCurrent().mKeyTextColor);
mSpacebar.getBackground().setColorFilter(cf);
mDeleteKey.getBackground().setColorFilter(cf);
mEmojiLayoutParams.setKeyProperties(mSpacebar); mEmojiLayoutParams.setKeyProperties(mSpacebar);
mSpacebarIcon = findViewById(R.id.emoji_keyboard_space_icon); mSpacebarIcon = findViewById(R.id.emoji_keyboard_space_icon);
} }

View file

@ -28,6 +28,8 @@ import org.dslul.openboard.inputmethod.keyboard.PointerTracker;
import org.dslul.openboard.inputmethod.latin.R; import org.dslul.openboard.inputmethod.latin.R;
import org.dslul.openboard.inputmethod.latin.SuggestedWords; import org.dslul.openboard.inputmethod.latin.SuggestedWords;
import org.dslul.openboard.inputmethod.latin.common.CoordinateUtils; import org.dslul.openboard.inputmethod.latin.common.CoordinateUtils;
import org.dslul.openboard.inputmethod.latin.settings.Settings;
import org.dslul.openboard.inputmethod.latin.settings.SettingsValues;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
@ -60,13 +62,14 @@ public class GestureFloatingTextDrawingPreview extends AbstractDrawingPreview {
private static final char[] TEXT_HEIGHT_REFERENCE_CHAR = { 'M' }; private static final char[] TEXT_HEIGHT_REFERENCE_CHAR = { 'M' };
public GesturePreviewTextParams(final TypedArray mainKeyboardViewAttr) { public GesturePreviewTextParams(final TypedArray mainKeyboardViewAttr) {
final SettingsValues sv = Settings.getInstance().getCurrent();
mGesturePreviewTextSize = mainKeyboardViewAttr.getDimensionPixelSize( mGesturePreviewTextSize = mainKeyboardViewAttr.getDimensionPixelSize(
R.styleable.MainKeyboardView_gestureFloatingPreviewTextSize, 0); R.styleable.MainKeyboardView_gestureFloatingPreviewTextSize, 0);
mGesturePreviewTextColor = mainKeyboardViewAttr.getColor( mGesturePreviewTextColor = sv.mUserTheme ? sv.mKeyTextColor : mainKeyboardViewAttr.getColor(
R.styleable.MainKeyboardView_gestureFloatingPreviewTextColor, 0); R.styleable.MainKeyboardView_gestureFloatingPreviewTextColor, 0);
mGesturePreviewTextOffset = mainKeyboardViewAttr.getDimensionPixelOffset( mGesturePreviewTextOffset = mainKeyboardViewAttr.getDimensionPixelOffset(
R.styleable.MainKeyboardView_gestureFloatingPreviewTextOffset, 0); R.styleable.MainKeyboardView_gestureFloatingPreviewTextOffset, 0);
mGesturePreviewColor = mainKeyboardViewAttr.getColor( mGesturePreviewColor = sv.mUserTheme ? sv.mBackgroundColor : mainKeyboardViewAttr.getColor(
R.styleable.MainKeyboardView_gestureFloatingPreviewColor, 0); R.styleable.MainKeyboardView_gestureFloatingPreviewColor, 0);
mGesturePreviewHorizontalPadding = mainKeyboardViewAttr.getDimension( mGesturePreviewHorizontalPadding = mainKeyboardViewAttr.getDimension(
R.styleable.MainKeyboardView_gestureFloatingPreviewHorizontalPadding, 0.0f); R.styleable.MainKeyboardView_gestureFloatingPreviewHorizontalPadding, 0.0f);

View file

@ -19,6 +19,8 @@ package org.dslul.openboard.inputmethod.keyboard.internal;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import org.dslul.openboard.inputmethod.latin.R; import org.dslul.openboard.inputmethod.latin.R;
import org.dslul.openboard.inputmethod.latin.settings.Settings;
import org.dslul.openboard.inputmethod.latin.settings.SettingsValues;
/** /**
* This class holds parameters to control how a gesture trail is drawn and animated on the screen. * This class holds parameters to control how a gesture trail is drawn and animated on the screen.
@ -50,7 +52,8 @@ final class GestureTrailDrawingParams {
public final int mTrailLingerDuration; public final int mTrailLingerDuration;
public GestureTrailDrawingParams(final TypedArray mainKeyboardViewAttr) { public GestureTrailDrawingParams(final TypedArray mainKeyboardViewAttr) {
mTrailColor = mainKeyboardViewAttr.getColor( final SettingsValues sv = Settings.getInstance().getCurrent();
mTrailColor = sv.mUserTheme ? sv.mUserThemeColorAccent : mainKeyboardViewAttr.getColor(
R.styleable.MainKeyboardView_gestureTrailColor, 0); R.styleable.MainKeyboardView_gestureTrailColor, 0);
mTrailStartWidth = mainKeyboardViewAttr.getDimension( mTrailStartWidth = mainKeyboardViewAttr.getDimension(
R.styleable.MainKeyboardView_gestureTrailStartWidth, 0.0f); R.styleable.MainKeyboardView_gestureTrailStartWidth, 0.0f);

View file

@ -20,8 +20,13 @@ import android.content.Context;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import androidx.core.graphics.BlendModeColorFilterCompat;
import androidx.core.graphics.BlendModeCompat;
import org.dslul.openboard.inputmethod.keyboard.Key; import org.dslul.openboard.inputmethod.keyboard.Key;
import org.dslul.openboard.inputmethod.latin.common.CoordinateUtils; import org.dslul.openboard.inputmethod.latin.common.CoordinateUtils;
import org.dslul.openboard.inputmethod.latin.settings.Settings;
import org.dslul.openboard.inputmethod.latin.settings.SettingsValues;
import org.dslul.openboard.inputmethod.latin.utils.ViewLayoutUtils; import org.dslul.openboard.inputmethod.latin.utils.ViewLayoutUtils;
import java.util.ArrayDeque; import java.util.ArrayDeque;
@ -117,6 +122,11 @@ public final class KeyPreviewChoreographer {
} }
final boolean hasMoreKeys = (key.getMoreKeys() != null); final boolean hasMoreKeys = (key.getMoreKeys() != null);
keyPreviewView.setPreviewBackground(hasMoreKeys, keyPreviewPosition); keyPreviewView.setPreviewBackground(hasMoreKeys, keyPreviewPosition);
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
if (settingsValues.mUserTheme) {
keyPreviewView.getBackground().setColorFilter(settingsValues.mBackgroundColorFilter);
keyPreviewView.setTextColor(settingsValues.mKeyTextColor);
}
// The key preview is placed vertically above the top edge of the parent key with an // The key preview is placed vertically above the top edge of the parent key with an
// arbitrary offset. // arbitrary offset.
final int previewY = key.getY() - previewHeight + key.getHeight() - mParams.mPreviewOffset final int previewY = key.getY() - previewHeight + key.getHeight() - mParams.mPreviewOffset

View file

@ -15,6 +15,7 @@
*/ */
package org.dslul.openboard.inputmethod.latin.settings package org.dslul.openboard.inputmethod.latin.settings
import android.app.AlertDialog
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.preference.ListPreference import android.preference.ListPreference
@ -38,6 +39,7 @@ class AppearanceSettingsFragment : SubScreenFragment(), Preference.OnPreferenceC
private lateinit var keyBordersPref: TwoStatePreference private lateinit var keyBordersPref: TwoStatePreference
private lateinit var amoledModePref: TwoStatePreference private lateinit var amoledModePref: TwoStatePreference
private var dayNightPref: TwoStatePreference? = null private var dayNightPref: TwoStatePreference? = null
private lateinit var userColorsPref: Preference
override fun onCreate(icicle: Bundle?) { override fun onCreate(icicle: Bundle?) {
@ -112,12 +114,16 @@ class AppearanceSettingsFragment : SubScreenFragment(), Preference.OnPreferenceC
amoledModePref.apply { amoledModePref.apply {
isEnabled = !isLegacyFamily && variant != KeyboardTheme.THEME_VARIANT_LIGHT isEnabled = !isLegacyFamily && variant != KeyboardTheme.THEME_VARIANT_LIGHT
&& !KeyboardTheme.getHasKeyBorders(selectedThemeId) && !KeyboardTheme.getHasKeyBorders(selectedThemeId)
&& !KeyboardTheme.getIsUser(selectedThemeId)
isChecked = !isLegacyFamily && KeyboardTheme.getIsAmoledMode(selectedThemeId) isChecked = !isLegacyFamily && KeyboardTheme.getIsAmoledMode(selectedThemeId)
} }
dayNightPref?.apply { dayNightPref?.apply {
isEnabled = !isLegacyFamily isEnabled = !isLegacyFamily
isChecked = !isLegacyFamily && KeyboardTheme.getIsDayNight(selectedThemeId) isChecked = !isLegacyFamily && KeyboardTheme.getIsDayNight(selectedThemeId)
} }
userColorsPref.apply {
isEnabled = KeyboardTheme.getIsUser(selectedThemeId)
}
} }
private fun setupTheme() { private fun setupTheme() {
@ -159,6 +165,29 @@ class AppearanceSettingsFragment : SubScreenFragment(), Preference.OnPreferenceC
updateThemePreferencesState(skipThemeFamily = true) updateThemePreferencesState(skipThemeFamily = true)
true true
} }
userColorsPref = preferenceScreen.findPreference(Settings.PREF_THEME_USER)
userColorsPref.onPreferenceClickListener = Preference.OnPreferenceClickListener { _ ->
val items = listOf(R.string.select_color_background, R.string.select_color_key, R.string.select_color_key_hint, R.string.select_color_accent, R.string.select_color_key_background)
.map { activity.getString(it) }
val itemsArray = if (keyBordersPref.isChecked) items.toTypedArray()
else items.subList(0, 4).toTypedArray()
AlertDialog.Builder(activity)
.setPositiveButton(android.R.string.ok, null)
.setTitle(R.string.select_color_to_adjust)
.setItems(itemsArray) { _, i ->
val pref = when (i) {
0 -> Settings.PREF_THEME_USER_COLOR_BACKGROUND
1 -> Settings.PREF_THEME_USER_COLOR_TEXT
2 -> Settings.PREF_THEME_USER_COLOR_HINT_TEXT
3 -> Settings.PREF_THEME_USER_COLOR_ACCENT
else -> Settings.PREF_THEME_USER_COLOR_KEYS
}
val d = ColorPickerDialog(activity, sharedPreferences, pref)
d.show()
}
.show()
true
}
} }
private fun setupKeyboardHeight(prefKey: String, defaultValue: Float) { private fun setupKeyboardHeight(prefKey: String, defaultValue: Float) {

View file

@ -0,0 +1,123 @@
/*
* Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// adapted from https://github.com/rkkr/simple-keyboard/blob/master/app/src/main/java/rkr/simplekeyboard/inputmethod/latin/settings/ColorDialogPreference.java
package org.dslul.openboard.inputmethod.latin.settings;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.view.View;
import android.widget.SeekBar;
import android.widget.TextView;
import org.dslul.openboard.inputmethod.latin.R;
public class ColorPickerDialog extends AlertDialog implements SeekBar.OnSeekBarChangeListener {
protected ColorPickerDialog(Context context, SharedPreferences prefs, String colorPref) {
super(context);
setTitle("bla");
View view = getLayoutInflater().inflate(R.layout.color_dialog, null);
mSeekBarRed = (SeekBar)view.findViewById(R.id.seek_bar_dialog_bar_red);
mSeekBarRed.setMax(255);
mSeekBarRed.setOnSeekBarChangeListener(this);
mSeekBarRed.getProgressDrawable().setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN);
mSeekBarRed.getThumb().setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN);
mSeekBarGreen = (SeekBar)view.findViewById(R.id.seek_bar_dialog_bar_green);
mSeekBarGreen.setMax(255);
mSeekBarGreen.setOnSeekBarChangeListener(this);
mSeekBarGreen.getThumb().setColorFilter(Color.GREEN, PorterDuff.Mode.SRC_IN);
mSeekBarGreen.getProgressDrawable().setColorFilter(Color.GREEN, PorterDuff.Mode.SRC_IN);
mSeekBarBlue = (SeekBar)view.findViewById(R.id.seek_bar_dialog_bar_blue);
mSeekBarBlue.setMax(255);
mSeekBarBlue.setOnSeekBarChangeListener(this);
mSeekBarBlue.getThumb().setColorFilter(Color.BLUE, PorterDuff.Mode.SRC_IN);
mSeekBarBlue.getProgressDrawable().setColorFilter(Color.BLUE, PorterDuff.Mode.SRC_IN);
mValueView = (TextView)view.findViewById(R.id.seek_bar_dialog_value);
setView(view);
// init with correct values
// using onShowListener?
setOnShowListener(new OnShowListener() {
@Override
public void onShow(DialogInterface dialogInterface) {
int color = prefs.getInt(colorPref, 0);
mSeekBarRed.setProgress(Color.red(color));
mSeekBarGreen.setProgress(Color.green(color));
mSeekBarBlue.setProgress(Color.blue(color));
setHeaderText(color);
}
});
// set on ok and on cancel listeners
setButton(BUTTON_NEGATIVE, context.getText(android.R.string.cancel), new OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dismiss();
}
});
setButton(BUTTON_POSITIVE, context.getText(android.R.string.ok), new OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
final int value = Color.rgb(
mSeekBarRed.getProgress(),
mSeekBarGreen.getProgress(),
mSeekBarBlue.getProgress());
prefs.edit().putInt(colorPref, value).apply();
dismiss();
}
});
}
private TextView mValueView;
private SeekBar mSeekBarRed;
private SeekBar mSeekBarGreen;
private SeekBar mSeekBarBlue;
@Override
public void onProgressChanged(final SeekBar seekBar, final int progress, final boolean fromUser) {
int color = Color.rgb(
mSeekBarRed.getProgress(),
mSeekBarGreen.getProgress(),
mSeekBarBlue.getProgress());
setHeaderText(color);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
private void setHeaderText(int color) {
mValueView.setText(getValueText(color));
boolean bright = Color.red(color) + Color.green(color) + Color.blue(color) > 128 * 3;
mValueView.setTextColor(bright ? Color.BLACK : Color.WHITE);
mValueView.setBackgroundColor(color);
}
private String getValueText(final int value) {
String temp = Integer.toHexString(value);
for (; temp.length() < 8; temp = "0" + temp);
return temp.substring(2).toUpperCase();
}
}

View file

@ -63,6 +63,12 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
public static final String PREF_THEME_KEY_BORDERS = "theme_key_borders"; public static final String PREF_THEME_KEY_BORDERS = "theme_key_borders";
public static final String PREF_THEME_DAY_NIGHT = "theme_auto_day_night"; public static final String PREF_THEME_DAY_NIGHT = "theme_auto_day_night";
public static final String PREF_THEME_AMOLED_MODE = "theme_amoled_mode"; public static final String PREF_THEME_AMOLED_MODE = "theme_amoled_mode";
public static final String PREF_THEME_USER = "theme_select_colors";
public static final String PREF_THEME_USER_COLOR_TEXT = "theme_color_text";
public static final String PREF_THEME_USER_COLOR_HINT_TEXT = "theme_color_hint_text";
public static final String PREF_THEME_USER_COLOR_BACKGROUND = "theme_color_background";
public static final String PREF_THEME_USER_COLOR_KEYS = "theme_color_keys";
public static final String PREF_THEME_USER_COLOR_ACCENT = "theme_color_accent";
// PREF_VOICE_MODE_OBSOLETE is obsolete. Use PREF_VOICE_INPUT_KEY instead. // PREF_VOICE_MODE_OBSOLETE is obsolete. Use PREF_VOICE_INPUT_KEY instead.
public static final String PREF_VOICE_MODE_OBSOLETE = "voice_mode"; public static final String PREF_VOICE_MODE_OBSOLETE = "voice_mode";
public static final String PREF_VOICE_INPUT_KEY = "pref_voice_input_key"; public static final String PREF_VOICE_INPUT_KEY = "pref_voice_input_key";

View file

@ -21,10 +21,16 @@ import android.content.SharedPreferences;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.util.Log; import android.util.Log;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
import androidx.core.graphics.BlendModeColorFilterCompat;
import androidx.core.graphics.BlendModeCompat;
import org.dslul.openboard.inputmethod.compat.AppWorkaroundsUtils; import org.dslul.openboard.inputmethod.compat.AppWorkaroundsUtils;
import org.dslul.openboard.inputmethod.keyboard.KeyboardTheme;
import org.dslul.openboard.inputmethod.latin.InputAttributes; import org.dslul.openboard.inputmethod.latin.InputAttributes;
import org.dslul.openboard.inputmethod.latin.R; import org.dslul.openboard.inputmethod.latin.R;
import org.dslul.openboard.inputmethod.latin.RichInputMethodManager; import org.dslul.openboard.inputmethod.latin.RichInputMethodManager;
@ -118,6 +124,16 @@ public class SettingsValues {
public final boolean mIncognitoModeEnabled; public final boolean mIncognitoModeEnabled;
private final AsyncResultHolder<AppWorkaroundsUtils> mAppWorkarounds; private final AsyncResultHolder<AppWorkaroundsUtils> mAppWorkarounds;
// User-defined colors
public boolean mUserTheme;
public final ColorFilter mKeyBackgroundColorFilter;
public final int mBackgroundColor;
public final ColorFilter mBackgroundColorFilter;
public final ColorFilter mKeyTextColorFilter;
public final ColorFilter mHintTextColorFilter;
public final int mUserThemeColorAccent;
public final int mKeyTextColor;
// Debug settings // Debug settings
public final boolean mIsInternal; public final boolean mIsInternal;
public final boolean mHasCustomKeyPreviewAnimationParams; public final boolean mHasCustomKeyPreviewAnimationParams;
@ -243,6 +259,25 @@ public class SettingsValues {
mOneHandedModeEnabled = Settings.readOneHandedModeEnabled(prefs); mOneHandedModeEnabled = Settings.readOneHandedModeEnabled(prefs);
mOneHandedModeGravity = Settings.readOneHandedModeGravity(prefs); mOneHandedModeGravity = Settings.readOneHandedModeGravity(prefs);
mSecondaryLocale = Settings.getSecondaryLocale(prefs, RichInputMethodManager.getInstance().getCurrentSubtypeLocale().toString()); mSecondaryLocale = Settings.getSecondaryLocale(prefs, RichInputMethodManager.getInstance().getCurrentSubtypeLocale().toString());
mUserTheme = KeyboardTheme.getIsUser(KeyboardTheme.getThemeForParameters(
prefs.getString(Settings.PREF_THEME_FAMILY, ""),
prefs.getString(Settings.PREF_THEME_VARIANT, ""),
prefs.getBoolean(Settings.PREF_THEME_KEY_BORDERS, false),
prefs.getBoolean(Settings.PREF_THEME_DAY_NIGHT, false),
prefs.getBoolean(Settings.PREF_THEME_AMOLED_MODE, false)
));
mUserThemeColorAccent = prefs.getInt(Settings.PREF_THEME_USER_COLOR_ACCENT, Color.BLUE);
final int keyBgColor;
if (prefs.getBoolean(Settings.PREF_THEME_KEY_BORDERS, false))
keyBgColor = prefs.getInt(Settings.PREF_THEME_USER_COLOR_KEYS, Color.LTGRAY);
else
keyBgColor = prefs.getInt(Settings.PREF_THEME_USER_COLOR_BACKGROUND, Color.DKGRAY);
mKeyBackgroundColorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(keyBgColor, BlendModeCompat.MODULATE);
mHintTextColorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(prefs.getInt(Settings.PREF_THEME_USER_COLOR_HINT_TEXT, Color.WHITE), BlendModeCompat.SRC_ATOP);
mKeyTextColor = prefs.getInt(Settings.PREF_THEME_USER_COLOR_TEXT, Color.WHITE);
mKeyTextColorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(mKeyTextColor, BlendModeCompat.SRC_ATOP);
mBackgroundColor = prefs.getInt(Settings.PREF_THEME_USER_COLOR_BACKGROUND, Color.DKGRAY);
mBackgroundColorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(mBackgroundColor, BlendModeCompat.MODULATE);
} }
public boolean isMetricsLoggingEnabled() { public boolean isMetricsLoggingEnabled() {

View file

@ -508,6 +508,10 @@ final class SuggestionStripLayoutHelper {
// {@link SuggestionStripView#onClick(View)}. // {@link SuggestionStripView#onClick(View)}.
wordView.setTag(indexInSuggestedWords); wordView.setTag(indexInSuggestedWords);
wordView.setText(getStyledSuggestedWord(suggestedWords, indexInSuggestedWords)); wordView.setText(getStyledSuggestedWord(suggestedWords, indexInSuggestedWords));
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
if (settingsValues.mUserTheme)
wordView.setTextColor(settingsValues.mKeyTextColor);
else
wordView.setTextColor(getSuggestionTextColor(suggestedWords, indexInSuggestedWords)); wordView.setTextColor(getSuggestionTextColor(suggestedWords, indexInSuggestedWords));
if (SuggestionStripView.DBG) { if (SuggestionStripView.DBG) {
mDebugInfoViews.get(positionInStrip).setText( mDebugInfoViews.get(positionInStrip).setText(

View file

@ -40,7 +40,6 @@ import android.widget.TextView;
import org.dslul.openboard.inputmethod.accessibility.AccessibilityUtils; import org.dslul.openboard.inputmethod.accessibility.AccessibilityUtils;
import org.dslul.openboard.inputmethod.keyboard.Keyboard; import org.dslul.openboard.inputmethod.keyboard.Keyboard;
import org.dslul.openboard.inputmethod.keyboard.KeyboardSwitcher;
import org.dslul.openboard.inputmethod.keyboard.MainKeyboardView; import org.dslul.openboard.inputmethod.keyboard.MainKeyboardView;
import org.dslul.openboard.inputmethod.keyboard.MoreKeysPanel; import org.dslul.openboard.inputmethod.keyboard.MoreKeysPanel;
import org.dslul.openboard.inputmethod.latin.AudioAndHapticFeedbackManager; import org.dslul.openboard.inputmethod.latin.AudioAndHapticFeedbackManager;
@ -177,6 +176,10 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
mClipboardKey.setOnLongClickListener(this); mClipboardKey.setOnLongClickListener(this);
mOtherKey.setImageDrawable(iconIncognito); mOtherKey.setImageDrawable(iconIncognito);
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
if (settingsValues.mUserTheme)
mStripVisibilityGroup.mSuggestionStripView.getBackground().setColorFilter(settingsValues.mBackgroundColorFilter);
} }
/** /**

View file

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 2012, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_margin="10dp">
<TextView android:id="@+id/seek_bar_dialog_value"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textSize="20sp"/>
</LinearLayout>
<SeekBar
android:id="@+id/seek_bar_dialog_bar_red"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"/>
<SeekBar
android:id="@+id/seek_bar_dialog_bar_green"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"/>
<SeekBar
android:id="@+id/seek_bar_dialog_bar_blue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"/>
</LinearLayout>

View file

@ -245,6 +245,9 @@
<enum name="LXXLightBorder" value="5" /> <enum name="LXXLightBorder" value="5" />
<enum name="LXXDarkBorder" value="6" /> <enum name="LXXDarkBorder" value="6" />
<enum name="LXXAutoBorder" value="8" /> <enum name="LXXAutoBorder" value="8" />
<enum name="LXXUser" value="11" />
<enum name="LXXUserBorder" value="12" />
<enum name="KLPUser" value="13" />
</attr> </attr>
<!-- Touch position correction --> <!-- Touch position correction -->
<attr name="touchPositionCorrectionData" format="reference" /> <attr name="touchPositionCorrectionData" format="reference" />

View file

@ -638,4 +638,20 @@ disposition rather than other common dispositions for Latin languages. [CHAR LIM
<string name="amoled_mode">Deep black backgrounds</string> <string name="amoled_mode">Deep black backgrounds</string>
<!-- Description indicating amoled mode can lower power usage depending on the screen of the device. --> <!-- Description indicating amoled mode can lower power usage depending on the screen of the device. -->
<string name="amoled_mode_summary">Can reduce power usage depending on the devices screen technology</string> <string name="amoled_mode_summary">Can reduce power usage depending on the devices screen technology</string>
<!-- Option for selecting custom theme colors -->
<string name="select_user_colors">Adjust theme colors</string>
<!-- Description for selection of user-defined colors. -->
<string name="select_user_colors_summary">Select colors for text and background</string>
<!-- Dialog message when selecting color to adjust. -->
<string name="select_color_to_adjust">Select colors to adjust</string>
<!-- Selection: background color. -->
<string name="select_color_background">Keyboard background</string>
<!-- Selection: key text color. -->
<string name="select_color_key">Key text</string>
<!-- Selection: key hint text color. -->
<string name="select_color_key_hint">Key hint text</string>
<!-- Selection: key color. -->
<string name="select_color_key_background">Key background</string>
<!-- Selection: accent color. -->
<string name="select_color_accent">Accent</string>
</resources> </resources>

View file

@ -45,6 +45,11 @@
android:title="@string/amoled_mode" android:title="@string/amoled_mode"
android:summary="@string/amoled_mode_summary"/> android:summary="@string/amoled_mode_summary"/>
<Preference
android:key="theme_select_colors"
android:title="@string/select_user_colors"
android:summary="@string/select_user_colors_summary"/>
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory <PreferenceCategory