mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-25 00:56:35 +00:00
Merge 2cba77cdee
into 8fddf94121
This commit is contained in:
commit
746892cff5
7 changed files with 23 additions and 25 deletions
|
@ -148,6 +148,8 @@ public class KeyboardView extends View {
|
|||
|
||||
mPaint.setAntiAlias(true);
|
||||
mTypeface = Settings.getInstance().getCustomTypeface();
|
||||
|
||||
setFitsSystemWindows(true);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
|
@ -16,6 +16,7 @@ import helium314.keyboard.keyboard.internal.KeyboardParams;
|
|||
import helium314.keyboard.keyboard.internal.PopupKeySpec;
|
||||
import helium314.keyboard.latin.R;
|
||||
import helium314.keyboard.latin.common.StringUtils;
|
||||
import helium314.keyboard.latin.utils.ResourceUtils;
|
||||
import helium314.keyboard.latin.utils.TypefaceUtils;
|
||||
|
||||
public final class PopupKeysKeyboard extends Keyboard {
|
||||
|
@ -65,7 +66,7 @@ public final class PopupKeysKeyboard extends Keyboard {
|
|||
public void setParameters(final int numKeys, final int numColumn, final int keyWidth,
|
||||
final int rowHeight, final int coordXInParent, final int parentKeyboardWidth,
|
||||
final boolean isPopupKeysFixedColumn, final boolean isPopupKeysFixedOrder,
|
||||
final int dividerWidth) {
|
||||
final int dividerWidth, Context context) {
|
||||
mIsPopupKeysFixedOrder = isPopupKeysFixedOrder;
|
||||
if (parentKeyboardWidth / keyWidth < Math.min(numKeys, numColumn)) {
|
||||
throw new IllegalArgumentException("Keyboard is too small to hold popup keys: "
|
||||
|
@ -305,7 +306,7 @@ public final class PopupKeysKeyboard extends Keyboard {
|
|||
: (spaceForKeys > 0 ? spaceForKeys : defaultColumns); // in last case setParameters will throw an exception
|
||||
mParams.setParameters(popupKeys.length, finalNumColumns, keyWidth,
|
||||
rowHeight, key.getX() + key.getWidth() / 2, keyboard.mId.mWidth,
|
||||
key.isPopupKeysFixedColumn(), key.isPopupKeysFixedOrder(), dividerWidth);
|
||||
key.isPopupKeysFixedColumn(), key.isPopupKeysFixedOrder(), dividerWidth, context);
|
||||
}
|
||||
|
||||
private static int getMaxKeyWidth(final Key parentKey, final int minKeyWidth,
|
||||
|
|
|
@ -37,9 +37,10 @@ class ClipboardLayoutParams(ctx: Context) {
|
|||
defaultKeyboardWidth, defaultKeyboardWidth).toInt()
|
||||
}
|
||||
val bottomPadding = (res.getFraction(R.fraction.config_keyboard_bottom_padding_holo,
|
||||
defaultKeyboardHeight, defaultKeyboardHeight) * sv.mBottomPaddingScale).toInt()
|
||||
defaultKeyboardHeight, defaultKeyboardHeight) * sv.mBottomPaddingScale).toInt()
|
||||
|
||||
val topPadding = res.getFraction(R.fraction.config_keyboard_top_padding_holo,
|
||||
defaultKeyboardHeight, defaultKeyboardHeight).toInt()
|
||||
defaultKeyboardHeight, defaultKeyboardHeight).toInt()
|
||||
|
||||
val rowCount = KeyboardParams.DEFAULT_KEYBOARD_ROWS + if (sv.mShowsNumberRow) 1 else 0
|
||||
bottomRowKeyboardHeight = (defaultKeyboardHeight - bottomPadding - topPadding) / rowCount - keyVerticalGap / 2
|
||||
|
@ -64,4 +65,4 @@ class ClipboardLayoutParams(ctx: Context) {
|
|||
view.layoutParams = this
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
package helium314.keyboard.keyboard.emoji
|
||||
|
||||
import android.content.res.Resources
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
|
@ -14,13 +14,14 @@ import helium314.keyboard.latin.R
|
|||
import helium314.keyboard.latin.settings.Settings
|
||||
import helium314.keyboard.latin.utils.ResourceUtils
|
||||
|
||||
internal class EmojiLayoutParams(res: Resources) {
|
||||
internal class EmojiLayoutParams(ctx: Context) {
|
||||
private val emojiListBottomMargin: Int
|
||||
val emojiKeyboardHeight: Int
|
||||
private val emojiCategoryPageIdViewHeight: Int
|
||||
val bottomRowKeyboardHeight: Int
|
||||
|
||||
init {
|
||||
val res = ctx.resources
|
||||
val sv = Settings.getValues()
|
||||
val defaultKeyboardHeight = ResourceUtils.getKeyboardHeight(res, sv)
|
||||
|
||||
|
|
|
@ -87,8 +87,7 @@ public final class EmojiPalettesView extends LinearLayout
|
|||
super(context, attrs, defStyle);
|
||||
mColors = Settings.getValues().mColors;
|
||||
final KeyboardLayoutSet.Builder builder = new KeyboardLayoutSet.Builder(context, null);
|
||||
final Resources res = context.getResources();
|
||||
mEmojiLayoutParams = new EmojiLayoutParams(res);
|
||||
mEmojiLayoutParams = new EmojiLayoutParams(context);
|
||||
builder.setSubtype(RichInputMethodSubtype.Companion.getEmojiSubtype());
|
||||
builder.setKeyboardGeometry(ResourceUtils.getKeyboardWidth(context, Settings.getValues()),
|
||||
mEmojiLayoutParams.getEmojiKeyboardHeight());
|
||||
|
@ -360,4 +359,4 @@ public final class EmojiPalettesView extends LinearLayout
|
|||
public void clearKeyboardCache() {
|
||||
mEmojiCategory.clearKeyboardCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,14 +8,9 @@ package helium314.keyboard.keyboard.internal;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Insets;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.SparseIntArray;
|
||||
|
||||
import android.view.WindowInsets;
|
||||
import android.view.WindowManager;
|
||||
import android.view.WindowMetrics;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
|
@ -230,16 +225,6 @@ public class KeyboardParams {
|
|||
mBottomPadding = (int) (keyboardAttr.getFraction(
|
||||
R.styleable.Keyboard_keyboardBottomPadding, height, height, 0)
|
||||
* Settings.getValues().mBottomPaddingScale);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 35) {
|
||||
WindowManager wm = context.getSystemService(WindowManager.class);
|
||||
WindowMetrics windowMetrics = wm.getCurrentWindowMetrics();
|
||||
WindowInsets windowInsets = windowMetrics.getWindowInsets();
|
||||
int insetTypes = WindowInsets.Type.systemBars() | WindowInsets.Type.displayCutout();
|
||||
Insets insets = windowInsets.getInsetsIgnoringVisibility(insetTypes);
|
||||
mBottomPadding += insets.bottom;
|
||||
}
|
||||
|
||||
mLeftPadding = (int) (keyboardAttr.getFraction(
|
||||
R.styleable.Keyboard_keyboardLeftPadding, width, width, 0)
|
||||
* Settings.getValues().mSidePaddingScale);
|
||||
|
|
|
@ -23,6 +23,7 @@ import helium314.keyboard.latin.utils.DictionaryInfoUtils.USER_DICTIONARY_SUFFIX
|
|||
import helium314.keyboard.latin.utils.LayoutType
|
||||
import helium314.keyboard.latin.utils.LayoutType.Companion.folder
|
||||
import helium314.keyboard.latin.utils.LayoutUtilsCustom
|
||||
import helium314.keyboard.latin.utils.Log
|
||||
import helium314.keyboard.latin.utils.ScriptUtils.SCRIPT_LATIN
|
||||
import helium314.keyboard.latin.utils.ScriptUtils.script
|
||||
import helium314.keyboard.latin.utils.SubtypeSettings
|
||||
|
@ -51,6 +52,14 @@ class App : Application() {
|
|||
checkVersionUpgrade(this)
|
||||
app = this
|
||||
Defaults.initDynamicDefaults(this)
|
||||
|
||||
val packageInfo = packageManager.getPackageInfo(packageName, 0)
|
||||
@Suppress("DEPRECATION")
|
||||
Log.i(
|
||||
"startup", "Starting ${applicationInfo.processName} version ${packageInfo.versionName} (${
|
||||
packageInfo.versionCode
|
||||
}) on Android ${android.os.Build.VERSION.RELEASE} (SDK ${android.os.Build.VERSION.SDK_INT})"
|
||||
)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
Loading…
Add table
Reference in a new issue