mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-20 00:40:29 +00:00
fix bad spacebar height in some modes
This commit is contained in:
parent
093280b513
commit
20a1c95d8d
4 changed files with 38 additions and 6 deletions
|
@ -382,9 +382,22 @@ public class KeyboardView extends View {
|
|||
} else {
|
||||
final Rect padding = mKeyBackgroundPadding;
|
||||
bgWidth = keyWidth + padding.left + padding.right;
|
||||
bgHeight = keyHeight + padding.top + padding.bottom;
|
||||
// absurdly horrible workaround, because it's not possible to set padding as percentage of height in btn_keyboard_spacebar_lxx_base
|
||||
if (mColors.isCustom && key.getBackgroundType() == Key.BACKGROUND_TYPE_SPACEBAR) {
|
||||
Rect p = new Rect();
|
||||
background.getPadding(p);
|
||||
if (p.top != 0) {
|
||||
bgHeight = (keyHeight + padding.top + padding.bottom) / 2;
|
||||
bgY = -padding.top + bgHeight / 2;
|
||||
} else {
|
||||
bgHeight = keyHeight + padding.top + padding.bottom;
|
||||
bgY = -padding.top;
|
||||
}
|
||||
} else {
|
||||
bgHeight = keyHeight + padding.top + padding.bottom;
|
||||
bgY = -padding.top;
|
||||
}
|
||||
bgX = -padding.left;
|
||||
bgY = -padding.top;
|
||||
}
|
||||
if (mColors.isCustom)
|
||||
setCustomKeyBackgroundColor(key, getKeyboard(), background);
|
||||
|
|
|
@ -21,11 +21,14 @@ import android.content.res.Resources;
|
|||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
@ -271,6 +274,10 @@ public final class EmojiPalettesView extends LinearLayout
|
|||
mSpacebar.setTag(Constants.CODE_SPACE);
|
||||
mSpacebar.setOnTouchListener(this);
|
||||
mSpacebar.setOnClickListener(this);
|
||||
|
||||
mEmojiLayoutParams.setKeyProperties(mSpacebar);
|
||||
mSpacebarIcon = findViewById(R.id.emoji_keyboard_space_icon);
|
||||
|
||||
final Colors colors = Settings.getInstance().getCurrent().mColors;
|
||||
if (colors.isCustom) {
|
||||
DrawableCompat.setTintList(mAlphabetKeyLeft.getBackground(), colors.functionalKeyStateList);
|
||||
|
@ -281,9 +288,18 @@ public final class EmojiPalettesView extends LinearLayout
|
|||
DrawableCompat.setTintMode(mDeleteKey.getBackground(), PorterDuff.Mode.MULTIPLY);
|
||||
getBackground().setColorFilter(colors.backgroundFilter);
|
||||
mEmojiCategoryPageIndicatorView.setColors(colors.accent, colors.adjustedBackground);
|
||||
|
||||
// another weird workaround because it's not possible to set padding as percentage of height in btn_keyboard_spacebar_lxx_base
|
||||
// of course different than in KeyboardView...
|
||||
Rect p = new Rect();
|
||||
mSpacebar.getBackground().getPadding(p);
|
||||
if (p.top != 0) {
|
||||
final LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mSpacebar.getLayoutParams();
|
||||
lp.topMargin = p.top;
|
||||
lp.bottomMargin = p.top;
|
||||
mSpacebar.setLayoutParams(lp);
|
||||
}
|
||||
}
|
||||
mEmojiLayoutParams.setKeyProperties(mSpacebar);
|
||||
mSpacebarIcon = findViewById(R.id.emoji_keyboard_space_icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -190,6 +190,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
// 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?
|
||||
// todo (later): when fixing this, revert changes in themes-lxx-base[-border] (in todo)
|
||||
// this would allow having a different background shape in pressed state
|
||||
DrawableCompat.setTintList(getBackground(), colors.backgroundStateList);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue