mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-23 07:39:11 +00:00
fix some theming issues
This commit is contained in:
parent
1799d618c5
commit
c468732ca2
8 changed files with 59 additions and 19 deletions
|
@ -43,8 +43,8 @@ Plan / to do:
|
|||
* ~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)
|
||||
* ~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 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~
|
||||
|
|
|
@ -463,6 +463,8 @@ public class KeyboardView extends View {
|
|||
// set key color only if not in emoji keyboard range
|
||||
if (keyboard != null && (keyboard.mId.mElementId < 10 || keyboard.mId.mElementId > 26))
|
||||
paint.setColorFilter(keyTextColorFilter);
|
||||
else
|
||||
paint.setColorFilter(null);
|
||||
}
|
||||
// Set a drop shadow for the text if the shadow radius is positive value.
|
||||
if (mKeyTextShadowRadius > 0.0f) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.dslul.openboard.inputmethod.keyboard.clipboard
|
||||
|
||||
import android.graphics.ColorFilter
|
||||
import android.graphics.Typeface
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
|
@ -22,6 +23,7 @@ class ClipboardAdapter(
|
|||
|
||||
var pinnedIconResId = 0
|
||||
var itemBackgroundId = 0
|
||||
var itemBackgroundColorFilter: ColorFilter? = null
|
||||
var itemTypeFace: Typeface? = null
|
||||
var itemTextColor = 0
|
||||
var itemTextSize = 0f
|
||||
|
@ -53,6 +55,7 @@ class ClipboardAdapter(
|
|||
setOnTouchListener(this@ViewHolder)
|
||||
setOnLongClickListener(this@ViewHolder)
|
||||
setBackgroundResource(itemBackgroundId)
|
||||
background.colorFilter = itemBackgroundColorFilter
|
||||
}
|
||||
pinnedIconView = view.findViewById<ImageView>(R.id.clipboard_entry_pinned_icon).apply {
|
||||
visibility = View.GONE
|
||||
|
|
|
@ -6,6 +6,7 @@ import android.graphics.Paint
|
|||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.dslul.openboard.inputmethod.latin.settings.Settings
|
||||
|
||||
class ClipboardHistoryRecyclerView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
|
@ -62,6 +63,9 @@ class ClipboardHistoryRecyclerView @JvmOverloads constructor(
|
|||
init {
|
||||
paint.color = dividerColor
|
||||
paint.strokeWidth = dividerHeight.toFloat()
|
||||
val sv = Settings.getInstance().current
|
||||
if (sv.mUserTheme)
|
||||
paint.colorFilter = sv.mBackgroundColorFilter
|
||||
}
|
||||
|
||||
override fun onDrawOver(canvas: Canvas, parent: RecyclerView, state: State) {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.dslul.openboard.inputmethod.keyboard.clipboard
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.util.AttributeSet
|
||||
import android.util.TypedValue
|
||||
import android.view.MotionEvent
|
||||
|
@ -10,8 +9,6 @@ import android.widget.FrameLayout
|
|||
import android.widget.ImageButton
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.core.graphics.BlendModeColorFilterCompat
|
||||
import androidx.core.graphics.BlendModeCompat
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
||||
import org.dslul.openboard.inputmethod.keyboard.KeyboardActionListener
|
||||
import org.dslul.openboard.inputmethod.keyboard.internal.KeyDrawParams
|
||||
|
@ -93,29 +90,34 @@ class ClipboardHistoryView @JvmOverloads constructor(
|
|||
findViewById<FrameLayout>(R.id.clipboard_action_bar)?.apply {
|
||||
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 {
|
||||
tag = Constants.CODE_ALPHA_FROM_CLIPBOARD
|
||||
setBackgroundResource(functionalKeyBackgroundId)
|
||||
setOnTouchListener(this@ClipboardHistoryView)
|
||||
setOnClickListener(this@ClipboardHistoryView)
|
||||
background.colorFilter = settingsValues.mKeyBackgroundColorFilter
|
||||
setTextColor(settingsValues.mKeyTextColor)
|
||||
}
|
||||
clearKey = findViewById<ImageButton>(R.id.clipboard_clear).apply {
|
||||
setOnTouchListener(this@ClipboardHistoryView)
|
||||
setOnClickListener(this@ClipboardHistoryView)
|
||||
colorFilter = settingsValues.mKeyTextColorFilter
|
||||
}
|
||||
background.colorFilter = settingsValues.mBackgroundColorFilter
|
||||
if (settingsValues.mUserTheme) {
|
||||
alphabetKey.background.colorFilter = settingsValues.mKeyBackgroundColorFilter
|
||||
alphabetKey.setTextColor(settingsValues.mKeyTextColor)
|
||||
clearKey.colorFilter = settingsValues.mKeyTextColorFilter
|
||||
background.colorFilter = settingsValues.mBackgroundColorFilter
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupAlphabetKey(key: TextView?, label: String, params: KeyDrawParams) {
|
||||
key?.apply {
|
||||
text = label
|
||||
typeface = params.mTypeface
|
||||
setTextColor(params.mFunctionalTextColor)
|
||||
val settingsValues = Settings.getInstance().current
|
||||
if (settingsValues.mUserTheme)
|
||||
setTextColor(settingsValues.mKeyTextColor)
|
||||
else
|
||||
setTextColor(params.mFunctionalTextColor)
|
||||
setTextSize(TypedValue.COMPLEX_UNIT_PX, params.mLabelSize.toFloat())
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +126,12 @@ class ClipboardHistoryView @JvmOverloads constructor(
|
|||
clipboardAdapter.apply {
|
||||
itemBackgroundId = keyBackgroundId
|
||||
itemTypeFace = params.mTypeface
|
||||
itemTextColor = params.mTextColor
|
||||
val sv = Settings.getInstance().current
|
||||
if (sv.mUserTheme) {
|
||||
itemTextColor = sv.mKeyTextColor
|
||||
itemBackgroundColorFilter = sv.mKeyBackgroundColorFilter
|
||||
} else
|
||||
itemTextColor = params.mTextColor
|
||||
itemTextSize = params.mLabelSize.toFloat()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,6 +100,8 @@ public final class EmojiPalettesView extends LinearLayout
|
|||
|
||||
private final EmojiCategory mEmojiCategory;
|
||||
|
||||
private ImageView mCurrentTab = null;
|
||||
|
||||
public EmojiPalettesView(final Context context, final AttributeSet attrs) {
|
||||
this(context, attrs, R.attr.emojiPalettesViewStyle);
|
||||
}
|
||||
|
@ -164,6 +166,11 @@ 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 SettingsValues settingsValues = Settings.getInstance().getCurrent();
|
||||
if (settingsValues.mUserTheme) {
|
||||
iconView.getBackground().setColorFilter(settingsValues.mBackgroundColorFilter);
|
||||
iconView.setColorFilter(settingsValues.mKeyTextColorFilter);
|
||||
}
|
||||
iconView.setImageResource(mEmojiCategory.getCategoryTabIcon(categoryId));
|
||||
iconView.setContentDescription(mEmojiCategory.getAccessibilityDescription(categoryId));
|
||||
tspec.setIndicator(iconView);
|
||||
|
@ -265,11 +272,16 @@ public final class EmojiPalettesView extends LinearLayout
|
|||
mSpacebar.setTag(Constants.CODE_SPACE);
|
||||
mSpacebar.setOnTouchListener(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);
|
||||
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
|
||||
if (settingsValues.mUserTheme) {
|
||||
final ColorFilter cf = settingsValues.mKeyBackgroundColorFilter;
|
||||
mAlphabetKeyLeft.getBackground().setColorFilter(cf);
|
||||
mSpacebar.getBackground().setColorFilter(cf);
|
||||
mDeleteKey.getBackground().setColorFilter(cf);
|
||||
getBackground().setColorFilter(cf);
|
||||
mEmojiCategoryPageIndicatorView.setColors(settingsValues.mUserThemeColorAccent, settingsValues.mBackgroundColor);
|
||||
findViewById(R.id.emoji_tab_strip).getBackground().setColorFilter(cf);
|
||||
}
|
||||
mEmojiLayoutParams.setKeyProperties(mSpacebar);
|
||||
mSpacebarIcon = findViewById(R.id.emoji_keyboard_space_icon);
|
||||
}
|
||||
|
@ -291,6 +303,13 @@ public final class EmojiPalettesView extends LinearLayout
|
|||
setCurrentCategoryAndPageId(categoryId, 0, false /* force */);
|
||||
updateEmojiCategoryPageIdView();
|
||||
}
|
||||
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
|
||||
if (settingsValues.mUserTheme) {
|
||||
if (mCurrentTab != null)
|
||||
mCurrentTab.setColorFilter(settingsValues.mKeyTextColorFilter);
|
||||
mCurrentTab = (ImageView) mTabHost.getCurrentTabView();
|
||||
mCurrentTab.setColorFilter(settingsValues.mUserThemeColorAccent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -374,7 +393,11 @@ public final class EmojiPalettesView extends LinearLayout
|
|||
private static void setupAlphabetKey(final TextView alphabetKey, final String label,
|
||||
final KeyDrawParams params) {
|
||||
alphabetKey.setText(label);
|
||||
alphabetKey.setTextColor(params.mFunctionalTextColor);
|
||||
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
|
||||
if (settingsValues.mUserTheme)
|
||||
alphabetKey.setTextColor(settingsValues.mKeyTextColor);
|
||||
else
|
||||
alphabetKey.setTextColor(params.mFunctionalTextColor);
|
||||
alphabetKey.setTextSize(TypedValue.COMPLEX_UNIT_PX, params.mLabelSize);
|
||||
alphabetKey.setTypeface(params.mTypeface);
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ public class SettingsValues {
|
|||
private final AsyncResultHolder<AppWorkaroundsUtils> mAppWorkarounds;
|
||||
|
||||
// User-defined colors
|
||||
public boolean mUserTheme;
|
||||
public final boolean mUserTheme;
|
||||
public final ColorFilter mKeyBackgroundColorFilter;
|
||||
public final int mBackgroundColor;
|
||||
public final ColorFilter mBackgroundColorFilter;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
style="?attr/emojiPalettesViewStyle"
|
||||
>
|
||||
<LinearLayout
|
||||
android:id="@+id/emoji_tab_strip"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/config_suggestions_strip_height"
|
||||
|
|
Loading…
Add table
Reference in a new issue