mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-17 07:22:45 +00:00
fix regression with spacebar in emoji view
This commit is contained in:
parent
fd65e92e39
commit
df59ea71c0
1 changed files with 11 additions and 20 deletions
|
@ -9,6 +9,7 @@ package org.dslul.openboard.inputmethod.keyboard.emoji;
|
||||||
import android.content.Context;
|
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.drawable.Drawable;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -61,8 +62,8 @@ import static org.dslul.openboard.inputmethod.latin.common.Constants.NOT_A_COORD
|
||||||
public final class EmojiPalettesView extends LinearLayout
|
public final class EmojiPalettesView extends LinearLayout
|
||||||
implements OnTabChangeListener, View.OnClickListener, View.OnTouchListener,
|
implements OnTabChangeListener, View.OnClickListener, View.OnTouchListener,
|
||||||
OnKeyEventListener {
|
OnKeyEventListener {
|
||||||
private final int mFunctionalKeyBackgroundId;
|
private final Drawable mFunctionalKeyBackground;
|
||||||
private final int mSpacebarBackgroundId;
|
private final Drawable mSpacebarBackground;
|
||||||
private final boolean mCategoryIndicatorEnabled;
|
private final boolean mCategoryIndicatorEnabled;
|
||||||
private final int mCategoryIndicatorDrawableResId;
|
private final int mCategoryIndicatorDrawableResId;
|
||||||
private final int mCategoryIndicatorBackgroundResId;
|
private final int mCategoryIndicatorBackgroundResId;
|
||||||
|
@ -96,15 +97,11 @@ public final class EmojiPalettesView extends LinearLayout
|
||||||
super(context, attrs, defStyle);
|
super(context, attrs, defStyle);
|
||||||
final TypedArray keyboardViewAttr = context.obtainStyledAttributes(attrs,
|
final TypedArray keyboardViewAttr = context.obtainStyledAttributes(attrs,
|
||||||
R.styleable.KeyboardView, defStyle, R.style.KeyboardView);
|
R.styleable.KeyboardView, defStyle, R.style.KeyboardView);
|
||||||
final int keyBackgroundId = keyboardViewAttr.getResourceId(
|
final Colors colors = Settings.getInstance().getCurrent().mColors;
|
||||||
R.styleable.KeyboardView_keyBackground, 0);
|
mFunctionalKeyBackground = colors.getDrawable(BackgroundType.FUNCTIONAL, keyboardViewAttr);
|
||||||
mFunctionalKeyBackgroundId = keyboardViewAttr.getResourceId(
|
mSpacebarBackground = colors.getDrawable(BackgroundType.SPACE, keyboardViewAttr);
|
||||||
R.styleable.KeyboardView_functionalKeyBackground, keyBackgroundId);
|
|
||||||
mSpacebarBackgroundId = keyboardViewAttr.getResourceId(
|
|
||||||
R.styleable.KeyboardView_spacebarBackground, keyBackgroundId);
|
|
||||||
keyboardViewAttr.recycle();
|
keyboardViewAttr.recycle();
|
||||||
final KeyboardLayoutSet.Builder builder = new KeyboardLayoutSet.Builder(
|
final KeyboardLayoutSet.Builder builder = new KeyboardLayoutSet.Builder(context, null);
|
||||||
context, null /* editorInfo */);
|
|
||||||
final Resources res = context.getResources();
|
final Resources res = context.getResources();
|
||||||
mEmojiLayoutParams = new EmojiLayoutParams(res);
|
mEmojiLayoutParams = new EmojiLayoutParams(res);
|
||||||
builder.setSubtype(RichInputMethodSubtype.getEmojiSubtype());
|
builder.setSubtype(RichInputMethodSubtype.getEmojiSubtype());
|
||||||
|
@ -235,7 +232,7 @@ public final class EmojiPalettesView extends LinearLayout
|
||||||
|
|
||||||
// deleteKey depends only on OnTouchListener.
|
// deleteKey depends only on OnTouchListener.
|
||||||
mDeleteKey = findViewById(R.id.emoji_keyboard_delete);
|
mDeleteKey = findViewById(R.id.emoji_keyboard_delete);
|
||||||
mDeleteKey.setBackgroundResource(mFunctionalKeyBackgroundId);
|
mDeleteKey.setBackground(mFunctionalKeyBackground);
|
||||||
mDeleteKey.setColorFilter(colors.getKeyTextFilter());
|
mDeleteKey.setColorFilter(colors.getKeyTextFilter());
|
||||||
mDeleteKey.setTag(Constants.CODE_DELETE);
|
mDeleteKey.setTag(Constants.CODE_DELETE);
|
||||||
mDeleteKey.setOnTouchListener(mDeleteKeyOnTouchListener);
|
mDeleteKey.setOnTouchListener(mDeleteKeyOnTouchListener);
|
||||||
|
@ -248,12 +245,12 @@ public final class EmojiPalettesView extends LinearLayout
|
||||||
// The text on alphabet keys are set at
|
// The text on alphabet keys are set at
|
||||||
// {@link #startEmojiPalettes(String,int,float,Typeface)}.
|
// {@link #startEmojiPalettes(String,int,float,Typeface)}.
|
||||||
mAlphabetKeyLeft = findViewById(R.id.emoji_keyboard_alphabet_left);
|
mAlphabetKeyLeft = findViewById(R.id.emoji_keyboard_alphabet_left);
|
||||||
mAlphabetKeyLeft.setBackgroundResource(mFunctionalKeyBackgroundId);
|
mAlphabetKeyLeft.setBackground(mFunctionalKeyBackground);
|
||||||
mAlphabetKeyLeft.setTag(Constants.CODE_ALPHA_FROM_EMOJI);
|
mAlphabetKeyLeft.setTag(Constants.CODE_ALPHA_FROM_EMOJI);
|
||||||
mAlphabetKeyLeft.setOnTouchListener(this);
|
mAlphabetKeyLeft.setOnTouchListener(this);
|
||||||
mAlphabetKeyLeft.setOnClickListener(this);
|
mAlphabetKeyLeft.setOnClickListener(this);
|
||||||
mSpacebar = findViewById(R.id.emoji_keyboard_space);
|
mSpacebar = findViewById(R.id.emoji_keyboard_space);
|
||||||
mSpacebar.setBackgroundResource(mSpacebarBackgroundId);
|
mSpacebar.setBackground(mSpacebarBackground);
|
||||||
mSpacebar.setTag(Constants.CODE_SPACE);
|
mSpacebar.setTag(Constants.CODE_SPACE);
|
||||||
mSpacebar.setOnTouchListener(this);
|
mSpacebar.setOnTouchListener(this);
|
||||||
mSpacebar.setOnClickListener(this);
|
mSpacebar.setOnClickListener(this);
|
||||||
|
@ -288,8 +285,7 @@ public final class EmojiPalettesView extends LinearLayout
|
||||||
if (mCurrentTab != null)
|
if (mCurrentTab != null)
|
||||||
mCurrentTab.setColorFilter(colors.getKeyTextFilter());
|
mCurrentTab.setColorFilter(colors.getKeyTextFilter());
|
||||||
mCurrentTab = (ImageView) mTabHost.getCurrentTabView();
|
mCurrentTab = (ImageView) mTabHost.getCurrentTabView();
|
||||||
// mCurrentTab.setColorFilter(colors.accentColorFilter); not working because of lxx icon color
|
mCurrentTab.setColorFilter(colors.getAccentColorFilter());
|
||||||
mCurrentTab.setColorFilter(colors.getAccent());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -384,11 +380,6 @@ public final class EmojiPalettesView extends LinearLayout
|
||||||
if (deleteIconResId != 0) {
|
if (deleteIconResId != 0) {
|
||||||
mDeleteKey.setImageResource(deleteIconResId);
|
mDeleteKey.setImageResource(deleteIconResId);
|
||||||
}
|
}
|
||||||
final int spacebarResId = iconSet.getIconResourceId(KeyboardIconsSet.NAME_SPACE_KEY);
|
|
||||||
if (spacebarResId != 0) {
|
|
||||||
// TODO: Remove this workaround to place the spacebar icon.
|
|
||||||
mSpacebarIcon.setBackgroundResource(spacebarResId);
|
|
||||||
}
|
|
||||||
final KeyDrawParams params = new KeyDrawParams();
|
final KeyDrawParams params = new KeyDrawParams();
|
||||||
params.updateParams(mEmojiLayoutParams.getActionBarHeight(), keyVisualAttr);
|
params.updateParams(mEmojiLayoutParams.getActionBarHeight(), keyVisualAttr);
|
||||||
setupAlphabetKey(mAlphabetKeyLeft, switchToAlphaLabel, params);
|
setupAlphabetKey(mAlphabetKeyLeft, switchToAlphaLabel, params);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue