mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-14 14:02:44 +00:00
rename user theme to custom theme
This commit is contained in:
parent
6c75203dfc
commit
f61c76195d
12 changed files with 54 additions and 59 deletions
|
@ -552,7 +552,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
|
||||||
|
|
||||||
// set background color here, otherwise there is a narrow white line between keyboard and suggestion strip
|
// set background color here, otherwise there is a narrow white line between keyboard and suggestion strip
|
||||||
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
|
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
|
||||||
if (settingsValues.mUserTheme)
|
if (settingsValues.mCustomTheme)
|
||||||
mKeyboardViewWrapper.getBackground().setColorFilter(settingsValues.mBackgroundColorFilter);
|
mKeyboardViewWrapper.getBackground().setColorFilter(settingsValues.mBackgroundColorFilter);
|
||||||
|
|
||||||
return mCurrentInputView;
|
return mCurrentInputView;
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class KeyboardView extends View {
|
||||||
private final ColorFilter keyTextColorFilter;
|
private final ColorFilter keyTextColorFilter;
|
||||||
private final ColorFilter keyBgFilter;
|
private final ColorFilter keyBgFilter;
|
||||||
private final ColorFilter accentColorFilter;
|
private final ColorFilter accentColorFilter;
|
||||||
private final boolean mUserTheme;
|
private final boolean mCustomTheme;
|
||||||
|
|
||||||
// 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;
|
||||||
|
@ -180,14 +180,14 @@ public class KeyboardView extends View {
|
||||||
mPaint.setAntiAlias(true);
|
mPaint.setAntiAlias(true);
|
||||||
|
|
||||||
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
|
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
|
||||||
mUserTheme = settingsValues.mUserTheme;
|
mCustomTheme = settingsValues.mCustomTheme;
|
||||||
if (mUserTheme) {
|
if (mCustomTheme) {
|
||||||
getBackground().setColorFilter(settingsValues.mBackgroundColorFilter);
|
getBackground().setColorFilter(settingsValues.mBackgroundColorFilter);
|
||||||
|
|
||||||
keyBgFilter = settingsValues.mKeyBackgroundColorFilter;
|
keyBgFilter = settingsValues.mCustomKeyBackgroundColorFilter;
|
||||||
keyHintTextColorFilter = settingsValues.mHintTextColorFilter;
|
keyHintTextColorFilter = settingsValues.mCustomHintTextColorFilter;
|
||||||
keyTextColorFilter = settingsValues.mKeyTextColorFilter;
|
keyTextColorFilter = settingsValues.mCustomKeyTextColorFilter;
|
||||||
accentColorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(settingsValues.mUserThemeColorAccent, BlendModeCompat.SRC_ATOP);
|
accentColorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(settingsValues.mCustomThemeColorAccent, BlendModeCompat.SRC_ATOP);
|
||||||
} else {
|
} else {
|
||||||
keyHintTextColorFilter = null;
|
keyHintTextColorFilter = null;
|
||||||
keyTextColorFilter = null;
|
keyTextColorFilter = null;
|
||||||
|
@ -398,7 +398,7 @@ public class KeyboardView extends View {
|
||||||
bgX = -padding.left;
|
bgX = -padding.left;
|
||||||
bgY = -padding.top;
|
bgY = -padding.top;
|
||||||
}
|
}
|
||||||
if (mUserTheme) {
|
if (mCustomTheme) {
|
||||||
// color filter is applied to background, which is re-used
|
// color filter is applied to background, which is re-used
|
||||||
// but we don't want it applied to "blue" keys
|
// but we don't want it applied to "blue" keys
|
||||||
// so we always need to select the color filter dependent on the current key
|
// so we always need to select the color filter dependent on the current key
|
||||||
|
@ -461,7 +461,7 @@ public class KeyboardView extends View {
|
||||||
|
|
||||||
if (key.isEnabled()) {
|
if (key.isEnabled()) {
|
||||||
paint.setColor(key.selectTextColor(params));
|
paint.setColor(key.selectTextColor(params));
|
||||||
if (mUserTheme) {
|
if (mCustomTheme) {
|
||||||
// set key color only if not in emoji keyboard range
|
// set key color only if not in emoji keyboard range
|
||||||
if (keyboard != null
|
if (keyboard != null
|
||||||
&& (this.getClass() == MoreSuggestionsView.class ?
|
&& (this.getClass() == MoreSuggestionsView.class ?
|
||||||
|
@ -495,7 +495,7 @@ 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)
|
if (mCustomTheme)
|
||||||
paint.setColorFilter(keyHintTextColorFilter);
|
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);
|
||||||
|
@ -549,7 +549,7 @@ 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())
|
if (mCustomTheme && 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)
|
// no color for shift (because of state indicator) and accent color keys (action and popup)
|
||||||
icon.setColorFilter(keyTextColorFilter);
|
icon.setColorFilter(keyTextColorFilter);
|
||||||
drawIcon(canvas, icon, iconX, iconY, iconWidth, iconHeight);
|
drawIcon(canvas, icon, iconX, iconY, iconWidth, iconHeight);
|
||||||
|
|
|
@ -64,7 +64,7 @@ class ClipboardHistoryRecyclerView @JvmOverloads constructor(
|
||||||
paint.color = dividerColor
|
paint.color = dividerColor
|
||||||
paint.strokeWidth = dividerHeight.toFloat()
|
paint.strokeWidth = dividerHeight.toFloat()
|
||||||
val sv = Settings.getInstance().current
|
val sv = Settings.getInstance().current
|
||||||
if (sv.mUserTheme)
|
if (sv.mCustomTheme)
|
||||||
paint.colorFilter = sv.mBackgroundColorFilter
|
paint.colorFilter = sv.mBackgroundColorFilter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,10 +101,10 @@ class ClipboardHistoryView @JvmOverloads constructor(
|
||||||
setOnTouchListener(this@ClipboardHistoryView)
|
setOnTouchListener(this@ClipboardHistoryView)
|
||||||
setOnClickListener(this@ClipboardHistoryView)
|
setOnClickListener(this@ClipboardHistoryView)
|
||||||
}
|
}
|
||||||
if (settingsValues.mUserTheme) {
|
if (settingsValues.mCustomTheme) {
|
||||||
alphabetKey.background.colorFilter = settingsValues.mKeyBackgroundColorFilter
|
alphabetKey.background.colorFilter = settingsValues.mCustomKeyBackgroundColorFilter
|
||||||
alphabetKey.setTextColor(settingsValues.mKeyTextColor)
|
alphabetKey.setTextColor(settingsValues.mCustomKeyTextColor)
|
||||||
clearKey.colorFilter = settingsValues.mKeyTextColorFilter
|
clearKey.colorFilter = settingsValues.mCustomKeyTextColorFilter
|
||||||
background.colorFilter = settingsValues.mBackgroundColorFilter
|
background.colorFilter = settingsValues.mBackgroundColorFilter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,8 +114,8 @@ class ClipboardHistoryView @JvmOverloads constructor(
|
||||||
text = label
|
text = label
|
||||||
typeface = params.mTypeface
|
typeface = params.mTypeface
|
||||||
val settingsValues = Settings.getInstance().current
|
val settingsValues = Settings.getInstance().current
|
||||||
if (settingsValues.mUserTheme)
|
if (settingsValues.mCustomTheme)
|
||||||
setTextColor(settingsValues.mKeyTextColor)
|
setTextColor(settingsValues.mCustomKeyTextColor)
|
||||||
else
|
else
|
||||||
setTextColor(params.mFunctionalTextColor)
|
setTextColor(params.mFunctionalTextColor)
|
||||||
setTextSize(TypedValue.COMPLEX_UNIT_PX, params.mLabelSize.toFloat())
|
setTextSize(TypedValue.COMPLEX_UNIT_PX, params.mLabelSize.toFloat())
|
||||||
|
@ -127,9 +127,9 @@ class ClipboardHistoryView @JvmOverloads constructor(
|
||||||
itemBackgroundId = keyBackgroundId
|
itemBackgroundId = keyBackgroundId
|
||||||
itemTypeFace = params.mTypeface
|
itemTypeFace = params.mTypeface
|
||||||
val sv = Settings.getInstance().current
|
val sv = Settings.getInstance().current
|
||||||
if (sv.mUserTheme) {
|
if (sv.mCustomTheme) {
|
||||||
itemTextColor = sv.mKeyTextColor
|
itemTextColor = sv.mCustomKeyTextColor
|
||||||
itemBackgroundColorFilter = sv.mKeyBackgroundColorFilter
|
itemBackgroundColorFilter = sv.mCustomKeyBackgroundColorFilter
|
||||||
} else
|
} else
|
||||||
itemTextColor = params.mTextColor
|
itemTextColor = params.mTextColor
|
||||||
itemTextSize = params.mLabelSize.toFloat()
|
itemTextSize = params.mLabelSize.toFloat()
|
||||||
|
|
|
@ -35,8 +35,6 @@ 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;
|
||||||
|
@ -167,9 +165,9 @@ public final class EmojiPalettesView extends LinearLayout
|
||||||
// category page indicator background as a workaround.
|
// category page indicator background as a workaround.
|
||||||
iconView.setBackgroundColor(mCategoryPageIndicatorBackground);
|
iconView.setBackgroundColor(mCategoryPageIndicatorBackground);
|
||||||
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
|
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
|
||||||
if (settingsValues.mUserTheme) {
|
if (settingsValues.mCustomTheme) {
|
||||||
iconView.getBackground().setColorFilter(settingsValues.mBackgroundColorFilter);
|
iconView.getBackground().setColorFilter(settingsValues.mBackgroundColorFilter);
|
||||||
iconView.setColorFilter(settingsValues.mKeyTextColorFilter);
|
iconView.setColorFilter(settingsValues.mCustomKeyTextColorFilter);
|
||||||
}
|
}
|
||||||
iconView.setImageResource(mEmojiCategory.getCategoryTabIcon(categoryId));
|
iconView.setImageResource(mEmojiCategory.getCategoryTabIcon(categoryId));
|
||||||
iconView.setContentDescription(mEmojiCategory.getAccessibilityDescription(categoryId));
|
iconView.setContentDescription(mEmojiCategory.getAccessibilityDescription(categoryId));
|
||||||
|
@ -273,13 +271,13 @@ public final class EmojiPalettesView extends LinearLayout
|
||||||
mSpacebar.setOnTouchListener(this);
|
mSpacebar.setOnTouchListener(this);
|
||||||
mSpacebar.setOnClickListener(this);
|
mSpacebar.setOnClickListener(this);
|
||||||
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
|
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
|
||||||
if (settingsValues.mUserTheme) {
|
if (settingsValues.mCustomTheme) {
|
||||||
final ColorFilter cf = settingsValues.mKeyBackgroundColorFilter;
|
final ColorFilter cf = settingsValues.mCustomKeyBackgroundColorFilter;
|
||||||
mAlphabetKeyLeft.getBackground().setColorFilter(cf);
|
mAlphabetKeyLeft.getBackground().setColorFilter(cf);
|
||||||
mSpacebar.getBackground().setColorFilter(cf);
|
mSpacebar.getBackground().setColorFilter(cf);
|
||||||
mDeleteKey.getBackground().setColorFilter(cf);
|
mDeleteKey.getBackground().setColorFilter(cf);
|
||||||
getBackground().setColorFilter(cf);
|
getBackground().setColorFilter(cf);
|
||||||
mEmojiCategoryPageIndicatorView.setColors(settingsValues.mUserThemeColorAccent, settingsValues.mBackgroundColor);
|
mEmojiCategoryPageIndicatorView.setColors(settingsValues.mCustomThemeColorAccent, settingsValues.mBackgroundColor);
|
||||||
findViewById(R.id.emoji_tab_strip).getBackground().setColorFilter(cf);
|
findViewById(R.id.emoji_tab_strip).getBackground().setColorFilter(cf);
|
||||||
}
|
}
|
||||||
mEmojiLayoutParams.setKeyProperties(mSpacebar);
|
mEmojiLayoutParams.setKeyProperties(mSpacebar);
|
||||||
|
@ -304,11 +302,11 @@ public final class EmojiPalettesView extends LinearLayout
|
||||||
updateEmojiCategoryPageIdView();
|
updateEmojiCategoryPageIdView();
|
||||||
}
|
}
|
||||||
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
|
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
|
||||||
if (settingsValues.mUserTheme) {
|
if (settingsValues.mCustomTheme) {
|
||||||
if (mCurrentTab != null)
|
if (mCurrentTab != null)
|
||||||
mCurrentTab.setColorFilter(settingsValues.mKeyTextColorFilter);
|
mCurrentTab.setColorFilter(settingsValues.mCustomKeyTextColorFilter);
|
||||||
mCurrentTab = (ImageView) mTabHost.getCurrentTabView();
|
mCurrentTab = (ImageView) mTabHost.getCurrentTabView();
|
||||||
mCurrentTab.setColorFilter(settingsValues.mUserThemeColorAccent);
|
mCurrentTab.setColorFilter(settingsValues.mCustomThemeColorAccent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,8 +392,8 @@ public final class EmojiPalettesView extends LinearLayout
|
||||||
final KeyDrawParams params) {
|
final KeyDrawParams params) {
|
||||||
alphabetKey.setText(label);
|
alphabetKey.setText(label);
|
||||||
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
|
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
|
||||||
if (settingsValues.mUserTheme)
|
if (settingsValues.mCustomTheme)
|
||||||
alphabetKey.setTextColor(settingsValues.mKeyTextColor);
|
alphabetKey.setTextColor(settingsValues.mCustomKeyTextColor);
|
||||||
else
|
else
|
||||||
alphabetKey.setTextColor(params.mFunctionalTextColor);
|
alphabetKey.setTextColor(params.mFunctionalTextColor);
|
||||||
alphabetKey.setTextSize(TypedValue.COMPLEX_UNIT_PX, params.mLabelSize);
|
alphabetKey.setTextSize(TypedValue.COMPLEX_UNIT_PX, params.mLabelSize);
|
||||||
|
|
|
@ -65,11 +65,11 @@ public class GestureFloatingTextDrawingPreview extends AbstractDrawingPreview {
|
||||||
final SettingsValues sv = Settings.getInstance().getCurrent();
|
final SettingsValues sv = Settings.getInstance().getCurrent();
|
||||||
mGesturePreviewTextSize = mainKeyboardViewAttr.getDimensionPixelSize(
|
mGesturePreviewTextSize = mainKeyboardViewAttr.getDimensionPixelSize(
|
||||||
R.styleable.MainKeyboardView_gestureFloatingPreviewTextSize, 0);
|
R.styleable.MainKeyboardView_gestureFloatingPreviewTextSize, 0);
|
||||||
mGesturePreviewTextColor = sv.mUserTheme ? sv.mKeyTextColor : mainKeyboardViewAttr.getColor(
|
mGesturePreviewTextColor = sv.mCustomTheme ? sv.mCustomKeyTextColor : 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 = sv.mUserTheme ? sv.mBackgroundColor : mainKeyboardViewAttr.getColor(
|
mGesturePreviewColor = sv.mCustomTheme ? 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);
|
||||||
|
|
|
@ -53,7 +53,7 @@ final class GestureTrailDrawingParams {
|
||||||
|
|
||||||
public GestureTrailDrawingParams(final TypedArray mainKeyboardViewAttr) {
|
public GestureTrailDrawingParams(final TypedArray mainKeyboardViewAttr) {
|
||||||
final SettingsValues sv = Settings.getInstance().getCurrent();
|
final SettingsValues sv = Settings.getInstance().getCurrent();
|
||||||
mTrailColor = sv.mUserTheme ? sv.mUserThemeColorAccent : mainKeyboardViewAttr.getColor(
|
mTrailColor = sv.mCustomTheme ? sv.mCustomThemeColorAccent : 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);
|
||||||
|
|
|
@ -20,9 +20,6 @@ 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.Settings;
|
||||||
|
@ -123,9 +120,9 @@ 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();
|
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
|
||||||
if (settingsValues.mUserTheme) {
|
if (settingsValues.mCustomTheme) {
|
||||||
keyPreviewView.getBackground().setColorFilter(settingsValues.mBackgroundColorFilter);
|
keyPreviewView.getBackground().setColorFilter(settingsValues.mBackgroundColorFilter);
|
||||||
keyPreviewView.setTextColor(settingsValues.mKeyTextColor);
|
keyPreviewView.setTextColor(settingsValues.mCustomKeyTextColor);
|
||||||
}
|
}
|
||||||
// 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.
|
||||||
|
|
|
@ -2023,7 +2023,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP || !settingsValues.mNavBarColor)
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP || !settingsValues.mNavBarColor)
|
||||||
return;
|
return;
|
||||||
final int color;
|
final int color;
|
||||||
if (settingsValues.mUserTheme) {
|
if (settingsValues.mCustomTheme) {
|
||||||
final int c = settingsValues.mBackgroundColor;
|
final int c = settingsValues.mBackgroundColor;
|
||||||
// slightly adjust so color is same as keyboard background
|
// slightly adjust so color is same as keyboard background
|
||||||
color = Color.rgb((int) (Color.red(c) * 0.925), (int) (Color.green(c) * 0.9379), (int) (Color.blue(c) * 0.945));
|
color = Color.rgb((int) (Color.red(c) * 0.925), (int) (Color.green(c) * 0.9379), (int) (Color.blue(c) * 0.945));
|
||||||
|
|
|
@ -129,14 +129,14 @@ public class SettingsValues {
|
||||||
private final AsyncResultHolder<AppWorkaroundsUtils> mAppWorkarounds;
|
private final AsyncResultHolder<AppWorkaroundsUtils> mAppWorkarounds;
|
||||||
|
|
||||||
// User-defined colors
|
// User-defined colors
|
||||||
public final boolean mUserTheme;
|
public final boolean mCustomTheme;
|
||||||
public final ColorFilter mKeyBackgroundColorFilter;
|
public final ColorFilter mCustomKeyBackgroundColorFilter;
|
||||||
public final int mBackgroundColor;
|
public final int mBackgroundColor;
|
||||||
public final ColorFilter mBackgroundColorFilter;
|
public final ColorFilter mBackgroundColorFilter;
|
||||||
public final ColorFilter mKeyTextColorFilter;
|
public final ColorFilter mCustomKeyTextColorFilter;
|
||||||
public final ColorFilter mHintTextColorFilter;
|
public final ColorFilter mCustomHintTextColorFilter;
|
||||||
public final int mUserThemeColorAccent;
|
public final int mCustomThemeColorAccent;
|
||||||
public final int mKeyTextColor;
|
public final int mCustomKeyTextColor;
|
||||||
|
|
||||||
// Debug settings
|
// Debug settings
|
||||||
public final boolean mIsInternal;
|
public final boolean mIsInternal;
|
||||||
|
@ -271,18 +271,18 @@ public class SettingsValues {
|
||||||
prefs.getBoolean(Settings.PREF_THEME_DAY_NIGHT, false),
|
prefs.getBoolean(Settings.PREF_THEME_DAY_NIGHT, false),
|
||||||
prefs.getBoolean(Settings.PREF_THEME_AMOLED_MODE, false)
|
prefs.getBoolean(Settings.PREF_THEME_AMOLED_MODE, false)
|
||||||
);
|
);
|
||||||
mUserTheme = KeyboardTheme.getIsUser(keyboardThemeId);
|
mCustomTheme = KeyboardTheme.getIsUser(keyboardThemeId);
|
||||||
mUserThemeColorAccent = prefs.getInt(Settings.PREF_THEME_USER_COLOR_ACCENT, Color.BLUE);
|
mCustomThemeColorAccent = prefs.getInt(Settings.PREF_THEME_USER_COLOR_ACCENT, Color.BLUE);
|
||||||
final int keyBgColor;
|
final int keyBgColor;
|
||||||
if (prefs.getBoolean(Settings.PREF_THEME_KEY_BORDERS, false))
|
if (prefs.getBoolean(Settings.PREF_THEME_KEY_BORDERS, false))
|
||||||
keyBgColor = prefs.getInt(Settings.PREF_THEME_USER_COLOR_KEYS, Color.LTGRAY);
|
keyBgColor = prefs.getInt(Settings.PREF_THEME_USER_COLOR_KEYS, Color.LTGRAY);
|
||||||
else
|
else
|
||||||
keyBgColor = prefs.getInt(Settings.PREF_THEME_USER_COLOR_BACKGROUND, Color.DKGRAY);
|
keyBgColor = prefs.getInt(Settings.PREF_THEME_USER_COLOR_BACKGROUND, Color.DKGRAY);
|
||||||
mKeyBackgroundColorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(keyBgColor, BlendModeCompat.MODULATE);
|
mCustomKeyBackgroundColorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(keyBgColor, BlendModeCompat.MODULATE);
|
||||||
mHintTextColorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(prefs.getInt(Settings.PREF_THEME_USER_COLOR_HINT_TEXT, Color.WHITE), BlendModeCompat.SRC_ATOP);
|
mCustomHintTextColorFilter = 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);
|
mCustomKeyTextColor = prefs.getInt(Settings.PREF_THEME_USER_COLOR_TEXT, Color.WHITE);
|
||||||
mKeyTextColorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(mKeyTextColor, BlendModeCompat.SRC_ATOP);
|
mCustomKeyTextColorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(mCustomKeyTextColor, BlendModeCompat.SRC_ATOP);
|
||||||
if (mUserTheme) {
|
if (mCustomTheme) {
|
||||||
mBackgroundColor = prefs.getInt(Settings.PREF_THEME_USER_COLOR_BACKGROUND, Color.DKGRAY);
|
mBackgroundColor = prefs.getInt(Settings.PREF_THEME_USER_COLOR_BACKGROUND, Color.DKGRAY);
|
||||||
} else if (KeyboardTheme.THEME_VARIANT_LIGHT.equals(KeyboardTheme.getThemeVariant(keyboardThemeId))) {
|
} else if (KeyboardTheme.THEME_VARIANT_LIGHT.equals(KeyboardTheme.getThemeVariant(keyboardThemeId))) {
|
||||||
mBackgroundColor = Color.rgb(236, 239, 241);
|
mBackgroundColor = Color.rgb(236, 239, 241);
|
||||||
|
|
|
@ -509,8 +509,8 @@ final class SuggestionStripLayoutHelper {
|
||||||
wordView.setTag(indexInSuggestedWords);
|
wordView.setTag(indexInSuggestedWords);
|
||||||
wordView.setText(getStyledSuggestedWord(suggestedWords, indexInSuggestedWords));
|
wordView.setText(getStyledSuggestedWord(suggestedWords, indexInSuggestedWords));
|
||||||
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
|
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
|
||||||
if (settingsValues.mUserTheme)
|
if (settingsValues.mCustomTheme)
|
||||||
wordView.setTextColor(settingsValues.mKeyTextColor);
|
wordView.setTextColor(settingsValues.mCustomKeyTextColor);
|
||||||
else
|
else
|
||||||
wordView.setTextColor(getSuggestionTextColor(suggestedWords, indexInSuggestedWords));
|
wordView.setTextColor(getSuggestionTextColor(suggestedWords, indexInSuggestedWords));
|
||||||
if (SuggestionStripView.DBG) {
|
if (SuggestionStripView.DBG) {
|
||||||
|
|
|
@ -182,7 +182,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
||||||
mOtherKey.setImageDrawable(iconIncognito);
|
mOtherKey.setImageDrawable(iconIncognito);
|
||||||
|
|
||||||
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
|
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
|
||||||
if (settingsValues.mUserTheme)
|
if (settingsValues.mCustomTheme)
|
||||||
mStripVisibilityGroup.mSuggestionStripView.getBackground().setColorFilter(settingsValues.mBackgroundColorFilter);
|
mStripVisibilityGroup.mSuggestionStripView.getBackground().setColorFilter(settingsValues.mBackgroundColorFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue