mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-18 16:03:12 +00:00
remove bad workaround
InsetDrawable is the solution I was looking for...
This commit is contained in:
parent
a7a40d9ed1
commit
556ff23b98
3 changed files with 14 additions and 61 deletions
|
@ -17,7 +17,6 @@
|
|||
package org.dslul.openboard.inputmethod.keyboard;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
|
@ -43,7 +42,6 @@ import org.dslul.openboard.inputmethod.latin.common.Colors;
|
|||
import org.dslul.openboard.inputmethod.latin.common.Constants;
|
||||
import org.dslul.openboard.inputmethod.latin.settings.Settings;
|
||||
import org.dslul.openboard.inputmethod.latin.suggestions.MoreSuggestionsView;
|
||||
import org.dslul.openboard.inputmethod.latin.utils.DeviceProtectedUtils;
|
||||
import org.dslul.openboard.inputmethod.latin.utils.TypefaceUtils;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
@ -398,21 +396,8 @@ public class KeyboardView extends View {
|
|||
} else {
|
||||
final Rect padding = mKeyBackgroundPadding;
|
||||
bgWidth = keyWidth + padding.left + padding.right;
|
||||
// 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 && !isHoloTheme()) {
|
||||
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;
|
||||
}
|
||||
bgHeight = keyHeight + padding.top + padding.bottom;
|
||||
bgY = -padding.top;
|
||||
bgX = -padding.left;
|
||||
}
|
||||
background.setBounds(0, 0, bgWidth, bgHeight);
|
||||
|
@ -421,16 +406,6 @@ public class KeyboardView extends View {
|
|||
canvas.translate(-bgX, -bgY);
|
||||
}
|
||||
|
||||
private boolean isHoloTheme() {
|
||||
final SharedPreferences prefs = DeviceProtectedUtils.getSharedPreferences(getContext());
|
||||
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)
|
||||
);
|
||||
return KeyboardTheme.getThemeFamily(keyboardThemeId).equals(KeyboardTheme.THEME_FAMILY_HOLO);
|
||||
}
|
||||
|
||||
// Draw key top visuals.
|
||||
protected void onDrawKeyTopVisuals(@Nonnull final Key key, @Nonnull final Canvas canvas,
|
||||
@Nonnull final Paint paint, @Nonnull final KeyDrawParams params) {
|
||||
|
|
|
@ -19,16 +19,12 @@ package org.dslul.openboard.inputmethod.keyboard.emoji;
|
|||
import android.content.Context;
|
||||
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;
|
||||
|
@ -288,17 +284,6 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue