mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-18 16:03:12 +00:00
make custom colors always active
This commit is contained in:
parent
61a73572b8
commit
ede5bf8f4f
17 changed files with 75 additions and 174 deletions
|
@ -40,7 +40,6 @@ import org.dslul.openboard.inputmethod.latin.LatinIME;
|
|||
import org.dslul.openboard.inputmethod.latin.R;
|
||||
import org.dslul.openboard.inputmethod.latin.RichInputMethodManager;
|
||||
import org.dslul.openboard.inputmethod.latin.WordComposer;
|
||||
import org.dslul.openboard.inputmethod.latin.common.Colors;
|
||||
import org.dslul.openboard.inputmethod.latin.define.ProductionFlags;
|
||||
import org.dslul.openboard.inputmethod.latin.settings.Settings;
|
||||
import org.dslul.openboard.inputmethod.latin.settings.SettingsValues;
|
||||
|
@ -571,9 +570,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
|
|||
mClipboardHistoryView.setKeyboardActionListener(mLatinIME);
|
||||
|
||||
// set background color here, otherwise there is a narrow white line between keyboard and suggestion strip
|
||||
final Colors colors = Settings.getInstance().getCurrent().mColors;
|
||||
if (colors.isCustom)
|
||||
mKeyboardViewWrapper.getBackground().setColorFilter(colors.backgroundFilter);
|
||||
mKeyboardViewWrapper.getBackground().setColorFilter(Settings.getInstance().getCurrent().mColors.backgroundFilter);
|
||||
|
||||
return mCurrentInputView;
|
||||
}
|
||||
|
|
|
@ -176,7 +176,6 @@ public class KeyboardView extends View {
|
|||
mPaint.setAntiAlias(true);
|
||||
|
||||
mColors = Settings.getInstance().getCurrent().mColors;
|
||||
if (mColors.isCustom) {
|
||||
final Class<?> c = this.getClass();
|
||||
if (c == MoreKeysKeyboardView.class) {
|
||||
mColors.setBackgroundColor(mKeyBackground, Colors.TYPE_ADJUSTED_BACKGROUND);
|
||||
|
@ -193,7 +192,6 @@ public class KeyboardView extends View {
|
|||
else
|
||||
getBackground().setColorFilter(mColors.backgroundFilter);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public KeyVisualAttributes getKeyVisualAttribute() {
|
||||
|
@ -446,9 +444,6 @@ public class KeyboardView extends View {
|
|||
}
|
||||
|
||||
if (key.isEnabled()) {
|
||||
if (mColors.isCustom)
|
||||
paint.setColor(mColors.keyText);
|
||||
else
|
||||
paint.setColor(key.selectTextColor(params));
|
||||
// Set a drop shadow for the text if the shadow radius is positive value.
|
||||
if (mKeyTextShadowRadius > 0.0f) {
|
||||
|
@ -472,9 +467,6 @@ public class KeyboardView extends View {
|
|||
final String hintLabel = key.getHintLabel();
|
||||
if (hintLabel != null && mShowsHints) {
|
||||
paint.setTextSize(key.selectHintTextSize(params));
|
||||
if (mColors.isCustom)
|
||||
paint.setColor(mColors.keyHintText);
|
||||
else
|
||||
paint.setColor(key.selectHintTextColor(params));
|
||||
// TODO: Should add a way to specify type face for hint letters
|
||||
paint.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
|
@ -528,10 +520,7 @@ public class KeyboardView extends View {
|
|||
iconY = (keyHeight - iconHeight) / 2; // Align vertically center.
|
||||
}
|
||||
final int iconX = (keyWidth - iconWidth) / 2; // Align horizontally center.
|
||||
if (mColors.isCustom)
|
||||
setCustomKeyIconColor(key, icon, keyboard);
|
||||
else
|
||||
icon.clearColorFilter();
|
||||
setKeyIconColor(key, icon, keyboard);
|
||||
drawIcon(canvas, icon, iconX, iconY, iconWidth, iconHeight);
|
||||
}
|
||||
|
||||
|
@ -620,7 +609,7 @@ public class KeyboardView extends View {
|
|||
freeOffscreenBuffer();
|
||||
}
|
||||
|
||||
private void setCustomKeyIconColor(Key key, Drawable icon, Keyboard keyboard) {
|
||||
private void setKeyIconColor(Key key, Drawable icon, Keyboard keyboard) {
|
||||
if (key.isAccentColored()) {
|
||||
icon.setColorFilter(mColors.actionKeyIconColorFilter);
|
||||
} else if (key.isShift() && keyboard != null) {
|
||||
|
|
|
@ -52,7 +52,6 @@ import org.dslul.openboard.inputmethod.keyboard.internal.TimerHandler;
|
|||
import org.dslul.openboard.inputmethod.latin.R;
|
||||
import org.dslul.openboard.inputmethod.latin.RichInputMethodSubtype;
|
||||
import org.dslul.openboard.inputmethod.latin.SuggestedWords;
|
||||
import org.dslul.openboard.inputmethod.latin.common.Colors;
|
||||
import org.dslul.openboard.inputmethod.latin.common.Constants;
|
||||
import org.dslul.openboard.inputmethod.latin.common.CoordinateUtils;
|
||||
import org.dslul.openboard.inputmethod.latin.settings.DebugSettings;
|
||||
|
@ -217,10 +216,7 @@ public final class MainKeyboardView extends KeyboardView implements DrawingProxy
|
|||
mBackgroundDimAlphaPaint.setAlpha(backgroundDimAlpha);
|
||||
mLanguageOnSpacebarTextRatio = mainKeyboardViewAttr.getFraction(
|
||||
R.styleable.MainKeyboardView_languageOnSpacebarTextRatio, 1, 1, 1.0f);
|
||||
final Colors colors = Settings.getInstance().getCurrent().mColors;
|
||||
mLanguageOnSpacebarTextColor = colors.isCustom
|
||||
? colors.keyHintText
|
||||
: mainKeyboardViewAttr.getColor(R.styleable.MainKeyboardView_languageOnSpacebarTextColor, 0);
|
||||
mLanguageOnSpacebarTextColor = Settings.getInstance().getCurrent().mColors.keyHintText; //mainKeyboardViewAttr.getColor(R.styleable.MainKeyboardView_languageOnSpacebarTextColor, 0);
|
||||
mLanguageOnSpacebarTextShadowRadius = mainKeyboardViewAttr.getFloat(
|
||||
R.styleable.MainKeyboardView_languageOnSpacebarTextShadowRadius,
|
||||
LANGUAGE_ON_SPACEBAR_TEXT_SHADOW_RADIUS_DISABLED);
|
||||
|
|
|
@ -55,10 +55,7 @@ class ClipboardAdapter(
|
|||
setOnTouchListener(this@ViewHolder)
|
||||
setOnLongClickListener(this@ViewHolder)
|
||||
setBackgroundResource(itemBackgroundId)
|
||||
val colors = Settings.getInstance().current.mColors
|
||||
if (colors.isCustom) {
|
||||
colors.setBackgroundColor(background, Colors.TYPE_KEY)
|
||||
}
|
||||
Settings.getInstance().current.mColors.setBackgroundColor(background, Colors.TYPE_KEY)
|
||||
}
|
||||
pinnedIconView = view.findViewById<ImageView>(R.id.clipboard_entry_pinned_icon).apply {
|
||||
visibility = View.GONE
|
||||
|
|
|
@ -63,9 +63,7 @@ class ClipboardHistoryRecyclerView @JvmOverloads constructor(
|
|||
init {
|
||||
paint.color = dividerColor
|
||||
paint.strokeWidth = dividerHeight.toFloat()
|
||||
val colors = Settings.getInstance().current.mColors
|
||||
if (colors.isCustom)
|
||||
paint.colorFilter = colors.backgroundFilter
|
||||
paint.colorFilter = Settings.getInstance().current.mColors.backgroundFilter
|
||||
}
|
||||
|
||||
override fun onDrawOver(canvas: Canvas, parent: RecyclerView, state: State) {
|
||||
|
|
|
@ -102,23 +102,15 @@ class ClipboardHistoryView @JvmOverloads constructor(
|
|||
setOnClickListener(this@ClipboardHistoryView)
|
||||
}
|
||||
val colors = Settings.getInstance().current.mColors
|
||||
if (colors.isCustom) {
|
||||
alphabetKey.background.colorFilter = colors.functionalKeyBackgroundFilter
|
||||
alphabetKey.setTextColor(colors.keyText)
|
||||
clearKey.colorFilter = colors.keyTextFilter
|
||||
background.colorFilter = colors.backgroundFilter
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupAlphabetKey(key: TextView?, label: String, params: KeyDrawParams) {
|
||||
key?.apply {
|
||||
text = label
|
||||
typeface = params.mTypeface
|
||||
val colors = Settings.getInstance().current.mColors
|
||||
if (colors.isCustom) {
|
||||
setTextColor(colors.keyText)
|
||||
colors.setBackgroundColor(this.background, Colors.TYPE_FUNCTIONAL)
|
||||
} else
|
||||
Settings.getInstance().current.mColors.setBackgroundColor(this.background, Colors.TYPE_FUNCTIONAL)
|
||||
setTextColor(params.mFunctionalTextColor)
|
||||
setTextSize(TypedValue.COMPLEX_UNIT_PX, params.mLabelSize.toFloat())
|
||||
}
|
||||
|
@ -128,11 +120,7 @@ class ClipboardHistoryView @JvmOverloads constructor(
|
|||
clipboardAdapter.apply {
|
||||
itemBackgroundId = keyBackgroundId
|
||||
itemTypeFace = params.mTypeface
|
||||
val colors = Settings.getInstance().current.mColors
|
||||
itemTextColor = if (colors.isCustom)
|
||||
colors.keyText
|
||||
else
|
||||
params.mTextColor
|
||||
itemTextColor = params.mTextColor
|
||||
itemTextSize = params.mLabelSize.toFloat()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@ import android.widget.TabWidget;
|
|||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import org.dslul.openboard.inputmethod.compat.TabHostCompat;
|
||||
|
@ -134,8 +133,7 @@ public final class EmojiPalettesView extends LinearLayout
|
|||
R.styleable.EmojiPalettesView_categoryIndicatorBackground, 0);
|
||||
mCategoryPageIndicatorColor = emojiPalettesViewAttr.getColor(
|
||||
R.styleable.EmojiPalettesView_categoryPageIndicatorColor, 0);
|
||||
mCategoryPageIndicatorBackground = emojiPalettesViewAttr.getColor(
|
||||
R.styleable.EmojiPalettesView_categoryPageIndicatorBackground, 0);
|
||||
mCategoryPageIndicatorBackground = Settings.getInstance().getCurrent().mColors.adjustedBackground; //emojiPalettesViewAttr.getColor(R.styleable.EmojiPalettesView_categoryPageIndicatorBackground, 0);
|
||||
emojiPalettesViewAttr.recycle();
|
||||
mDeleteKeyOnTouchListener = new DeleteKeyOnTouchListener();
|
||||
mEmojiLayoutManager = new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false);
|
||||
|
@ -163,11 +161,7 @@ public final class EmojiPalettesView extends LinearLayout
|
|||
// TODO: Replace background color with its own setting rather than using the
|
||||
// category page indicator background as a workaround.
|
||||
iconView.setBackgroundColor(mCategoryPageIndicatorBackground);
|
||||
final Colors colors = Settings.getInstance().getCurrent().mColors;
|
||||
if (colors.isCustom) {
|
||||
iconView.getBackground().setColorFilter(colors.adjustedBackgroundFilter);
|
||||
iconView.setColorFilter(colors.keyTextFilter);
|
||||
}
|
||||
iconView.setColorFilter(Settings.getInstance().getCurrent().mColors.keyTextFilter);
|
||||
iconView.setImageResource(mEmojiCategory.getCategoryTabIcon(categoryId));
|
||||
iconView.setContentDescription(mEmojiCategory.getAccessibilityDescription(categoryId));
|
||||
tspec.setIndicator(iconView);
|
||||
|
@ -274,14 +268,12 @@ public final class EmojiPalettesView extends LinearLayout
|
|||
mSpacebarIcon = findViewById(R.id.emoji_keyboard_space_icon);
|
||||
|
||||
final Colors colors = Settings.getInstance().getCurrent().mColors;
|
||||
if (colors.isCustom) {
|
||||
colors.setBackgroundColor(mAlphabetKeyLeft.getBackground(), Colors.TYPE_FUNCTIONAL);
|
||||
colors.setBackgroundColor(mDeleteKey.getBackground(), Colors.TYPE_FUNCTIONAL);
|
||||
colors.setBackgroundColor(mSpacebar.getBackground(), Colors.TYPE_SPACE);
|
||||
getBackground().setColorFilter(colors.backgroundFilter);
|
||||
mEmojiCategoryPageIndicatorView.setColors(colors.accent, colors.adjustedBackground);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchTouchEvent(final MotionEvent ev) {
|
||||
|
@ -301,14 +293,12 @@ public final class EmojiPalettesView extends LinearLayout
|
|||
updateEmojiCategoryPageIdView();
|
||||
}
|
||||
final Colors colors = Settings.getInstance().getCurrent().mColors;
|
||||
if (colors.isCustom) {
|
||||
if (mCurrentTab != null)
|
||||
mCurrentTab.setColorFilter(colors.keyTextFilter);
|
||||
mCurrentTab = (ImageView) mTabHost.getCurrentTabView();
|
||||
// mCurrentTab.setColorFilter(colors.accentColorFilter); // todo (later): doesn't work properly, because enabled drawable is blue -> adjust
|
||||
mCurrentTab.setColorFilter(colors.accent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called from {@link EmojiPageKeyboardView} through {@link android.view.View.OnTouchListener}
|
||||
|
@ -391,10 +381,6 @@ public final class EmojiPalettesView extends LinearLayout
|
|||
private static void setupAlphabetKey(final TextView alphabetKey, final String label,
|
||||
final KeyDrawParams params) {
|
||||
alphabetKey.setText(label);
|
||||
final Colors colors = Settings.getInstance().getCurrent().mColors;
|
||||
if (colors.isCustom)
|
||||
alphabetKey.setTextColor(colors.keyText);
|
||||
else
|
||||
alphabetKey.setTextColor(params.mFunctionalTextColor);
|
||||
alphabetKey.setTextSize(TypedValue.COMPLEX_UNIT_PX, params.mLabelSize);
|
||||
alphabetKey.setTypeface(params.mTypeface);
|
||||
|
|
|
@ -65,14 +65,10 @@ public class GestureFloatingTextDrawingPreview extends AbstractDrawingPreview {
|
|||
final Colors colors = Settings.getInstance().getCurrent().mColors;
|
||||
mGesturePreviewTextSize = mainKeyboardViewAttr.getDimensionPixelSize(
|
||||
R.styleable.MainKeyboardView_gestureFloatingPreviewTextSize, 0);
|
||||
mGesturePreviewTextColor = colors.isCustom
|
||||
? colors.keyText
|
||||
: mainKeyboardViewAttr.getColor(R.styleable.MainKeyboardView_gestureFloatingPreviewTextColor, 0);
|
||||
mGesturePreviewTextColor = colors.keyText; //mainKeyboardViewAttr.getColor(R.styleable.MainKeyboardView_gestureFloatingPreviewTextColor, 0);
|
||||
mGesturePreviewTextOffset = mainKeyboardViewAttr.getDimensionPixelOffset(
|
||||
R.styleable.MainKeyboardView_gestureFloatingPreviewTextOffset, 0);
|
||||
mGesturePreviewColor = colors.isCustom
|
||||
? colors.background
|
||||
: mainKeyboardViewAttr.getColor(R.styleable.MainKeyboardView_gestureFloatingPreviewColor, 0);
|
||||
mGesturePreviewColor = colors.adjustedBackground; //mainKeyboardViewAttr.getColor(R.styleable.MainKeyboardView_gestureFloatingPreviewColor, 0);
|
||||
mGesturePreviewHorizontalPadding = mainKeyboardViewAttr.getDimension(
|
||||
R.styleable.MainKeyboardView_gestureFloatingPreviewHorizontalPadding, 0.0f);
|
||||
mGesturePreviewVerticalPadding = mainKeyboardViewAttr.getDimension(
|
||||
|
|
|
@ -52,9 +52,7 @@ final class GestureTrailDrawingParams {
|
|||
public final int mTrailLingerDuration;
|
||||
|
||||
public GestureTrailDrawingParams(final TypedArray mainKeyboardViewAttr) {
|
||||
final Colors colors = Settings.getInstance().getCurrent().mColors;
|
||||
mTrailColor = colors.isCustom ? colors.accent : mainKeyboardViewAttr.getColor(
|
||||
R.styleable.MainKeyboardView_gestureTrailColor, 0);
|
||||
mTrailColor = Settings.getInstance().getCurrent().mColors.accent; //mainKeyboardViewAttr.getColor(R.styleable.MainKeyboardView_gestureTrailColor, 0);
|
||||
mTrailStartWidth = mainKeyboardViewAttr.getDimension(
|
||||
R.styleable.MainKeyboardView_gestureTrailStartWidth, 0.0f);
|
||||
mTrailEndWidth = mainKeyboardViewAttr.getDimension(
|
||||
|
|
|
@ -87,8 +87,7 @@ public final class KeyPreviewChoreographer {
|
|||
final KeyDrawParams drawParams, final int keyboardViewWidth, final int[] keyboardOrigin,
|
||||
final ViewGroup placerView) {
|
||||
final KeyPreviewView keyPreviewView = getKeyPreviewView(key, placerView);
|
||||
placeKeyPreview(
|
||||
key, keyPreviewView, iconsSet, drawParams, keyboardViewWidth, keyboardOrigin);
|
||||
placeKeyPreview(key, keyPreviewView, iconsSet, drawParams, keyboardViewWidth, keyboardOrigin);
|
||||
showKeyPreview(key, keyPreviewView);
|
||||
}
|
||||
|
||||
|
@ -96,8 +95,7 @@ public final class KeyPreviewChoreographer {
|
|||
final KeyboardIconsSet iconsSet, final KeyDrawParams drawParams,
|
||||
final int keyboardViewWidth, final int[] originCoords) {
|
||||
keyPreviewView.setPreviewVisual(key, iconsSet, drawParams);
|
||||
keyPreviewView.measure(
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
keyPreviewView.measure(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
mParams.setGeometry(keyPreviewView);
|
||||
final int previewWidth = keyPreviewView.getMeasuredWidth();
|
||||
final int previewHeight = mParams.mPreviewHeight;
|
||||
|
@ -120,10 +118,7 @@ public final class KeyPreviewChoreographer {
|
|||
final boolean hasMoreKeys = (key.getMoreKeys() != null);
|
||||
keyPreviewView.setPreviewBackground(hasMoreKeys, keyPreviewPosition);
|
||||
final Colors colors = Settings.getInstance().getCurrent().mColors;
|
||||
if (colors.isCustom) {
|
||||
keyPreviewView.getBackground().setColorFilter(colors.backgroundFilter);
|
||||
keyPreviewView.setTextColor(colors.keyText);
|
||||
}
|
||||
keyPreviewView.getBackground().setColorFilter(colors.adjustedBackgroundFilter);
|
||||
// The key preview is placed vertically above the top edge of the parent key with an
|
||||
// arbitrary offset.
|
||||
final int previewY = key.getY() - previewHeight + key.getHeight() - mParams.mPreviewOffset
|
||||
|
|
|
@ -21,6 +21,8 @@ import android.graphics.Typeface;
|
|||
import android.util.SparseIntArray;
|
||||
|
||||
import org.dslul.openboard.inputmethod.latin.R;
|
||||
import org.dslul.openboard.inputmethod.latin.common.Colors;
|
||||
import org.dslul.openboard.inputmethod.latin.settings.Settings;
|
||||
import org.dslul.openboard.inputmethod.latin.utils.ResourceUtils;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
@ -125,18 +127,20 @@ public final class KeyVisualAttributes {
|
|||
mPreviewTextRatio = ResourceUtils.getFraction(keyAttr,
|
||||
R.styleable.Keyboard_Key_keyPreviewTextRatio);
|
||||
|
||||
mTextColor = keyAttr.getColor(R.styleable.Keyboard_Key_keyTextColor, 0);
|
||||
mTextInactivatedColor = keyAttr.getColor(
|
||||
R.styleable.Keyboard_Key_keyTextInactivatedColor, 0);
|
||||
final Colors colors = Settings.getInstance().getCurrent().mColors;
|
||||
mTextColor = colors.keyText; //keyAttr.getColor(R.styleable.Keyboard_Key_keyTextColor, 0);
|
||||
mTextInactivatedColor = keyAttr.getColor(R.styleable.Keyboard_Key_keyTextInactivatedColor, 0);
|
||||
mTextShadowColor = keyAttr.getColor(R.styleable.Keyboard_Key_keyTextShadowColor, 0);
|
||||
mFunctionalTextColor = keyAttr.getColor(R.styleable.Keyboard_Key_functionalTextColor, 0);
|
||||
mHintLetterColor = keyAttr.getColor(R.styleable.Keyboard_Key_keyHintLetterColor, 0);
|
||||
mHintLabelColor = keyAttr.getColor(R.styleable.Keyboard_Key_keyHintLabelColor, 0);
|
||||
// todo: maybe a separate color?
|
||||
mFunctionalTextColor = colors.keyText; //keyAttr.getColor(R.styleable.Keyboard_Key_functionalTextColor, 0);
|
||||
mHintLetterColor = colors.keyHintText; //keyAttr.getColor(R.styleable.Keyboard_Key_keyHintLetterColor, 0);
|
||||
mHintLabelColor = colors.keyHintText; //keyAttr.getColor(R.styleable.Keyboard_Key_keyHintLabelColor, 0);
|
||||
mShiftedLetterHintInactivatedColor = keyAttr.getColor(
|
||||
R.styleable.Keyboard_Key_keyShiftedLetterHintInactivatedColor, 0);
|
||||
mShiftedLetterHintActivatedColor = keyAttr.getColor(
|
||||
R.styleable.Keyboard_Key_keyShiftedLetterHintActivatedColor, 0);
|
||||
mPreviewTextColor = keyAttr.getColor(R.styleable.Keyboard_Key_keyPreviewTextColor, 0);
|
||||
// todo: maybe a separate color?
|
||||
mPreviewTextColor = colors.keyText; //keyAttr.getColor(R.styleable.Keyboard_Key_keyPreviewTextColor, 0);
|
||||
|
||||
mHintLabelVerticalAdjustment = ResourceUtils.getFraction(keyAttr,
|
||||
R.styleable.Keyboard_Key_keyHintLabelVerticalAdjustment, 0.0f);
|
||||
|
|
|
@ -23,7 +23,6 @@ import android.graphics.Path;
|
|||
|
||||
import org.dslul.openboard.inputmethod.keyboard.PointerTracker;
|
||||
import org.dslul.openboard.inputmethod.latin.R;
|
||||
import org.dslul.openboard.inputmethod.latin.common.Colors;
|
||||
import org.dslul.openboard.inputmethod.latin.common.CoordinateUtils;
|
||||
import org.dslul.openboard.inputmethod.latin.settings.Settings;
|
||||
|
||||
|
@ -47,10 +46,7 @@ public final class SlidingKeyInputDrawingPreview extends AbstractDrawingPreview
|
|||
private final Paint mPaint = new Paint();
|
||||
|
||||
public SlidingKeyInputDrawingPreview(final TypedArray mainKeyboardViewAttr) {
|
||||
final Colors colors = Settings.getInstance().getCurrent().mColors;
|
||||
final int previewColor = colors.isCustom
|
||||
? colors.accent
|
||||
: mainKeyboardViewAttr.getColor(R.styleable.MainKeyboardView_slidingKeyInputPreviewColor, 0);
|
||||
final int previewColor = Settings.getInstance().getCurrent().mColors.accent; //mainKeyboardViewAttr.getColor(R.styleable.MainKeyboardView_slidingKeyInputPreviewColor, 0);
|
||||
final float previewRadius = mainKeyboardViewAttr.getDimension(
|
||||
R.styleable.MainKeyboardView_slidingKeyInputPreviewWidth, 0) / 2.0f;
|
||||
final int PERCENTAGE_INT = 100;
|
||||
|
|
|
@ -54,11 +54,9 @@ class KeyboardWrapperView @JvmOverloads constructor(
|
|||
switchOneHandedModeBtn.setOnClickListener(this)
|
||||
|
||||
val colors = Settings.getInstance().current.mColors
|
||||
if (colors.isCustom) {
|
||||
stopOneHandedModeBtn.colorFilter = colors.keyTextFilter
|
||||
switchOneHandedModeBtn.colorFilter = colors.keyTextFilter
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("RtlHardcoded")
|
||||
fun switchOneHandedModeSide() {
|
||||
|
|
|
@ -15,7 +15,6 @@ import androidx.core.graphics.drawable.DrawableCompat;
|
|||
// todo: maybe kotlin? would make it much shorter and more readable
|
||||
public class Colors {
|
||||
|
||||
public final boolean isCustom;
|
||||
public final int navBar;
|
||||
public final int accent;
|
||||
public final int background;
|
||||
|
@ -44,7 +43,6 @@ public class Colors {
|
|||
private ColorStateList adjustedBackgroundStateList;
|
||||
|
||||
public Colors(int _accent, int _background, int _keyBackground, int _functionalKey, int _spaceBar, int _keyText, int _keyHintText) {
|
||||
isCustom = true;
|
||||
accent = _accent;
|
||||
background = _background;
|
||||
keyBackground = _keyBackground;
|
||||
|
@ -55,20 +53,6 @@ public class Colors {
|
|||
navBar = background;
|
||||
}
|
||||
|
||||
// todo (later): remove this and isCustom, once the old themes can be completely replaced
|
||||
// for now there are the holo themes left, which don't require any of themeId and isNight
|
||||
public Colors(int themeId, final boolean isNight) {
|
||||
isCustom = false;
|
||||
navBar = Color.BLACK;
|
||||
accent = 0;
|
||||
background = 0;
|
||||
keyBackground = 0;
|
||||
functionalKey = 0;
|
||||
spaceBar = 0;
|
||||
keyText = 0;
|
||||
keyHintText = 0;
|
||||
}
|
||||
|
||||
/** set background colors including state list to the drawable */
|
||||
// todo: this can be used for setting more complicated filters
|
||||
// may be necessary for reproducing holo theme (extend Colors and override this in sth like HoloColors?)
|
||||
|
|
|
@ -574,15 +574,8 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
|||
}
|
||||
|
||||
public static Colors getColors(final Context context, final SharedPreferences prefs) {
|
||||
final int keyboardThemeId = KeyboardTheme.getThemeForParameters(
|
||||
prefs.getString(Settings.PREF_THEME_FAMILY, ""),
|
||||
prefs.getString(Settings.PREF_THEME_VARIANT, ""),
|
||||
prefs.getBoolean(Settings.PREF_THEME_KEY_BORDERS, false)
|
||||
);
|
||||
// todo: night mode can be unspecified -> maybe need to adjust for correct behavior on some devices?
|
||||
final boolean isNight = (context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
|
||||
if (!KeyboardTheme.getIsCustom(keyboardThemeId))
|
||||
return new Colors(keyboardThemeId, isNight);
|
||||
|
||||
if (isNight && prefs.getBoolean(Settings.PREF_THEME_DAY_NIGHT, false))
|
||||
return KeyboardTheme.getCustomTheme(prefs.getString(Settings.PREF_CUSTOM_THEME_VARIANT_NIGHT, KeyboardTheme.THEME_DARKER), context, prefs);
|
||||
|
|
|
@ -131,17 +131,10 @@ final class SuggestionStripLayoutHelper {
|
|||
R.styleable.SuggestionStripView_alphaObsoleted, 1.0f);
|
||||
|
||||
final Colors colors = Settings.getInstance().getCurrent().mColors;
|
||||
if (colors.isCustom) {
|
||||
mColorValidTypedWord = colors.adjustedKeyText;
|
||||
mColorTypedWord = colors.adjustedKeyText;
|
||||
mColorAutoCorrect = colors.keyText;
|
||||
mColorSuggested = colors.adjustedKeyText;
|
||||
} else {
|
||||
mColorValidTypedWord = a.getColor(R.styleable.SuggestionStripView_colorValidTypedWord, 0);
|
||||
mColorTypedWord = a.getColor(R.styleable.SuggestionStripView_colorTypedWord, 0);
|
||||
mColorAutoCorrect = a.getColor(R.styleable.SuggestionStripView_colorAutoCorrect, 0);
|
||||
mColorSuggested = a.getColor(R.styleable.SuggestionStripView_colorSuggested, 0);
|
||||
}
|
||||
mColorValidTypedWord = colors.adjustedKeyText; //a.getColor(R.styleable.SuggestionStripView_colorValidTypedWord, 0);
|
||||
mColorTypedWord = colors.adjustedKeyText; //a.getColor(R.styleable.SuggestionStripView_colorTypedWord, 0);
|
||||
mColorAutoCorrect = colors.keyText; //a.getColor(R.styleable.SuggestionStripView_colorAutoCorrect, 0);
|
||||
mColorSuggested = colors.adjustedKeyText; //a.getColor(R.styleable.SuggestionStripView_colorSuggested, 0);
|
||||
|
||||
mSuggestionsCountInStrip = a.getInt(
|
||||
R.styleable.SuggestionStripView_suggestionsCountInStrip,
|
||||
|
|
|
@ -59,7 +59,6 @@ import org.dslul.openboard.inputmethod.latin.utils.DialogUtils;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
public final class SuggestionStripView extends RelativeLayout implements OnClickListener,
|
||||
|
@ -185,9 +184,8 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
mOtherKey.setImageDrawable(iconIncognito);
|
||||
|
||||
final Colors colors = Settings.getInstance().getCurrent().mColors;
|
||||
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
|
||||
// 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?
|
||||
|
@ -198,11 +196,6 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
mClipboardKey.setColorFilter(colors.keyText);
|
||||
mVoiceKey.setColorFilter(colors.keyText);
|
||||
mOtherKey.setColorFilter(colors.keyText);
|
||||
} else {
|
||||
mClipboardKey.clearColorFilter();
|
||||
mVoiceKey.clearColorFilter();
|
||||
mOtherKey.clearColorFilter();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue