Remove old keyboard parser (#344)

* remove stuff that is not used any more after parser removal
* fix some small warnings
This commit is contained in:
Helium314 2023-12-21 15:02:18 +01:00 committed by GitHub
parent 00dcbf2c62
commit c943082f98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
572 changed files with 208 additions and 30476 deletions

View file

@ -6,7 +6,6 @@
package org.dslul.openboard.inputmethod.keyboard; package org.dslul.openboard.inputmethod.keyboard;
import android.content.res.TypedArray;
import android.graphics.Rect; import android.graphics.Rect;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
@ -14,13 +13,10 @@ import android.text.TextUtils;
import org.dslul.openboard.inputmethod.keyboard.internal.KeyDrawParams; import org.dslul.openboard.inputmethod.keyboard.internal.KeyDrawParams;
import org.dslul.openboard.inputmethod.keyboard.internal.KeySpecParser; import org.dslul.openboard.inputmethod.keyboard.internal.KeySpecParser;
import org.dslul.openboard.inputmethod.keyboard.internal.KeyStyle;
import org.dslul.openboard.inputmethod.keyboard.internal.KeyVisualAttributes; import org.dslul.openboard.inputmethod.keyboard.internal.KeyVisualAttributes;
import org.dslul.openboard.inputmethod.keyboard.internal.KeyboardIconsSet; import org.dslul.openboard.inputmethod.keyboard.internal.KeyboardIconsSet;
import org.dslul.openboard.inputmethod.keyboard.internal.KeyboardParams; import org.dslul.openboard.inputmethod.keyboard.internal.KeyboardParams;
import org.dslul.openboard.inputmethod.keyboard.internal.keyboard_parser.XmlKeyboardRow;
import org.dslul.openboard.inputmethod.keyboard.internal.MoreKeySpec; import org.dslul.openboard.inputmethod.keyboard.internal.MoreKeySpec;
import org.dslul.openboard.inputmethod.latin.R;
import org.dslul.openboard.inputmethod.latin.common.Constants; import org.dslul.openboard.inputmethod.latin.common.Constants;
import org.dslul.openboard.inputmethod.latin.common.StringUtils; import org.dslul.openboard.inputmethod.latin.common.StringUtils;
@ -314,7 +310,7 @@ public class Key implements Comparable<Key> {
// get the "correct" float gap: may shift keys by one pixel, but results in more uniform gaps between keys // get the "correct" float gap: may shift keys by one pixel, but results in more uniform gaps between keys
final float horizontalGapFloat = isSpacer() ? 0 : (keyParams.mKeyboardParams.mRelativeHorizontalGap * keyParams.mKeyboardParams.mOccupiedWidth); final float horizontalGapFloat = isSpacer() ? 0 : (keyParams.mKeyboardParams.mRelativeHorizontalGap * keyParams.mKeyboardParams.mOccupiedWidth);
mHorizontalGap = Math.round(horizontalGapFloat); mHorizontalGap = Math.round(horizontalGapFloat);
mVerticalGap = Math.round(keyParams.mKeyboardParams.mVerticalGap); mVerticalGap = Math.round(keyParams.mKeyboardParams.mRelativeVerticalGap * keyParams.mKeyboardParams.mOccupiedHeight);
mWidth = Math.round(keyParams.mFullWidth - horizontalGapFloat); mWidth = Math.round(keyParams.mFullWidth - horizontalGapFloat);
// height is always rounded down, because rounding up may make the keyboard too high to fit, leading to issues // height is always rounded down, because rounding up may make the keyboard too high to fit, leading to issues
mHeight = (int) (keyParams.mFullHeight - keyParams.mKeyboardParams.mVerticalGap); mHeight = (int) (keyParams.mFullHeight - keyParams.mKeyboardParams.mVerticalGap);
@ -366,15 +362,11 @@ public class Key implements Comparable<Key> {
private static boolean needsToUpcase(final int labelFlags, final int keyboardElementId) { private static boolean needsToUpcase(final int labelFlags, final int keyboardElementId) {
if ((labelFlags & LABEL_FLAGS_PRESERVE_CASE) != 0) return false; if ((labelFlags & LABEL_FLAGS_PRESERVE_CASE) != 0) return false;
switch (keyboardElementId) { return switch (keyboardElementId) {
case KeyboardId.ELEMENT_ALPHABET_MANUAL_SHIFTED: case KeyboardId.ELEMENT_ALPHABET_MANUAL_SHIFTED, KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED,
case KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED: KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCKED, KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCK_SHIFTED -> true;
case KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCKED: default -> false;
case KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCK_SHIFTED: };
return true;
default:
return false;
}
} }
private static int computeHashCode(final Key key) { private static int computeHashCode(final Key key) {
@ -548,31 +540,22 @@ public class Key implements Comparable<Key> {
@NonNull @NonNull
public final Typeface selectTypeface(final KeyDrawParams params) { public final Typeface selectTypeface(final KeyDrawParams params) {
switch (mLabelFlags & LABEL_FLAGS_FONT_MASK) { return switch (mLabelFlags & LABEL_FLAGS_FONT_MASK) {
case LABEL_FLAGS_FONT_NORMAL: case LABEL_FLAGS_FONT_NORMAL -> Typeface.DEFAULT;
return Typeface.DEFAULT; case LABEL_FLAGS_FONT_MONO_SPACE -> Typeface.MONOSPACE;
case LABEL_FLAGS_FONT_MONO_SPACE: default -> params.mTypeface; // The type-face is specified by keyTypeface attribute.
return Typeface.MONOSPACE; };
case LABEL_FLAGS_FONT_DEFAULT:
default:
// The type-face is specified by keyTypeface attribute.
return params.mTypeface;
}
} }
public final int selectTextSize(final KeyDrawParams params) { public final int selectTextSize(final KeyDrawParams params) {
switch (mLabelFlags & LABEL_FLAGS_FOLLOW_KEY_TEXT_RATIO_MASK) { return switch (mLabelFlags & LABEL_FLAGS_FOLLOW_KEY_TEXT_RATIO_MASK) {
case LABEL_FLAGS_FOLLOW_KEY_LETTER_RATIO: case LABEL_FLAGS_FOLLOW_KEY_LETTER_RATIO -> params.mLetterSize;
return params.mLetterSize; case LABEL_FLAGS_FOLLOW_KEY_LARGE_LETTER_RATIO -> params.mLargeLetterSize;
case LABEL_FLAGS_FOLLOW_KEY_LARGE_LETTER_RATIO: case LABEL_FLAGS_FOLLOW_KEY_LABEL_RATIO -> params.mLabelSize;
return params.mLargeLetterSize; case LABEL_FLAGS_FOLLOW_KEY_HINT_LABEL_RATIO -> params.mHintLabelSize;
case LABEL_FLAGS_FOLLOW_KEY_LABEL_RATIO: // No follow key ratio flag specified.
return params.mLabelSize; default -> StringUtils.codePointCount(mLabel) == 1 ? params.mLetterSize : params.mLabelSize;
case LABEL_FLAGS_FOLLOW_KEY_HINT_LABEL_RATIO: };
return params.mHintLabelSize;
default: // No follow key ratio flag specified.
return StringUtils.codePointCount(mLabel) == 1 ? params.mLetterSize : params.mLabelSize;
}
} }
public final int selectTextColor(final KeyDrawParams params) { public final int selectTextColor(final KeyDrawParams params) {
@ -871,8 +854,8 @@ public class Key implements Comparable<Key> {
final int right = left + mWidth; final int right = left + mWidth;
final int top = getY(); final int top = getY();
final int bottom = top + mHeight; final int bottom = top + mHeight;
final int edgeX = x < left ? left : (x > right ? right : x); final int edgeX = x < left ? left : Math.min(x, right);
final int edgeY = y < top ? top : (y > bottom ? bottom : y); final int edgeY = y < top ? top : Math.min(y, bottom);
final int dx = x - edgeX; final int dx = x - edgeX;
final int dy = y - edgeY; final int dy = y - edgeY;
return dx * dx + dy * dy; return dx * dx + dy * dy;
@ -996,13 +979,6 @@ public class Key implements Comparable<Key> {
@Nullable public OptionalAttributes mOptionalAttributes; @Nullable public OptionalAttributes mOptionalAttributes;
public final boolean mEnabled; public final boolean mEnabled;
public static KeyParams newSpacer(final TypedArray keyAttr, final KeyStyle keyStyle,
final KeyboardParams params, final XmlKeyboardRow row) {
final KeyParams keyParams = new KeyParams(null, keyAttr, keyStyle, params, row);
keyParams.isSpacer = true;
return keyParams;
}
public static KeyParams newSpacer(final KeyboardParams params, final float relativeWidth) { public static KeyParams newSpacer(final KeyboardParams params, final float relativeWidth) {
final KeyParams spacer = new KeyParams(params); final KeyParams spacer = new KeyParams(params);
spacer.mRelativeWidth = relativeWidth; spacer.mRelativeWidth = relativeWidth;
@ -1065,138 +1041,6 @@ public class Key implements Comparable<Key> {
return moreKeysColumnAndFlags; return moreKeysColumnAndFlags;
} }
/**
* Create keyParams with the given top-left coordinate and extract its attributes from a key
* specification string, Key attribute array, key style, and etc.
*
* @param keySpec the key specification.
* @param keyAttr the Key XML attributes array.
* @param style the {@link KeyStyle} of this key.
* @param params the keyboard building parameters.
* @param row the row that this key belongs to. row's x-coordinate will be the right edge of
* this key.
*/
public KeyParams(@Nullable final String keySpec, @NonNull final TypedArray keyAttr,
@NonNull final KeyStyle style, @NonNull final KeyboardParams params,
@NonNull final XmlKeyboardRow row) {
mKeyboardParams = params;
mRelativeHeight = row.mRelativeRowHeight;
mRelativeWidth = row.getRelativeKeyWidth(keyAttr);
mFullHeight = row.getRowHeight();
xPos = row.getKeyX(keyAttr);
mFullWidth = row.getKeyWidth(keyAttr, xPos);
if (mRelativeWidth == -1f) {
// determine from actual width if using fillRight
mRelativeWidth = mFullWidth / mKeyboardParams.mBaseWidth;
}
yPos = row.getKeyY();
// Update row to have current x coordinate.
row.setXPos(xPos + mFullWidth);
mBackgroundType = style.getInt(keyAttr, R.styleable.Keyboard_Key_backgroundType, row.getDefaultBackgroundType());
final int baseWidth = params.mBaseWidth;
final int visualInsetsLeft = Math.round(keyAttr.getFraction(
R.styleable.Keyboard_Key_visualInsetsLeft, baseWidth, baseWidth, 0));
final int visualInsetsRight = Math.round(keyAttr.getFraction(
R.styleable.Keyboard_Key_visualInsetsRight, baseWidth, baseWidth, 0));
mLabelFlags = style.getFlags(keyAttr, R.styleable.Keyboard_Key_keyLabelFlags)
| row.getDefaultKeyLabelFlags();
final boolean needsToUpcase = needsToUpcase(mLabelFlags, params.mId.mElementId);
final Locale localeForUpcasing = params.mId.getLocale();
int actionFlags = style.getFlags(keyAttr, R.styleable.Keyboard_Key_keyActionFlags);
String[] moreKeys = style.getStringArray(keyAttr, R.styleable.Keyboard_Key_moreKeys);
mMoreKeysColumnAndFlags = getMoreKeysColumnAndFlagsAndSetNullInArray(params, moreKeys);
final String[] additionalMoreKeys;
if ((mLabelFlags & LABEL_FLAGS_DISABLE_ADDITIONAL_MORE_KEYS) != 0) {
additionalMoreKeys = null;
} else {
additionalMoreKeys = style.getStringArray(keyAttr, R.styleable.Keyboard_Key_additionalMoreKeys);
}
moreKeys = MoreKeySpec.insertAdditionalMoreKeys(moreKeys, additionalMoreKeys);
if (moreKeys != null) {
actionFlags |= ACTION_FLAGS_ENABLE_LONG_PRESS;
mMoreKeys = new MoreKeySpec[moreKeys.length];
for (int i = 0; i < moreKeys.length; i++) {
mMoreKeys[i] = new MoreKeySpec(moreKeys[i], needsToUpcase, localeForUpcasing);
}
} else {
mMoreKeys = null;
}
mActionFlags = actionFlags;
mIconId = KeySpecParser.getIconId(keySpec);
final int disabledIconId = KeySpecParser.getIconId(style.getString(keyAttr,
R.styleable.Keyboard_Key_keyIconDisabled));
final int code = KeySpecParser.getCode(keySpec);
if ((mLabelFlags & LABEL_FLAGS_FROM_CUSTOM_ACTION_LABEL) != 0) {
mLabel = params.mId.mCustomActionLabel;
} else if (code >= Character.MIN_SUPPLEMENTARY_CODE_POINT) {
// This is a workaround to have a key that has a supplementary code point in its label.
// Because we can put a string in resource neither as a XML entity of a supplementary
// code point nor as a surrogate pair.
mLabel = new StringBuilder().appendCodePoint(code).toString();
} else {
final String label = KeySpecParser.getLabel(keySpec);
mLabel = needsToUpcase
? StringUtils.toTitleCaseOfKeyLabel(label, localeForUpcasing)
: label;
}
if ((mLabelFlags & LABEL_FLAGS_DISABLE_HINT_LABEL) != 0) {
mHintLabel = null;
} else {
final String hintLabel = style.getString(keyAttr, R.styleable.Keyboard_Key_keyHintLabel);
mHintLabel = needsToUpcase
? StringUtils.toTitleCaseOfKeyLabel(hintLabel, localeForUpcasing)
: hintLabel;
}
String outputText = KeySpecParser.getOutputText(keySpec);
if (needsToUpcase) {
outputText = StringUtils.toTitleCaseOfKeyLabel(outputText, localeForUpcasing);
}
// Choose the first letter of the label as primary code if not specified.
if (code == CODE_UNSPECIFIED && TextUtils.isEmpty(outputText) && !TextUtils.isEmpty(mLabel)) {
if (StringUtils.codePointCount(mLabel) == 1) {
// Use the first letter of the hint label if shiftedLetterActivated flag is
// specified.
if ((mLabelFlags & LABEL_FLAGS_HAS_SHIFTED_LETTER_HINT) != 0 && (mLabelFlags & LABEL_FLAGS_SHIFTED_LETTER_ACTIVATED) != 0
&& !TextUtils.isEmpty(mHintLabel)) {
mCode = mHintLabel.codePointAt(0);
} else {
mCode = mLabel.codePointAt(0);
}
} else {
// In some locale and case, the character might be represented by multiple code
// points, such as upper case Eszett of German alphabet.
outputText = mLabel;
mCode = CODE_OUTPUT_TEXT;
}
} else if (code == CODE_UNSPECIFIED && outputText != null) {
if (StringUtils.codePointCount(outputText) == 1) {
mCode = outputText.codePointAt(0);
outputText = null;
} else {
mCode = CODE_OUTPUT_TEXT;
}
} else {
mCode = needsToUpcase ? StringUtils.toTitleCaseOfKeyCode(code, localeForUpcasing) : code;
}
final int altCodeInAttr = KeySpecParser.parseCode(
style.getString(keyAttr, R.styleable.Keyboard_Key_altCode), CODE_UNSPECIFIED);
final int altCode = needsToUpcase
? StringUtils.toTitleCaseOfKeyCode(altCodeInAttr, localeForUpcasing)
: altCodeInAttr;
mOptionalAttributes = OptionalAttributes.newInstance(outputText, altCode,
disabledIconId, visualInsetsLeft, visualInsetsRight);
mKeyVisualAttributes = KeyVisualAttributes.newInstance(keyAttr);
mEnabled = true;
}
public KeyParams( public KeyParams(
@NonNull final String keySpec, @NonNull final String keySpec,
@NonNull final KeyboardParams params, @NonNull final KeyboardParams params,
@ -1354,7 +1198,7 @@ public class Key implements Comparable<Key> {
mEnabled = true; mEnabled = true;
} }
/** constructor for emoji parser */ // essentially the same as the GridRows constructor, but without coordinates and outputText /** constructor for emoji parser */
public KeyParams(@Nullable final String label, final int code, @Nullable final String hintLabel, public KeyParams(@Nullable final String label, final int code, @Nullable final String hintLabel,
@Nullable final String moreKeySpecs, final int labelFlags, final KeyboardParams params) { @Nullable final String moreKeySpecs, final int labelFlags, final KeyboardParams params) {
mKeyboardParams = params; mKeyboardParams = params;
@ -1395,52 +1239,6 @@ public class Key implements Comparable<Key> {
mKeyVisualAttributes = null; mKeyVisualAttributes = null;
} }
/** constructor for <GridRows/> */
public KeyParams(@Nullable final String label, final int code, @Nullable final String outputText,
@Nullable final String hintLabel, @Nullable final String moreKeySpecs,
final int labelFlags, final int backgroundType, final int x, final int y,
final int width, final int height, final KeyboardParams params) {
mKeyboardParams = params;
mFullWidth = width;
mFullHeight = height;
mHintLabel = hintLabel;
mLabelFlags = labelFlags;
mBackgroundType = backgroundType;
xPos = x;
yPos = y;
if (moreKeySpecs != null) {
String[] moreKeys = MoreKeySpec.splitKeySpecs(moreKeySpecs);
mMoreKeysColumnAndFlags = getMoreKeysColumnAndFlagsAndSetNullInArray(params, moreKeys);
moreKeys = MoreKeySpec.insertAdditionalMoreKeys(moreKeys, null);
int actionFlags = 0;
if (moreKeys != null) {
actionFlags |= ACTION_FLAGS_ENABLE_LONG_PRESS;
mMoreKeys = new MoreKeySpec[moreKeys.length];
for (int i = 0; i < moreKeys.length; i++) {
mMoreKeys[i] = new MoreKeySpec(moreKeys[i], false, Locale.getDefault());
}
} else {
mMoreKeys = null;
}
mActionFlags = actionFlags;
} else {
// TODO: Pass keyActionFlags as an argument.
mActionFlags = ACTION_FLAGS_NO_KEY_PREVIEW;
mMoreKeys = null;
mMoreKeysColumnAndFlags = 0;
}
mLabel = label;
mOptionalAttributes = OptionalAttributes.newInstance(outputText, CODE_UNSPECIFIED,
ICON_UNDEFINED, 0 /* visualInsetsLeft */, 0 /* visualInsetsRight */);
mCode = code;
mEnabled = (code != CODE_UNSPECIFIED);
mIconId = KeyboardIconsSet.ICON_UNDEFINED;
mKeyVisualAttributes = null;
}
/** constructor for a spacer whose size MUST be determined using setDimensionsFromRelativeSize */ /** constructor for a spacer whose size MUST be determined using setDimensionsFromRelativeSize */
private KeyParams(final KeyboardParams params) { private KeyParams(final KeyboardParams params) {
isSpacer = true; // this is only for spacer! isSpacer = true; // this is only for spacer!
@ -1482,6 +1280,8 @@ public class Key implements Comparable<Key> {
mActionFlags = keyParams.mActionFlags; mActionFlags = keyParams.mActionFlags;
mKeyVisualAttributes = keyParams.mKeyVisualAttributes; mKeyVisualAttributes = keyParams.mKeyVisualAttributes;
mOptionalAttributes = keyParams.mOptionalAttributes; mOptionalAttributes = keyParams.mOptionalAttributes;
mRelativeVisualInsetLeft = keyParams.mRelativeVisualInsetLeft;
mRelativeVisualInsetRight = keyParams.mRelativeVisualInsetRight;
} }
} }
} }

View file

@ -207,7 +207,7 @@ public final class KeyboardId {
@Override @Override
public String toString() { public String toString() {
return String.format(Locale.ROOT, "[%s %s:%s %dx%d %s %s%s%s%s%s%s%s%s%s]", return String.format(Locale.ROOT, "[%s %s:%s %dx%d %s %s%s%s%s%s%s%s%s%s%s%s]",
elementIdToName(mElementId), elementIdToName(mElementId),
mSubtype.getLocale(), mSubtype.getLocale(),
mSubtype.getExtraValueOf(KEYBOARD_LAYOUT_SET), mSubtype.getExtraValueOf(KEYBOARD_LAYOUT_SET),
@ -236,54 +236,54 @@ public final class KeyboardId {
} }
public static String elementIdToName(final int elementId) { public static String elementIdToName(final int elementId) {
switch (elementId) { return switch (elementId) {
case ELEMENT_ALPHABET: return "alphabet"; case ELEMENT_ALPHABET -> "alphabet";
case ELEMENT_ALPHABET_MANUAL_SHIFTED: return "alphabetManualShifted"; case ELEMENT_ALPHABET_MANUAL_SHIFTED -> "alphabetManualShifted";
case ELEMENT_ALPHABET_AUTOMATIC_SHIFTED: return "alphabetAutomaticShifted"; case ELEMENT_ALPHABET_AUTOMATIC_SHIFTED -> "alphabetAutomaticShifted";
case ELEMENT_ALPHABET_SHIFT_LOCKED: return "alphabetShiftLocked"; case ELEMENT_ALPHABET_SHIFT_LOCKED -> "alphabetShiftLocked";
case ELEMENT_ALPHABET_SHIFT_LOCK_SHIFTED: return "alphabetShiftLockShifted"; case ELEMENT_ALPHABET_SHIFT_LOCK_SHIFTED -> "alphabetShiftLockShifted";
case ELEMENT_SYMBOLS: return "symbols"; case ELEMENT_SYMBOLS -> "symbols";
case ELEMENT_SYMBOLS_SHIFTED: return "symbolsShifted"; case ELEMENT_SYMBOLS_SHIFTED -> "symbolsShifted";
case ELEMENT_PHONE: return "phone"; case ELEMENT_PHONE -> "phone";
case ELEMENT_PHONE_SYMBOLS: return "phoneSymbols"; case ELEMENT_PHONE_SYMBOLS -> "phoneSymbols";
case ELEMENT_NUMBER: return "number"; case ELEMENT_NUMBER -> "number";
case ELEMENT_EMOJI_RECENTS: return "emojiRecents"; case ELEMENT_EMOJI_RECENTS -> "emojiRecents";
case ELEMENT_EMOJI_CATEGORY1: return "emojiCategory1"; case ELEMENT_EMOJI_CATEGORY1 -> "emojiCategory1";
case ELEMENT_EMOJI_CATEGORY2: return "emojiCategory2"; case ELEMENT_EMOJI_CATEGORY2 -> "emojiCategory2";
case ELEMENT_EMOJI_CATEGORY3: return "emojiCategory3"; case ELEMENT_EMOJI_CATEGORY3 -> "emojiCategory3";
case ELEMENT_EMOJI_CATEGORY4: return "emojiCategory4"; case ELEMENT_EMOJI_CATEGORY4 -> "emojiCategory4";
case ELEMENT_EMOJI_CATEGORY5: return "emojiCategory5"; case ELEMENT_EMOJI_CATEGORY5 -> "emojiCategory5";
case ELEMENT_EMOJI_CATEGORY6: return "emojiCategory6"; case ELEMENT_EMOJI_CATEGORY6 -> "emojiCategory6";
case ELEMENT_EMOJI_CATEGORY7: return "emojiCategory7"; case ELEMENT_EMOJI_CATEGORY7 -> "emojiCategory7";
case ELEMENT_EMOJI_CATEGORY8: return "emojiCategory8"; case ELEMENT_EMOJI_CATEGORY8 -> "emojiCategory8";
case ELEMENT_EMOJI_CATEGORY9: return "emojiCategory9"; case ELEMENT_EMOJI_CATEGORY9 -> "emojiCategory9";
case ELEMENT_EMOJI_CATEGORY10: return "emojiCategory10"; case ELEMENT_EMOJI_CATEGORY10 -> "emojiCategory10";
case ELEMENT_EMOJI_CATEGORY11: return "emojiCategory11"; case ELEMENT_EMOJI_CATEGORY11 -> "emojiCategory11";
case ELEMENT_EMOJI_CATEGORY12: return "emojiCategory12"; case ELEMENT_EMOJI_CATEGORY12 -> "emojiCategory12";
case ELEMENT_EMOJI_CATEGORY13: return "emojiCategory13"; case ELEMENT_EMOJI_CATEGORY13 -> "emojiCategory13";
case ELEMENT_EMOJI_CATEGORY14: return "emojiCategory14"; case ELEMENT_EMOJI_CATEGORY14 -> "emojiCategory14";
case ELEMENT_EMOJI_CATEGORY15: return "emojiCategory15"; case ELEMENT_EMOJI_CATEGORY15 -> "emojiCategory15";
case ELEMENT_EMOJI_CATEGORY16: return "emojiCategory16"; case ELEMENT_EMOJI_CATEGORY16 -> "emojiCategory16";
case ELEMENT_CLIPBOARD: return "clipboard"; case ELEMENT_CLIPBOARD -> "clipboard";
case ELEMENT_NUMPAD: return "numpad"; case ELEMENT_NUMPAD -> "numpad";
default: return null; default -> null;
} };
} }
public static String modeName(final int mode) { public static String modeName(final int mode) {
switch (mode) { return switch (mode) {
case MODE_TEXT: return "text"; case MODE_TEXT -> "text";
case MODE_URL: return "url"; case MODE_URL -> "url";
case MODE_EMAIL: return "email"; case MODE_EMAIL -> "email";
case MODE_IM: return "im"; case MODE_IM -> "im";
case MODE_PHONE: return "phone"; case MODE_PHONE -> "phone";
case MODE_NUMBER: return "number"; case MODE_NUMBER -> "number";
case MODE_DATE: return "date"; case MODE_DATE -> "date";
case MODE_TIME: return "time"; case MODE_TIME -> "time";
case MODE_DATETIME: return "datetime"; case MODE_DATETIME -> "datetime";
case MODE_NUMPAD: return "numpad"; case MODE_NUMPAD -> "numpad";
default: return null; default -> null;
} };
} }
public static String actionName(final int actionId) { public static String actionName(final int actionId) {

View file

@ -18,6 +18,8 @@ import java.util.List;
/** /**
* KeyboardLayout maintains the keyboard layout information. * KeyboardLayout maintains the keyboard layout information.
*/ */
// todo: this seems completely unused, see whether it can be removed, or re-purposed to contain
// some useful information about the layout (currently that's in KeyboardParser.LayoutInfos)
public class KeyboardLayout { public class KeyboardLayout {
private final int[] mKeyCodes; private final int[] mKeyCodes;
@ -110,7 +112,6 @@ public class KeyboardLayout {
layoutKeys.add(key); layoutKeys.add(key);
} }
} }
return new KeyboardLayout(layoutKeys, mostCommonKeyWidth, return new KeyboardLayout(layoutKeys, mostCommonKeyWidth, mostCommonKeyHeight, occupiedWidth, occupiedHeight);
mostCommonKeyHeight, occupiedWidth, occupiedHeight);
} }
} }

View file

@ -19,7 +19,6 @@ import org.dslul.openboard.inputmethod.latin.utils.Log;
import android.util.SparseArray; import android.util.SparseArray;
import android.util.Xml; import android.util.Xml;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodSubtype;
import org.dslul.openboard.inputmethod.keyboard.internal.KeyboardBuilder; import org.dslul.openboard.inputmethod.keyboard.internal.KeyboardBuilder;
import org.dslul.openboard.inputmethod.keyboard.internal.KeyboardParams; import org.dslul.openboard.inputmethod.keyboard.internal.KeyboardParams;
@ -30,7 +29,6 @@ import org.dslul.openboard.inputmethod.latin.R;
import org.dslul.openboard.inputmethod.latin.RichInputMethodSubtype; import org.dslul.openboard.inputmethod.latin.RichInputMethodSubtype;
import org.dslul.openboard.inputmethod.latin.utils.InputTypeUtils; import org.dslul.openboard.inputmethod.latin.utils.InputTypeUtils;
import org.dslul.openboard.inputmethod.latin.utils.ScriptUtils; import org.dslul.openboard.inputmethod.latin.utils.ScriptUtils;
import org.dslul.openboard.inputmethod.latin.utils.SubtypeLocaleUtils;
import org.dslul.openboard.inputmethod.latin.utils.XmlParseUtils; import org.dslul.openboard.inputmethod.latin.utils.XmlParseUtils;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException;
@ -78,8 +76,6 @@ public final class KeyboardLayoutSet {
new HashMap<>(); new HashMap<>();
@NonNull @NonNull
private static final UniqueKeysCache sUniqueKeysCache = UniqueKeysCache.newInstance(); private static final UniqueKeysCache sUniqueKeysCache = UniqueKeysCache.newInstance();
private final static HashMap<InputMethodSubtype, Integer> sScriptIdsForSubtypes =
new HashMap<>();
public static final class KeyboardLayoutSetException extends RuntimeException { public static final class KeyboardLayoutSetException extends RuntimeException {
public final KeyboardId mKeyboardId; public final KeyboardId mKeyboardId;
@ -92,9 +88,6 @@ public final class KeyboardLayoutSet {
private static final class ElementParams { private static final class ElementParams {
int mKeyboardXmlId; int mKeyboardXmlId;
boolean mProximityCharsCorrectionEnabled;
boolean mSupportsSplitLayout;
boolean mAllowRedundantMoreKeys;
public ElementParams() { public ElementParams() {
} }
@ -120,9 +113,6 @@ public final class KeyboardLayoutSet {
int mScriptId = ScriptUtils.SCRIPT_LATIN; int mScriptId = ScriptUtils.SCRIPT_LATIN;
// Indicates if the user has enabled the split-layout preference // Indicates if the user has enabled the split-layout preference
// and the required ProductionFlags are enabled. // and the required ProductionFlags are enabled.
boolean mIsSplitLayoutEnabledByUser;
// Indicates if split layout is actually enabled, taking into account
// whether the user has enabled it, and the keyboard layout supports it.
boolean mIsSplitLayoutEnabled; boolean mIsSplitLayoutEnabled;
// Sparse array of KeyboardLayoutSet element parameters indexed by element's id. // Sparse array of KeyboardLayoutSet element parameters indexed by element's id.
final SparseArray<ElementParams> mKeyboardLayoutSetElementIdToParamsMap = new SparseArray<>(); final SparseArray<ElementParams> mKeyboardLayoutSetElementIdToParamsMap = new SparseArray<>();
@ -142,17 +132,6 @@ public final class KeyboardLayoutSet {
sUniqueKeysCache.clear(); sUniqueKeysCache.clear();
} }
public static int getScriptId(final Resources resources,
@NonNull final InputMethodSubtype subtype) {
final Integer value = sScriptIdsForSubtypes.get(subtype);
if (null == value) {
final int scriptId = Builder.readScriptId(resources, subtype);
sScriptIdsForSubtypes.put(subtype, scriptId);
return scriptId;
}
return value;
}
KeyboardLayoutSet(final Context context, @NonNull final Params params) { KeyboardLayoutSet(final Context context, @NonNull final Params params) {
mContext = context; mContext = context;
mParams = params; mParams = params;
@ -195,9 +174,6 @@ public final class KeyboardLayoutSet {
// specified as an elementKeyboard attribute in the file. // specified as an elementKeyboard attribute in the file.
// The KeyboardId is an internal key for a Keyboard object. // The KeyboardId is an internal key for a Keyboard object.
mParams.mIsSplitLayoutEnabled = mParams.mIsSplitLayoutEnabledByUser
&& elementParams.mSupportsSplitLayout;
final KeyboardId id = new KeyboardId(keyboardLayoutSetElementId, mParams); final KeyboardId id = new KeyboardId(keyboardLayoutSetElementId, mParams);
try { try {
return getKeyboard(elementParams, id); return getKeyboard(elementParams, id);
@ -221,13 +197,11 @@ public final class KeyboardLayoutSet {
final KeyboardBuilder<KeyboardParams> builder = final KeyboardBuilder<KeyboardParams> builder =
new KeyboardBuilder<>(mContext, new KeyboardParams(sUniqueKeysCache)); new KeyboardBuilder<>(mContext, new KeyboardParams(sUniqueKeysCache));
sUniqueKeysCache.setEnabled(id.isAlphabetKeyboard()); sUniqueKeysCache.setEnabled(id.isAlphabetKeyboard());
builder.setAllowRedundantMoreKeys(elementParams.mAllowRedundantMoreKeys);
final int keyboardXmlId = elementParams.mKeyboardXmlId; final int keyboardXmlId = elementParams.mKeyboardXmlId;
builder.loadFromXml(keyboardXmlId, id); builder.load(keyboardXmlId, id);
if (mParams.mDisableTouchPositionCorrectionDataForTest) { if (mParams.mDisableTouchPositionCorrectionDataForTest) {
builder.disableTouchPositionCorrectionDataForTest(); builder.disableTouchPositionCorrectionDataForTest();
} }
builder.setProximityCharsCorrectionEnabled(elementParams.mProximityCharsCorrectionEnabled);
final Keyboard keyboard = builder.build(); final Keyboard keyboard = builder.build();
sKeyboardCache.put(id, new SoftReference<>(keyboard)); sKeyboardCache.put(id, new SoftReference<>(keyboard));
if ((id.mElementId == KeyboardId.ELEMENT_ALPHABET if ((id.mElementId == KeyboardId.ELEMENT_ALPHABET
@ -336,8 +310,8 @@ public final class KeyboardLayoutSet {
return this; return this;
} }
public Builder setSplitLayoutEnabledByUser(final boolean enabled) { public Builder setSplitLayoutEnabled(final boolean enabled) {
mParams.mIsSplitLayoutEnabledByUser = enabled; mParams.mIsSplitLayoutEnabled = enabled;
return this; return this;
} }
@ -346,59 +320,26 @@ public final class KeyboardLayoutSet {
return this; return this;
} }
// Super redux version of reading the script ID for some subtype from Xml.
static int readScriptId(final Resources resources, final InputMethodSubtype subtype) {
final String layoutSetName = KEYBOARD_LAYOUT_SET_RESOURCE_PREFIX
+ SubtypeLocaleUtils.getKeyboardLayoutSetName(subtype);
final int xmlId = getXmlId(resources, layoutSetName);
try (XmlResourceParser parser = resources.getXml(xmlId)) {
while (parser.getEventType() != XmlPullParser.END_DOCUMENT) {
// Bovinate through the XML stupidly searching for TAG_FEATURE, and read
// the script Id from it.
parser.next();
final String tag = parser.getName();
if (TAG_FEATURE.equals(tag)) {
return readScriptIdFromTagFeature(resources, parser);
}
}
} catch (final IOException | XmlPullParserException e) {
throw new RuntimeException(e.getMessage() + " in " + layoutSetName, e);
}
// If the tag is not found, then the default script is Latin.
return ScriptUtils.SCRIPT_LATIN;
}
private static int readScriptIdFromTagFeature(final Resources resources,
final XmlPullParser parser) throws IOException, XmlPullParserException {
final TypedArray featureAttr = resources.obtainAttributes(Xml.asAttributeSet(parser),
R.styleable.KeyboardLayoutSet_Feature);
try {
final int scriptId =
featureAttr.getInt(R.styleable.KeyboardLayoutSet_Feature_supportedScript,
ScriptUtils.SCRIPT_UNKNOWN);
XmlParseUtils.checkEndTag(TAG_FEATURE, parser);
return scriptId;
} finally {
featureAttr.recycle();
}
}
public KeyboardLayoutSet build() { public KeyboardLayoutSet build() {
if (mParams.mSubtype == null) if (mParams.mSubtype == null)
throw new RuntimeException("KeyboardLayoutSet subtype is not specified"); throw new RuntimeException("KeyboardLayoutSet subtype is not specified");
final int xmlId = getXmlId(mResources, mParams.mKeyboardLayoutSetName); mParams.mScriptId = ScriptUtils.getScriptFromSpellCheckerLocale(mParams.mSubtype.getLocale());
// todo: the whole parsing stuff below should be removed, but currently
// it simply breaks when it's not available
// for emojis, moreKeys and moreSuggestions there are relevant parameters included
int xmlId = getXmlId(mResources, mParams.mKeyboardLayoutSetName);
if (xmlId == 0)
xmlId = R.xml.keyboard_layout_set_default;
try { try {
parseKeyboardLayoutSet(mResources, xmlId); parseKeyboardLayoutSet(mResources, xmlId);
} catch (final IOException | XmlPullParserException e) { } catch (final IOException | XmlPullParserException e) {
throw new RuntimeException(e.getMessage() + " in " + mParams.mKeyboardLayoutSetName, throw new RuntimeException(e.getMessage() + " in " + mParams.mKeyboardLayoutSetName, e);
e);
} }
return new KeyboardLayoutSet(mContext, mParams); return new KeyboardLayoutSet(mContext, mParams);
} }
private static int getXmlId(final Resources resources, final String keyboardLayoutSetName) { private static int getXmlId(final Resources resources, final String keyboardLayoutSetName) {
final String packageName = resources.getResourcePackageName( final String packageName = resources.getResourcePackageName(R.xml.keyboard_layout_set_default);
R.xml.keyboard_layout_set_qwerty);
return resources.getIdentifier(keyboardLayoutSetName, "xml", packageName); return resources.getIdentifier(keyboardLayoutSetName, "xml", packageName);
} }
@ -427,8 +368,6 @@ public final class KeyboardLayoutSet {
final String tag = parser.getName(); final String tag = parser.getName();
if (TAG_ELEMENT.equals(tag)) { if (TAG_ELEMENT.equals(tag)) {
parseKeyboardLayoutSetElement(parser); parseKeyboardLayoutSetElement(parser);
} else if (TAG_FEATURE.equals(tag)) {
mParams.mScriptId = readScriptIdFromTagFeature(mResources, parser);
} else { } else {
throw new XmlParseUtils.IllegalStartTag(parser, tag, TAG_KEYBOARD_SET); throw new XmlParseUtils.IllegalStartTag(parser, tag, TAG_KEYBOARD_SET);
} }
@ -450,9 +389,6 @@ public final class KeyboardLayoutSet {
XmlParseUtils.checkAttributeExists(a, XmlParseUtils.checkAttributeExists(a,
R.styleable.KeyboardLayoutSet_Element_elementName, "elementName", R.styleable.KeyboardLayoutSet_Element_elementName, "elementName",
TAG_ELEMENT, parser); TAG_ELEMENT, parser);
XmlParseUtils.checkAttributeExists(a,
R.styleable.KeyboardLayoutSet_Element_elementKeyboard, "elementKeyboard",
TAG_ELEMENT, parser);
XmlParseUtils.checkEndTag(TAG_ELEMENT, parser); XmlParseUtils.checkEndTag(TAG_ELEMENT, parser);
final ElementParams elementParams = new ElementParams(); final ElementParams elementParams = new ElementParams();
@ -460,12 +396,6 @@ public final class KeyboardLayoutSet {
R.styleable.KeyboardLayoutSet_Element_elementName, 0); R.styleable.KeyboardLayoutSet_Element_elementName, 0);
elementParams.mKeyboardXmlId = a.getResourceId( elementParams.mKeyboardXmlId = a.getResourceId(
R.styleable.KeyboardLayoutSet_Element_elementKeyboard, 0); R.styleable.KeyboardLayoutSet_Element_elementKeyboard, 0);
elementParams.mProximityCharsCorrectionEnabled = a.getBoolean(
R.styleable.KeyboardLayoutSet_Element_enableProximityCharsCorrection,
false);
elementParams.mSupportsSplitLayout = false; // this is to avoid xml parser reading split layouts, todo (later): remove mSupportsSplitLayout
elementParams.mAllowRedundantMoreKeys = a.getBoolean(
R.styleable.KeyboardLayoutSet_Element_allowRedundantMoreKeys, true);
mParams.mKeyboardLayoutSetElementIdToParamsMap.put(elementName, elementParams); mParams.mKeyboardLayoutSetElementIdToParamsMap.put(elementName, elementParams);
} finally { } finally {
a.recycle(); a.recycle();

View file

@ -127,8 +127,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
.setNumberRowEnabled(settingsValues.mShowsNumberRow) .setNumberRowEnabled(settingsValues.mShowsNumberRow)
.setLanguageSwitchKeyEnabled(settingsValues.isLanguageSwitchKeyEnabled()) .setLanguageSwitchKeyEnabled(settingsValues.isLanguageSwitchKeyEnabled())
.setEmojiKeyEnabled(settingsValues.mShowsEmojiKey) .setEmojiKeyEnabled(settingsValues.mShowsEmojiKey)
.setSplitLayoutEnabledByUser(ProductionFlags.IS_SPLIT_KEYBOARD_SUPPORTED .setSplitLayoutEnabled(ProductionFlags.IS_SPLIT_KEYBOARD_SUPPORTED && settingsValues.mIsSplitKeyboardEnabled)
&& settingsValues.mIsSplitKeyboardEnabled)
.setOneHandedModeEnabled(oneHandedModeEnabled) .setOneHandedModeEnabled(oneHandedModeEnabled)
.build(); .build();
try { try {

View file

@ -36,7 +36,6 @@ import org.dslul.openboard.inputmethod.latin.common.Colors;
import org.dslul.openboard.inputmethod.latin.common.Constants; import org.dslul.openboard.inputmethod.latin.common.Constants;
import org.dslul.openboard.inputmethod.latin.common.StringUtils; import org.dslul.openboard.inputmethod.latin.common.StringUtils;
import org.dslul.openboard.inputmethod.latin.settings.Settings; import org.dslul.openboard.inputmethod.latin.settings.Settings;
import org.dslul.openboard.inputmethod.latin.settings.SettingsValues;
import org.dslul.openboard.inputmethod.latin.suggestions.MoreSuggestions; import org.dslul.openboard.inputmethod.latin.suggestions.MoreSuggestions;
import org.dslul.openboard.inputmethod.latin.suggestions.MoreSuggestionsView; import org.dslul.openboard.inputmethod.latin.suggestions.MoreSuggestionsView;
import org.dslul.openboard.inputmethod.latin.utils.TypefaceUtils; import org.dslul.openboard.inputmethod.latin.utils.TypefaceUtils;
@ -68,14 +67,10 @@ import java.util.HashSet;
* @attr ref R.styleable#Keyboard_Key_keyLabelOffCenterRatio * @attr ref R.styleable#Keyboard_Key_keyLabelOffCenterRatio
* @attr ref R.styleable#Keyboard_Key_keyHintLabelOffCenterRatio * @attr ref R.styleable#Keyboard_Key_keyHintLabelOffCenterRatio
* @attr ref R.styleable#Keyboard_Key_keyPreviewTextRatio * @attr ref R.styleable#Keyboard_Key_keyPreviewTextRatio
* @attr ref R.styleable#Keyboard_Key_keyTextColor
* @attr ref R.styleable#Keyboard_Key_keyTextColorDisabled * @attr ref R.styleable#Keyboard_Key_keyTextColorDisabled
* @attr ref R.styleable#Keyboard_Key_keyTextShadowColor * @attr ref R.styleable#Keyboard_Key_keyTextShadowColor
* @attr ref R.styleable#Keyboard_Key_keyHintLetterColor
* @attr ref R.styleable#Keyboard_Key_keyHintLabelColor
* @attr ref R.styleable#Keyboard_Key_keyShiftedLetterHintInactivatedColor * @attr ref R.styleable#Keyboard_Key_keyShiftedLetterHintInactivatedColor
* @attr ref R.styleable#Keyboard_Key_keyShiftedLetterHintActivatedColor * @attr ref R.styleable#Keyboard_Key_keyShiftedLetterHintActivatedColor
* @attr ref R.styleable#Keyboard_Key_keyPreviewTextColor
*/ */
public class KeyboardView extends View { public class KeyboardView extends View {
// XML attributes // XML attributes
@ -258,7 +253,7 @@ public class KeyboardView extends View {
} }
@Override @Override
protected void onDraw(final Canvas canvas) { protected void onDraw(@NonNull final Canvas canvas) {
super.onDraw(canvas); super.onDraw(canvas);
if (canvas.isHardwareAccelerated()) { if (canvas.isHardwareAccelerated()) {
onDrawKeyboard(canvas); onDrawKeyboard(canvas);

View file

@ -302,14 +302,10 @@ public final class MainKeyboardView extends KeyboardView implements DrawingProxy
@Override @Override
public void startWhileTypingAnimation(final int fadeInOrOut) { public void startWhileTypingAnimation(final int fadeInOrOut) {
switch (fadeInOrOut) { switch (fadeInOrOut) {
case DrawingProxy.FADE_IN: case DrawingProxy.FADE_IN -> cancelAndStartAnimators(
cancelAndStartAnimators(
mAltCodeKeyWhileTypingFadeoutAnimator, mAltCodeKeyWhileTypingFadeinAnimator); mAltCodeKeyWhileTypingFadeoutAnimator, mAltCodeKeyWhileTypingFadeinAnimator);
break; case DrawingProxy.FADE_OUT -> cancelAndStartAnimators(
case DrawingProxy.FADE_OUT:
cancelAndStartAnimators(
mAltCodeKeyWhileTypingFadeinAnimator, mAltCodeKeyWhileTypingFadeoutAnimator); mAltCodeKeyWhileTypingFadeinAnimator, mAltCodeKeyWhileTypingFadeoutAnimator);
break;
} }
} }

View file

@ -76,8 +76,7 @@ public final class MoreKeysKeyboard extends Keyboard {
mDefaultKeyWidth = keyWidth; mDefaultKeyWidth = keyWidth;
mDefaultRowHeight = rowHeight; mDefaultRowHeight = rowHeight;
final int numRows = (numKeys + numColumn - 1) / numColumn; mNumRows = (numKeys + numColumn - 1) / numColumn;
mNumRows = numRows;
final int numColumns = isMoreKeysFixedColumn ? Math.min(numKeys, numColumn) final int numColumns = isMoreKeysFixedColumn ? Math.min(numKeys, numColumn)
: getOptimizedColumns(numKeys, numColumn); : getOptimizedColumns(numKeys, numColumn);
mNumColumns = numColumns; mNumColumns = numColumns;

View file

@ -41,6 +41,7 @@ import org.dslul.openboard.inputmethod.latin.utils.ResourceUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale;
public final class PointerTracker implements PointerTrackerQueue.Element, public final class PointerTracker implements PointerTrackerQueue.Element,
BatchInputArbiterListener { BatchInputArbiterListener {
@ -256,7 +257,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
} }
final boolean ignoreModifierKey = mIsInDraggingFinger && key.isModifier(); final boolean ignoreModifierKey = mIsInDraggingFinger && key.isModifier();
if (DEBUG_LISTENER) { if (DEBUG_LISTENER) {
Log.d(TAG, String.format("[%d] onPress : %s%s%s%s", mPointerId, Log.d(TAG, String.format(Locale.US, "[%d] onPress : %s%s%s%s", mPointerId,
(key == null ? "none" : Constants.printableCode(key.getCode())), (key == null ? "none" : Constants.printableCode(key.getCode())),
ignoreModifierKey ? " ignoreModifier" : "", ignoreModifierKey ? " ignoreModifier" : "",
key.isEnabled() ? "" : " disabled", key.isEnabled() ? "" : " disabled",
@ -285,7 +286,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
if (DEBUG_LISTENER) { if (DEBUG_LISTENER) {
final String output = code == Constants.CODE_OUTPUT_TEXT final String output = code == Constants.CODE_OUTPUT_TEXT
? key.getOutputText() : Constants.printableCode(code); ? key.getOutputText() : Constants.printableCode(code);
Log.d(TAG, String.format("[%d] onCodeInput: %4d %4d %s%s%s", mPointerId, x, y, Log.d(TAG, String.format(Locale.US, "[%d] onCodeInput: %4d %4d %s%s%s%s", mPointerId, x, y,
output, ignoreModifierKey ? " ignoreModifier" : "", output, ignoreModifierKey ? " ignoreModifier" : "",
altersCode ? " altersCode" : "", key.isEnabled() ? "" : " disabled")); altersCode ? " altersCode" : "", key.isEnabled() ? "" : " disabled"));
} }
@ -318,7 +319,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
} }
final boolean ignoreModifierKey = mIsInDraggingFinger && key.isModifier(); final boolean ignoreModifierKey = mIsInDraggingFinger && key.isModifier();
if (DEBUG_LISTENER) { if (DEBUG_LISTENER) {
Log.d(TAG, String.format("[%d] onRelease : %s%s%s%s", mPointerId, Log.d(TAG, String.format(Locale.US, "[%d] onRelease : %s%s%s%s", mPointerId,
Constants.printableCode(primaryCode), Constants.printableCode(primaryCode),
withSliding ? " sliding" : "", ignoreModifierKey ? " ignoreModifier" : "", withSliding ? " sliding" : "", ignoreModifierKey ? " ignoreModifier" : "",
key.isEnabled() ? "": " disabled")); key.isEnabled() ? "": " disabled"));
@ -333,14 +334,14 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
private void callListenerOnFinishSlidingInput() { private void callListenerOnFinishSlidingInput() {
if (DEBUG_LISTENER) { if (DEBUG_LISTENER) {
Log.d(TAG, String.format("[%d] onFinishSlidingInput", mPointerId)); Log.d(TAG, String.format(Locale.US, "[%d] onFinishSlidingInput", mPointerId));
} }
sListener.onFinishSlidingInput(); sListener.onFinishSlidingInput();
} }
private void callListenerOnCancelInput() { private void callListenerOnCancelInput() {
if (DEBUG_LISTENER) { if (DEBUG_LISTENER) {
Log.d(TAG, String.format("[%d] onCancelInput", mPointerId)); Log.d(TAG, String.format(Locale.US, "[%d] onCancelInput", mPointerId));
} }
sListener.onCancelInput(); sListener.onCancelInput();
} }
@ -519,7 +520,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
@Override @Override
public void onStartBatchInput() { public void onStartBatchInput() {
if (DEBUG_LISTENER) { if (DEBUG_LISTENER) {
Log.d(TAG, String.format("[%d] onStartBatchInput", mPointerId)); Log.d(TAG, String.format(Locale.US, "[%d] onStartBatchInput", mPointerId));
} }
sListener.onStartBatchInput(); sListener.onStartBatchInput();
dismissAllMoreKeysPanels(); dismissAllMoreKeysPanels();
@ -543,7 +544,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
@Override @Override
public void onUpdateBatchInput(final InputPointers aggregatedPointers, final long eventTime) { public void onUpdateBatchInput(final InputPointers aggregatedPointers, final long eventTime) {
if (DEBUG_LISTENER) { if (DEBUG_LISTENER) {
Log.d(TAG, String.format("[%d] onUpdateBatchInput: batchPoints=%d", mPointerId, Log.d(TAG, String.format(Locale.US, "[%d] onUpdateBatchInput: batchPoints=%d", mPointerId,
aggregatedPointers.getPointerSize())); aggregatedPointers.getPointerSize()));
} }
sListener.onUpdateBatchInput(aggregatedPointers); sListener.onUpdateBatchInput(aggregatedPointers);
@ -564,7 +565,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
return; return;
} }
if (DEBUG_LISTENER) { if (DEBUG_LISTENER) {
Log.d(TAG, String.format("[%d] onEndBatchInput : batchPoints=%d", Log.d(TAG, String.format(Locale.US, "[%d] onEndBatchInput : batchPoints=%d",
mPointerId, aggregatedPointers.getPointerSize())); mPointerId, aggregatedPointers.getPointerSize()));
} }
sListener.onEndBatchInput(aggregatedPointers); sListener.onEndBatchInput(aggregatedPointers);
@ -578,7 +579,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
} }
sInGesture = false; sInGesture = false;
if (DEBUG_LISTENER) { if (DEBUG_LISTENER) {
Log.d(TAG, String.format("[%d] onCancelBatchInput", mPointerId)); Log.d(TAG, String.format(Locale.US, "[%d] onCancelBatchInput", mPointerId));
} }
sListener.onCancelBatchInput(); sListener.onCancelBatchInput();
} }
@ -608,17 +609,9 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
final int x = (int)me.getX(index); final int x = (int)me.getX(index);
final int y = (int)me.getY(index); final int y = (int)me.getY(index);
switch (action) { switch (action) {
case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_DOWN, MotionEvent.ACTION_POINTER_DOWN -> onDownEvent(x, y, eventTime, keyDetector);
case MotionEvent.ACTION_POINTER_DOWN: case MotionEvent.ACTION_UP, MotionEvent.ACTION_POINTER_UP -> onUpEvent(x, y, eventTime);
onDownEvent(x, y, eventTime, keyDetector); case MotionEvent.ACTION_CANCEL -> onCancelEvent(x, y, eventTime);
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_POINTER_UP:
onUpEvent(x, y, eventTime);
break;
case MotionEvent.ACTION_CANCEL:
onCancelEvent(x, y, eventTime);
break;
} }
} }
@ -634,7 +627,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
final int distance = getDistance(x, y, mLastX, mLastY); final int distance = getDistance(x, y, mLastX, mLastY);
if (distance < sParams.mTouchNoiseThresholdDistance) { if (distance < sParams.mTouchNoiseThresholdDistance) {
if (DEBUG_MODE) if (DEBUG_MODE)
Log.w(TAG, String.format("[%d] onDownEvent:" Log.w(TAG, String.format(Locale.US, "[%d] onDownEvent:"
+ " ignore potential noise: time=%d distance=%d", + " ignore potential noise: time=%d distance=%d",
mPointerId, deltaT, distance)); mPointerId, deltaT, distance));
cancelTrackingForAction(); cancelTrackingForAction();
@ -814,7 +807,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
private void processPhantomSuddenMoveHack(final Key key, final int x, final int y, private void processPhantomSuddenMoveHack(final Key key, final int x, final int y,
final long eventTime, final Key oldKey, final int lastX, final int lastY) { final long eventTime, final Key oldKey, final int lastX, final int lastY) {
if (DEBUG_MODE) { if (DEBUG_MODE) {
Log.w(TAG, String.format("[%d] onMoveEvent:" Log.w(TAG, String.format(Locale.US, "[%d] onMoveEvent:"
+ " phantom sudden move event (distance=%d) is translated to " + " phantom sudden move event (distance=%d) is translated to "
+ "up[%d,%d,%s]/down[%d,%d,%s] events", mPointerId, + "up[%d,%d,%s]/down[%d,%d,%s] events", mPointerId,
getDistance(x, y, lastX, lastY), getDistance(x, y, lastX, lastY),
@ -833,7 +826,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
final float radiusRatio = final float radiusRatio =
mBogusMoveEventDetector.getDistanceFromDownEvent(x, y) mBogusMoveEventDetector.getDistanceFromDownEvent(x, y)
/ keyDiagonal; / keyDiagonal;
Log.w(TAG, String.format("[%d] onMoveEvent:" Log.w(TAG, String.format(Locale.US, "[%d] onMoveEvent:"
+ " bogus down-move-up event (raidus=%.2f key diagonal) is " + " bogus down-move-up event (raidus=%.2f key diagonal) is "
+ " translated to up[%d,%d,%s]/down[%d,%d,%s] events", + " translated to up[%d,%d,%s]/down[%d,%d,%s] events",
mPointerId, radiusRatio, mPointerId, radiusRatio,
@ -883,7 +876,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
else if (getActivePointerTrackerCount() > 1 else if (getActivePointerTrackerCount() > 1
&& !sPointerTrackerQueue.hasModifierKeyOlderThan(this)) { && !sPointerTrackerQueue.hasModifierKeyOlderThan(this)) {
if (DEBUG_MODE) { if (DEBUG_MODE) {
Log.w(TAG, String.format("[%d] onMoveEvent:" Log.w(TAG, String.format(Locale.US, "[%d] onMoveEvent:"
+ " detected sliding finger while multi touching", mPointerId)); + " detected sliding finger while multi touching", mPointerId));
} }
onUpEvent(x, y, eventTime); onUpEvent(x, y, eventTime);
@ -1173,9 +1166,8 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
final int distanceFromKeyEdgeSquared = curKey.squaredDistanceToEdge(x, y); final int distanceFromKeyEdgeSquared = curKey.squaredDistanceToEdge(x, y);
if (distanceFromKeyEdgeSquared >= keyHysteresisDistanceSquared) { if (distanceFromKeyEdgeSquared >= keyHysteresisDistanceSquared) {
if (DEBUG_MODE) { if (DEBUG_MODE) {
final float distanceToEdgeRatio = (float)Math.sqrt(distanceFromKeyEdgeSquared) final float distanceToEdgeRatio = (float)Math.sqrt(distanceFromKeyEdgeSquared) / mKeyboard.mMostCommonKeyWidth;
/ mKeyboard.mMostCommonKeyWidth; Log.d(TAG, String.format(Locale.US, "[%d] isMajorEnoughMoveToBeOnNewKey:"
Log.d(TAG, String.format("[%d] isMajorEnoughMoveToBeOnNewKey:"
+" %.2f key width from key edge", mPointerId, distanceToEdgeRatio)); +" %.2f key width from key edge", mPointerId, distanceToEdgeRatio));
} }
return true; return true;
@ -1185,9 +1177,8 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
if (DEBUG_MODE) { if (DEBUG_MODE) {
final float keyDiagonal = (float)Math.hypot( final float keyDiagonal = (float)Math.hypot(
mKeyboard.mMostCommonKeyWidth, mKeyboard.mMostCommonKeyHeight); mKeyboard.mMostCommonKeyWidth, mKeyboard.mMostCommonKeyHeight);
final float lengthFromDownRatio = final float lengthFromDownRatio = mBogusMoveEventDetector.getAccumulatedDistanceFromDownKey() / keyDiagonal;
mBogusMoveEventDetector.getAccumulatedDistanceFromDownKey() / keyDiagonal; Log.d(TAG, String.format(Locale.US, "[%d] isMajorEnoughMoveToBeOnNewKey:"
Log.d(TAG, String.format("[%d] isMajorEnoughMoveToBeOnNewKey:"
+ " %.2f key diagonal from virtual down point", + " %.2f key diagonal from virtual down point",
mPointerId, lengthFromDownRatio)); mPointerId, lengthFromDownRatio));
} }
@ -1273,7 +1264,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
final long eventTime) { final long eventTime) {
final Key key = mKeyDetector.detectHitKey(x, y); final Key key = mKeyDetector.detectHitKey(x, y);
final String code = (key == null ? "none" : Constants.printableCode(key.getCode())); final String code = (key == null ? "none" : Constants.printableCode(key.getCode()));
Log.d(TAG, String.format("[%d]%s%s %4d %4d %5d %s", mPointerId, Log.d(TAG, String.format(Locale.US, "[%d]%s%s %4d %4d %5d %s", mPointerId,
(mIsTrackingForActionDisabled ? "-" : " "), title, x, y, eventTime, code)); (mIsTrackingForActionDisabled ? "-" : " "), title, x, y, eventTime, code));
} }
} }

View file

@ -27,26 +27,14 @@ public final class AlphabetShiftState {
final int oldState = mState; final int oldState = mState;
if (newShiftState) { if (newShiftState) {
switch (oldState) { switch (oldState) {
case UNSHIFTED: case UNSHIFTED -> mState = MANUAL_SHIFTED;
mState = MANUAL_SHIFTED; case AUTOMATIC_SHIFTED -> mState = MANUAL_SHIFTED_FROM_AUTO;
break; case SHIFT_LOCKED -> mState = SHIFT_LOCK_SHIFTED;
case AUTOMATIC_SHIFTED:
mState = MANUAL_SHIFTED_FROM_AUTO;
break;
case SHIFT_LOCKED:
mState = SHIFT_LOCK_SHIFTED;
break;
} }
} else { } else {
switch (oldState) { switch (oldState) {
case MANUAL_SHIFTED: case MANUAL_SHIFTED, MANUAL_SHIFTED_FROM_AUTO, AUTOMATIC_SHIFTED -> mState = UNSHIFTED;
case MANUAL_SHIFTED_FROM_AUTO: case SHIFT_LOCK_SHIFTED -> mState = SHIFT_LOCKED;
case AUTOMATIC_SHIFTED:
mState = UNSHIFTED;
break;
case SHIFT_LOCK_SHIFTED:
mState = SHIFT_LOCKED;
break;
} }
} }
if (DEBUG) if (DEBUG)
@ -57,19 +45,13 @@ public final class AlphabetShiftState {
final int oldState = mState; final int oldState = mState;
if (newShiftLockState) { if (newShiftLockState) {
switch (oldState) { switch (oldState) {
case UNSHIFTED: case UNSHIFTED, MANUAL_SHIFTED, MANUAL_SHIFTED_FROM_AUTO, AUTOMATIC_SHIFTED -> mState = SHIFT_LOCKED;
case MANUAL_SHIFTED:
case MANUAL_SHIFTED_FROM_AUTO:
case AUTOMATIC_SHIFTED:
mState = SHIFT_LOCKED;
break;
} }
} else { } else {
mState = UNSHIFTED; mState = UNSHIFTED;
} }
if (DEBUG) if (DEBUG)
Log.d(TAG, "setShiftLocked(" + newShiftLockState + "): " + toString(oldState) Log.d(TAG, "setShiftLocked(" + newShiftLockState + "): " + toString(oldState) + " > " + this);
+ " > " + this);
} }
public void setAutomaticShifted() { public void setAutomaticShifted() {
@ -111,14 +93,14 @@ public final class AlphabetShiftState {
} }
private static String toString(int state) { private static String toString(int state) {
switch (state) { return switch (state) {
case UNSHIFTED: return "UNSHIFTED"; case UNSHIFTED -> "UNSHIFTED";
case MANUAL_SHIFTED: return "MANUAL_SHIFTED"; case MANUAL_SHIFTED -> "MANUAL_SHIFTED";
case MANUAL_SHIFTED_FROM_AUTO: return "MANUAL_SHIFTED_FROM_AUTO"; case MANUAL_SHIFTED_FROM_AUTO -> "MANUAL_SHIFTED_FROM_AUTO";
case AUTOMATIC_SHIFTED: return "AUTOMATIC_SHIFTED"; case AUTOMATIC_SHIFTED -> "AUTOMATIC_SHIFTED";
case SHIFT_LOCKED: return "SHIFT_LOCKED"; case SHIFT_LOCKED -> "SHIFT_LOCKED";
case SHIFT_LOCK_SHIFTED: return "SHIFT_LOCK_SHIFTED"; case SHIFT_LOCK_SHIFTED -> "SHIFT_LOCK_SHIFTED";
default: return "UNKNOWN"; default -> "UNKNOWN";
} };
} }
} }

View file

@ -23,10 +23,7 @@ import androidx.annotation.Nullable;
* - Label optionally followed by code point (keyLabel|!code/code_name). * - Label optionally followed by code point (keyLabel|!code/code_name).
* - Icon followed by keyOutputText (!icon/icon_name|keyOutputText). * - Icon followed by keyOutputText (!icon/icon_name|keyOutputText).
* - Icon followed by code point (!icon/icon_name|!code/code_name). * - Icon followed by code point (!icon/icon_name|!code/code_name).
* Label and keyOutputText are one of the following: * Label and keyOutputText are literal strings.
* - Literal string.
* - Label reference represented by (!text/label_name), see {@link KeyboardTextsSet}.
* - String resource reference represented by (!text/resource_name), see {@link KeyboardTextsSet}.
* Icon is represented by (!icon/icon_name), see {@link KeyboardIconsSet}. * Icon is represented by (!icon/icon_name), see {@link KeyboardIconsSet}.
* Code is one of the following: * Code is one of the following:
* - Code point presented by hexadecimal string prefixed with "0x" * - Code point presented by hexadecimal string prefixed with "0x"
@ -236,7 +233,6 @@ public final class KeySpecParser {
return KeyboardIconsSet.getIconId(iconName); return KeyboardIconsSet.getIconId(iconName);
} }
@SuppressWarnings("serial")
public static final class KeySpecParserError extends RuntimeException { public static final class KeySpecParserError extends RuntimeException {
public KeySpecParserError(final String message) { public KeySpecParserError(final String message) {
super(message); super(message);

View file

@ -1,42 +0,0 @@
/*
* Copyright (C) 2012 The Android Open Source Project
* modified
* SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
*/
package org.dslul.openboard.inputmethod.keyboard.internal;
import android.content.res.TypedArray;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
public abstract class KeyStyle {
private final KeyboardTextsSet mTextsSet;
public abstract @Nullable String[] getStringArray(TypedArray a, int index);
public abstract @Nullable String getString(TypedArray a, int index);
public abstract int getInt(TypedArray a, int index, int defaultValue);
public abstract int getFlags(TypedArray a, int index);
protected KeyStyle(@NonNull final KeyboardTextsSet textsSet) {
mTextsSet = textsSet;
}
@Nullable
protected String parseString(final TypedArray a, final int index) {
if (a.hasValue(index)) {
return mTextsSet.resolveTextReference(a.getString(index));
}
return null;
}
@Nullable
protected String[] parseStringArray(final TypedArray a, final int index) {
if (a.hasValue(index)) {
final String text = mTextsSet.resolveTextReference(a.getString(index));
return MoreKeySpec.splitKeySpecs(text);
}
return null;
}
}

View file

@ -1,220 +0,0 @@
/*
* Copyright (C) 2010 The Android Open Source Project
* modified
* SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
*/
package org.dslul.openboard.inputmethod.keyboard.internal;
import android.content.res.TypedArray;
import org.dslul.openboard.inputmethod.latin.utils.Log;
import android.util.SparseArray;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import org.dslul.openboard.inputmethod.keyboard.internal.keyboard_parser.XmlKeyboardParser;
import org.dslul.openboard.inputmethod.latin.R;
import org.dslul.openboard.inputmethod.latin.utils.XmlParseUtils;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import java.util.Arrays;
import java.util.HashMap;
public final class KeyStylesSet {
private static final String TAG = KeyStylesSet.class.getSimpleName();
private static final boolean DEBUG = false;
@NonNull
private final HashMap<String, KeyStyle> mStyles = new HashMap<>();
@NonNull
private final KeyboardTextsSet mTextsSet;
@NonNull
private final KeyStyle mEmptyKeyStyle;
@NonNull
private static final String EMPTY_STYLE_NAME = "<empty>";
public KeyStylesSet(@NonNull final KeyboardTextsSet textsSet) {
mTextsSet = textsSet;
mEmptyKeyStyle = new EmptyKeyStyle(textsSet);
mStyles.put(EMPTY_STYLE_NAME, mEmptyKeyStyle);
}
private static final class EmptyKeyStyle extends KeyStyle {
EmptyKeyStyle(@NonNull final KeyboardTextsSet textsSet) {
super(textsSet);
}
@Override
@Nullable
public String[] getStringArray(final TypedArray a, final int index) {
return parseStringArray(a, index);
}
@Override
@Nullable
public String getString(final TypedArray a, final int index) {
return parseString(a, index);
}
@Override
public int getInt(final TypedArray a, final int index, final int defaultValue) {
return a.getInt(index, defaultValue);
}
@Override
public int getFlags(final TypedArray a, final int index) {
return a.getInt(index, 0);
}
}
private static final class DeclaredKeyStyle extends KeyStyle {
private final HashMap<String, KeyStyle> mStyles;
private final String mParentStyleName;
private final SparseArray<Object> mStyleAttributes = new SparseArray<>();
public DeclaredKeyStyle(@NonNull final String parentStyleName,
@NonNull final KeyboardTextsSet textsSet,
@NonNull final HashMap<String, KeyStyle> styles) {
super(textsSet);
mParentStyleName = parentStyleName;
mStyles = styles;
}
@Override
@Nullable
public String[] getStringArray(final TypedArray a, final int index) {
if (a.hasValue(index)) {
return parseStringArray(a, index);
}
final Object value = mStyleAttributes.get(index);
if (value != null) {
final String[] array = (String[])value;
return Arrays.copyOf(array, array.length);
}
final KeyStyle parentStyle = mStyles.get(mParentStyleName);
return parentStyle.getStringArray(a, index);
}
@Override
@Nullable
public String getString(final TypedArray a, final int index) {
if (a.hasValue(index)) {
return parseString(a, index);
}
final Object value = mStyleAttributes.get(index);
if (value != null) {
return (String)value;
}
final KeyStyle parentStyle = mStyles.get(mParentStyleName);
return parentStyle.getString(a, index);
}
@Override
public int getInt(final TypedArray a, final int index, final int defaultValue) {
if (a.hasValue(index)) {
return a.getInt(index, defaultValue);
}
final Object value = mStyleAttributes.get(index);
if (value != null) {
return (Integer)value;
}
final KeyStyle parentStyle = mStyles.get(mParentStyleName);
return parentStyle.getInt(a, index, defaultValue);
}
@Override
public int getFlags(final TypedArray a, final int index) {
final int parentFlags = mStyles.get(mParentStyleName).getFlags(a, index);
final Integer value = (Integer)mStyleAttributes.get(index);
final int styleFlags = (value != null) ? value : 0;
final int flags = a.getInt(index, 0);
return flags | styleFlags | parentFlags;
}
public void readKeyAttributes(final TypedArray keyAttr) {
// TODO: Currently not all Key attributes can be declared as style.
readString(keyAttr, R.styleable.Keyboard_Key_altCode);
readString(keyAttr, R.styleable.Keyboard_Key_keySpec);
readString(keyAttr, R.styleable.Keyboard_Key_keyHintLabel);
readStringArray(keyAttr, R.styleable.Keyboard_Key_moreKeys);
readStringArray(keyAttr, R.styleable.Keyboard_Key_additionalMoreKeys);
readFlags(keyAttr, R.styleable.Keyboard_Key_keyLabelFlags);
readString(keyAttr, R.styleable.Keyboard_Key_keyIconDisabled);
readInt(keyAttr, R.styleable.Keyboard_Key_maxMoreKeysColumn);
readInt(keyAttr, R.styleable.Keyboard_Key_backgroundType);
readFlags(keyAttr, R.styleable.Keyboard_Key_keyActionFlags);
}
private void readString(final TypedArray a, final int index) {
if (a.hasValue(index)) {
mStyleAttributes.put(index, parseString(a, index));
}
}
private void readInt(final TypedArray a, final int index) {
if (a.hasValue(index)) {
mStyleAttributes.put(index, a.getInt(index, 0));
}
}
private void readFlags(final TypedArray a, final int index) {
if (a.hasValue(index)) {
final Integer value = (Integer)mStyleAttributes.get(index);
final int styleFlags = value != null ? value : 0;
mStyleAttributes.put(index, a.getInt(index, 0) | styleFlags);
}
}
private void readStringArray(final TypedArray a, final int index) {
if (a.hasValue(index)) {
mStyleAttributes.put(index, parseStringArray(a, index));
}
}
}
public void parseKeyStyleAttributes(final TypedArray keyStyleAttr, final TypedArray keyAttrs,
final XmlPullParser parser) throws XmlPullParserException {
final String styleName = keyStyleAttr.getString(R.styleable.Keyboard_KeyStyle_styleName);
if (styleName == null) {
throw new XmlParseUtils.ParseException(
XmlKeyboardParser.TAG_KEY_STYLE + " has no styleName attribute", parser);
}
if (DEBUG) {
Log.d(TAG, String.format("<%s styleName=%s />",
XmlKeyboardParser.TAG_KEY_STYLE, styleName));
if (mStyles.containsKey(styleName)) {
Log.d(TAG, XmlKeyboardParser.TAG_KEY_STYLE + " " + styleName + " is overridden at "
+ parser.getPositionDescription());
}
}
final String parentStyleInAttr = keyStyleAttr.getString(
R.styleable.Keyboard_KeyStyle_parentStyle);
if (parentStyleInAttr != null && !mStyles.containsKey(parentStyleInAttr)) {
throw new XmlParseUtils.ParseException(
"Unknown parentStyle " + parentStyleInAttr, parser);
}
final String parentStyleName = (parentStyleInAttr == null) ? EMPTY_STYLE_NAME
: parentStyleInAttr;
final DeclaredKeyStyle style = new DeclaredKeyStyle(parentStyleName, mTextsSet, mStyles);
style.readKeyAttributes(keyAttrs);
mStyles.put(styleName, style);
}
@NonNull
public KeyStyle getKeyStyle(final TypedArray keyAttr, final XmlPullParser parser)
throws XmlParseUtils.ParseException {
final String styleName = keyAttr.getString(R.styleable.Keyboard_Key_keyStyle);
if (styleName == null) {
return mEmptyKeyStyle;
}
final KeyStyle style = mStyles.get(styleName);
if (style == null) {
throw new XmlParseUtils.ParseException("Unknown key style: " + styleName, parser);
}
return style;
}
}

View file

@ -47,6 +47,8 @@ public final class KeyVisualAttributes {
public final float mLabelOffCenterRatio; public final float mLabelOffCenterRatio;
public final float mHintLabelOffCenterRatio; public final float mHintLabelOffCenterRatio;
// todo: replace the remaining colors with something from new colors instead of theme
// but first check which colors are actually used
private static final int[] VISUAL_ATTRIBUTE_IDS = { private static final int[] VISUAL_ATTRIBUTE_IDS = {
R.styleable.Keyboard_Key_keyTypeface, R.styleable.Keyboard_Key_keyTypeface,
R.styleable.Keyboard_Key_keyLetterSize, R.styleable.Keyboard_Key_keyLetterSize,
@ -56,15 +58,10 @@ public final class KeyVisualAttributes {
R.styleable.Keyboard_Key_keyShiftedLetterHintRatio, R.styleable.Keyboard_Key_keyShiftedLetterHintRatio,
R.styleable.Keyboard_Key_keyHintLabelRatio, R.styleable.Keyboard_Key_keyHintLabelRatio,
R.styleable.Keyboard_Key_keyPreviewTextRatio, R.styleable.Keyboard_Key_keyPreviewTextRatio,
R.styleable.Keyboard_Key_keyTextColor, // todo: is this used anywhere
R.styleable.Keyboard_Key_keyTextInactivatedColor, R.styleable.Keyboard_Key_keyTextInactivatedColor,
R.styleable.Keyboard_Key_keyTextShadowColor, R.styleable.Keyboard_Key_keyTextShadowColor,
R.styleable.Keyboard_Key_functionalTextColor, // todo: is this used anywhere
R.styleable.Keyboard_Key_keyHintLetterColor, // todo: is this used anywhere
R.styleable.Keyboard_Key_keyHintLabelColor, // todo: is this used anywhere
R.styleable.Keyboard_Key_keyShiftedLetterHintInactivatedColor, R.styleable.Keyboard_Key_keyShiftedLetterHintInactivatedColor,
R.styleable.Keyboard_Key_keyShiftedLetterHintActivatedColor, R.styleable.Keyboard_Key_keyShiftedLetterHintActivatedColor,
R.styleable.Keyboard_Key_keyPreviewTextColor, // todo: is this used anywhere
R.styleable.Keyboard_Key_keyHintLabelVerticalAdjustment, R.styleable.Keyboard_Key_keyHintLabelVerticalAdjustment,
R.styleable.Keyboard_Key_keyLabelOffCenterRatio, R.styleable.Keyboard_Key_keyLabelOffCenterRatio,
R.styleable.Keyboard_Key_keyHintLabelOffCenterRatio R.styleable.Keyboard_Key_keyHintLabelOffCenterRatio

View file

@ -9,7 +9,6 @@ import android.content.Context
import android.content.res.Resources import android.content.res.Resources
import org.dslul.openboard.inputmethod.latin.utils.Log import org.dslul.openboard.inputmethod.latin.utils.Log
import android.util.Xml import android.util.Xml
import android.widget.Toast
import androidx.annotation.XmlRes import androidx.annotation.XmlRes
import org.dslul.openboard.inputmethod.annotations.UsedForTesting import org.dslul.openboard.inputmethod.annotations.UsedForTesting
import org.dslul.openboard.inputmethod.keyboard.Key import org.dslul.openboard.inputmethod.keyboard.Key
@ -18,17 +17,13 @@ import org.dslul.openboard.inputmethod.keyboard.Keyboard
import org.dslul.openboard.inputmethod.keyboard.KeyboardId import org.dslul.openboard.inputmethod.keyboard.KeyboardId
import org.dslul.openboard.inputmethod.keyboard.internal.keyboard_parser.EmojiParser import org.dslul.openboard.inputmethod.keyboard.internal.keyboard_parser.EmojiParser
import org.dslul.openboard.inputmethod.keyboard.internal.keyboard_parser.KeyboardParser import org.dslul.openboard.inputmethod.keyboard.internal.keyboard_parser.KeyboardParser
import org.dslul.openboard.inputmethod.keyboard.internal.keyboard_parser.XmlKeyboardParser
import org.dslul.openboard.inputmethod.keyboard.internal.keyboard_parser.addLocaleKeyTextsToParams import org.dslul.openboard.inputmethod.keyboard.internal.keyboard_parser.addLocaleKeyTextsToParams
import org.dslul.openboard.inputmethod.latin.BuildConfig
import org.dslul.openboard.inputmethod.latin.R import org.dslul.openboard.inputmethod.latin.R
import org.dslul.openboard.inputmethod.latin.common.Constants import org.dslul.openboard.inputmethod.latin.common.Constants
import org.dslul.openboard.inputmethod.latin.define.DebugFlags import org.dslul.openboard.inputmethod.latin.define.DebugFlags
import org.dslul.openboard.inputmethod.latin.settings.Settings import org.dslul.openboard.inputmethod.latin.settings.Settings
import org.dslul.openboard.inputmethod.latin.utils.sumOf import org.dslul.openboard.inputmethod.latin.utils.sumOf
import org.xmlpull.v1.XmlPullParser import org.xmlpull.v1.XmlPullParser
import org.xmlpull.v1.XmlPullParserException
import java.io.IOException
// TODO: Write unit tests for this class. // TODO: Write unit tests for this class.
open class KeyboardBuilder<KP : KeyboardParams>(protected val mContext: Context, @JvmField val mParams: KP) { open class KeyboardBuilder<KP : KeyboardParams>(protected val mContext: Context, @JvmField val mParams: KP) {
@ -52,25 +47,11 @@ open class KeyboardBuilder<KP : KeyboardParams>(protected val mContext: Context,
mParams.mAllowRedundantMoreKeys = enabled mParams.mAllowRedundantMoreKeys = enabled
} }
fun loadFromAssets(id: KeyboardId): KeyboardBuilder<KP>? {
mParams.mId = id
addLocaleKeyTextsToParams(mContext, mParams, Settings.getInstance().current.mShowMoreKeys)
try {
keysInRows = KeyboardParser.parseFromAssets(mParams, mContext) ?: return null
} catch (e: Throwable) {
if (DebugFlags.DEBUG_ENABLED || BuildConfig.DEBUG)
Toast.makeText(mContext, "error parsing keyboard: ${e.message}", Toast.LENGTH_LONG).show()
Log.e(TAG, "loading $id from assets failed", e)
return null
}
determineAbsoluteValues()
return this
// todo: further plan // todo: further plan
// next release, and possibly don't continue working here for a while (should allow finding more regressions) // after the old parser is removed
// remove the old parser // finally the spanish/german/swiss/nordic layouts can be removed and replaced by some hasExtraKeys parameter
// then finally the spanish/german/swiss/nordic layouts can be removed and replaced by some hasExtraKeys parameter // still they should keep their name though... or switch to sth like "default"?
// also the eo check could then be removed // also the "eo" check could then be removed
// and maybe the language -> layout thing could be moved to assets? and maybe even here the extra keys could be defined... // and maybe the language -> layout thing could be moved to assets? and maybe even here the extra keys could be defined...
// should be either both in method.xml, or both in assets (actually method might be more suitable) // should be either both in method.xml, or both in assets (actually method might be more suitable)
// go through a lot of todos in parsers, key, keyboardlayoutset, ... as a lot of things should only change after old parser is removed // go through a lot of todos in parsers, key, keyboardlayoutset, ... as a lot of things should only change after old parser is removed
@ -136,38 +117,21 @@ open class KeyboardBuilder<KP : KeyboardParams>(protected val mContext: Context,
// maybe remove some of the flags? or keep supporting them? // maybe remove some of the flags? or keep supporting them?
// for pcqwerty: hasShiftedLetterHint -> hasShiftedLetterHint|shiftedLetterActivated when shift is enabled, need to consider if the flag is used // for pcqwerty: hasShiftedLetterHint -> hasShiftedLetterHint|shiftedLetterActivated when shift is enabled, need to consider if the flag is used
// actually period key also has shifted letter hint // actually period key also has shifted letter hint
}
fun loadFromXml(xmlId: Int, id: KeyboardId): KeyboardBuilder<KP> { fun load(xmlId: Int, id: KeyboardId): KeyboardBuilder<KP> {
if (Settings.getInstance().current.mUseNewKeyboardParsing) { mParams.mId = id
if (id.isEmojiKeyboard) { if (id.isEmojiKeyboard) {
mParams.mId = id
readAttributes(R.xml.kbd_emoji_category1) // all the same anyway, gridRows are ignored readAttributes(R.xml.kbd_emoji_category1) // all the same anyway, gridRows are ignored
keysInRows = EmojiParser(mParams, mContext).parse(Settings.getInstance().current.mIsSplitKeyboardEnabled) keysInRows = EmojiParser(mParams, mContext).parse()
return this } else {
}
if (loadFromAssets(id) != null) {
return this
}
if (DebugFlags.DEBUG_ENABLED) {
Log.e(TAG, "falling back to old parser for $id")
Toast.makeText(mContext, "using old parser for $id", Toast.LENGTH_LONG).show()
// todo throw error?
}
}
mParams.mId = id
// loading a keyboard should set default params like mParams.readAttributes(mContext, attrs);
// attrs may be null, then default values are used (looks good for "normal" keyboards)
try { try {
XmlKeyboardParser(xmlId, mParams, mContext).use { keyboardParser -> addLocaleKeyTextsToParams(mContext, mParams, Settings.getInstance().current.mShowMoreKeys)
keysInRows = keyboardParser.parseKeyboard() keysInRows = KeyboardParser.parseFromAssets(mParams, mContext)
determineAbsoluteValues()
} catch (e: Exception) {
Log.e(TAG, "error parsing layout $id ${id.mElementId}", e)
throw e
} }
} catch (e: XmlPullParserException) {
Log.w(TAG, "keyboard XML parse error", e)
throw IllegalArgumentException(e.message, e)
} catch (e: IOException) {
Log.w(TAG, "keyboard XML parse error", e)
throw RuntimeException(e.message, e)
} }
return this return this
} }
@ -178,7 +142,7 @@ open class KeyboardBuilder<KP : KeyboardParams>(protected val mContext: Context,
while (parser.eventType != XmlPullParser.END_DOCUMENT) { while (parser.eventType != XmlPullParser.END_DOCUMENT) {
val event = parser.next() val event = parser.next()
if (event == XmlPullParser.START_TAG) { if (event == XmlPullParser.START_TAG) {
val tag = parser.name; val tag = parser.name
if ("Keyboard" == tag) { if ("Keyboard" == tag) {
mParams.readAttributes(mContext, Xml.asAttributeSet(parser)) mParams.readAttributes(mContext, Xml.asAttributeSet(parser))
return return
@ -198,7 +162,7 @@ open class KeyboardBuilder<KP : KeyboardParams>(protected val mContext: Context,
} }
open fun build(): Keyboard { open fun build(): Keyboard {
if (Settings.getInstance().current.mIsSplitKeyboardEnabled if (mParams.mId.mIsSplitLayout
&& mParams.mId.mElementId in KeyboardId.ELEMENT_ALPHABET..KeyboardId.ELEMENT_SYMBOLS_SHIFTED) { && mParams.mId.mElementId in KeyboardId.ELEMENT_ALPHABET..KeyboardId.ELEMENT_SYMBOLS_SHIFTED) {
addSplit() addSplit()
} }

View file

@ -79,10 +79,6 @@ public class KeyboardParams {
public final ArrayList<Key> mAltCodeKeysWhileTyping = new ArrayList<>(); public final ArrayList<Key> mAltCodeKeysWhileTyping = new ArrayList<>();
@NonNull @NonNull
public final KeyboardIconsSet mIconsSet = new KeyboardIconsSet(); public final KeyboardIconsSet mIconsSet = new KeyboardIconsSet();
@NonNull
public final KeyboardTextsSet mTextsSet = new KeyboardTextsSet();
@NonNull
public final KeyStylesSet mKeyStyles = new KeyStylesSet(mTextsSet);
@NonNull // todo: not good, this only works because params are currently always created for the active subtype @NonNull // todo: not good, this only works because params are currently always created for the active subtype
public final List<Locale> mSecondaryLocales = Settings.getInstance().getCurrent().mSecondaryLocales; public final List<Locale> mSecondaryLocales = Settings.getInstance().getCurrent().mSecondaryLocales;
@ -268,7 +264,6 @@ public class KeyboardParams {
mThemeId = keyboardAttr.getInt(R.styleable.Keyboard_themeId, 0); mThemeId = keyboardAttr.getInt(R.styleable.Keyboard_themeId, 0);
mIconsSet.loadIcons(keyboardAttr); mIconsSet.loadIcons(keyboardAttr);
mTextsSet.setLocale(mId.getLocale(), context);
final int resourceId = keyboardAttr.getResourceId(R.styleable.Keyboard_touchPositionCorrectionData, 0); final int resourceId = keyboardAttr.getResourceId(R.styleable.Keyboard_touchPositionCorrectionData, 0);
if (resourceId != 0) { if (resourceId != 0) {

View file

@ -1,196 +0,0 @@
/*
* Copyright (C) 2012 The Android Open Source Project
* modified
* SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
*/
package org.dslul.openboard.inputmethod.keyboard.internal;
import android.content.Context;
import android.content.res.Resources;
import android.text.TextUtils;
import org.dslul.openboard.inputmethod.latin.utils.Log;
import org.dslul.openboard.inputmethod.annotations.UsedForTesting;
import org.dslul.openboard.inputmethod.latin.RichInputMethodManager;
import org.dslul.openboard.inputmethod.latin.common.Constants;
import org.dslul.openboard.inputmethod.latin.settings.Settings;
import org.dslul.openboard.inputmethod.latin.utils.RunInLocale;
import org.dslul.openboard.inputmethod.latin.utils.SubtypeLocaleUtils;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.Locale;
// TODO: Make this an immutable class.
public final class KeyboardTextsSet {
public static final String PREFIX_TEXT = "!text/";
private static final String PREFIX_RESOURCE = "!string/";
public static final String SWITCH_TO_ALPHA_KEY_LABEL = "keylabel_to_alpha";
private static final char BACKSLASH = Constants.CODE_BACKSLASH;
private static final int MAX_REFERENCE_INDIRECTION = 10;
private Resources mResources;
private Locale mResourceLocale;
private String mResourcePackageName;
private final ArrayList<String[]> mTextsTables = new ArrayList<>();
public void setLocale(final Locale locale, final Context context) {
final Resources res = context.getResources();
// Null means the current system locale.
final String resourcePackageName = res.getResourcePackageName(
context.getApplicationInfo().labelRes);
setLocale(locale, res, resourcePackageName);
}
@UsedForTesting
public void setLocale(final Locale locale, final Resources res,
final String resourcePackageName) {
mResources = res;
// Null means the current system locale.
mResourceLocale = SubtypeLocaleUtils.NO_LANGUAGE.equals(locale.toString()) ? null : locale;
mResourcePackageName = resourcePackageName;
mTextsTables.clear();
if (Settings.getInstance().getCurrent().mShowMoreKeys > 0) {
mTextsTables.add(KeyboardTextsTable.getTextsTable(new Locale(SubtypeLocaleUtils.NO_LANGUAGE)));
return;
}
mTextsTables.add(KeyboardTextsTable.getTextsTable(locale));
if (locale != RichInputMethodManager.getInstance().getCurrentSubtypeLocale())
return; // emojiCategory calls this several times with "zz" locale
for (final Locale secondaryLocale : Settings.getInstance().getCurrent().mSecondaryLocales) {
mTextsTables.add(KeyboardTextsTable.getTextsTable(secondaryLocale));
}
}
private String getTextInternal(final String name, final int localeIndex) {
return KeyboardTextsTable.getText(name, mTextsTables.get(localeIndex));
}
public String getText(final String name) {
Log.w(getClass().getSimpleName(), "still used for resolving "+name);
return getTextInternal(name, 0); // only used for emoji and clipboard keyboards
}
private static int searchTextNameEnd(final String text, final int start) {
final int size = text.length();
for (int pos = start; pos < size; pos++) {
final char c = text.charAt(pos);
// Label name should be consisted of [a-zA-Z_0-9].
if ((c >= 'a' && c <= 'z') || c == '_' || (c >= '0' && c <= '9')) {
continue;
}
return pos;
}
return size;
}
// TODO: Resolve text reference when creating {@link KeyboardTextsTable} class.
// todo: this style of merging for different locales it not good, but how to do it better?
public String resolveTextReference(final String rawText) {
if (TextUtils.isEmpty(rawText)) {
return null;
}
if (mTextsTables.size() == 1 || !rawText.startsWith("!text/more")) {
// no need for locale-specific stuff, as they are used for moreKeys only
String text = resolveTextReferenceInternal(rawText, 0);
if (text.isEmpty())
return null;
return text;
}
// get for all languages and merge if necessary
// this is considerably slower than the simple version above, but still for all ~60 calls
// when creation a keyboard, that's only a few ms on S4 mini -> should be acceptable
final ArrayList<String> texts = new ArrayList<>(mTextsTables.size());
for (int i = 0; i < mTextsTables.size(); i++) {
final String text = resolveTextReferenceInternal(rawText, i);
if (text.length() == 0)
continue;
texts.add(text);
}
if (texts.isEmpty())
return null;
if (texts.size() == 1)
return texts.get(0);
final LinkedHashSet<String> moreKeys = new LinkedHashSet<>();
for (final String text : texts) {
// no thanks linter, we don't want to create an intermediate list
for (final String c : text.split(",")) {
moreKeys.add(c);
}
}
return String.join(",", moreKeys);
}
public String resolveTextReferenceInternal(final String rawText, final int localeIndex) {
int level = 0;
String text = rawText;
StringBuilder sb;
final int prefixLength = PREFIX_TEXT.length();
do {
level++;
if (level >= MAX_REFERENCE_INDIRECTION) {
throw new RuntimeException("Too many " + PREFIX_TEXT + " or " + PREFIX_RESOURCE +
" reference indirection: " + text);
}
final int size = text.length();
if (size < prefixLength) {
break;
}
sb = null;
for (int pos = 0; pos < size; pos++) {
final char c = text.charAt(pos);
if (text.startsWith(PREFIX_TEXT, pos)) {
if (sb == null) {
sb = new StringBuilder(text.substring(0, pos));
}
pos = expandReference(text, pos, PREFIX_TEXT, sb, localeIndex);
} else if (text.startsWith(PREFIX_RESOURCE, pos)) {
if (sb == null) {
sb = new StringBuilder(text.substring(0, pos));
}
pos = expandReference(text, pos, PREFIX_RESOURCE, sb, localeIndex);
} else if (c == BACKSLASH) {
if (sb != null) {
// Append both escape character and escaped character.
sb.append(text.substring(pos, Math.min(pos + 2, size)));
}
pos++;
} else if (sb != null) {
sb.append(c);
}
}
if (sb != null) {
text = sb.toString();
}
} while (sb != null);
return text;
}
private int expandReference(final String text, final int pos, final String prefix,
final StringBuilder sb, final int localeIndex) {
final int prefixLength = prefix.length();
final int end = searchTextNameEnd(text, pos + prefixLength);
final String name = text.substring(pos + prefixLength, end);
if (prefix.equals(PREFIX_TEXT)) {
sb.append(getTextInternal(name, localeIndex));
} else { // PREFIX_RESOURCE
final String resourcePackageName = mResourcePackageName;
final RunInLocale<String> getTextJob = new RunInLocale<String>() {
@Override
protected String job(final Resources res) {
// this is for identifiers in strings-action-keys.xml (100% sure nothing else?)
final int resId = res.getIdentifier(name, "string", resourcePackageName);
return res.getString(resId);
}
};
// no need to do it in locale, it's just labels
sb.append(getTextJob.runInLocale(mResources, mResourceLocale));
}
return end - 1;
}
}

View file

@ -66,11 +66,11 @@ import androidx.annotation.NonNull;
} }
protected String toString(int state) { protected String toString(int state) {
switch (state) { return switch (state) {
case RELEASING: return "RELEASING"; case RELEASING -> "RELEASING";
case PRESSING: return "PRESSING"; case PRESSING -> "PRESSING";
case CHORDING: return "CHORDING"; case CHORDING -> "CHORDING";
default: return "UNKNOWN"; default -> "UNKNOWN";
} };
} }
} }

View file

@ -75,8 +75,7 @@ public final class MoreKeySpec {
@Override @Override
public int hashCode() { public int hashCode() {
int hashCode = 1; int hashCode = 31 + mCode;
hashCode = 31 + mCode;
hashCode = hashCode * 31 + mIconId; hashCode = hashCode * 31 + mIconId;
final String label = mLabel; final String label = mLabel;
hashCode = hashCode * 31 + (label == null ? 0 : label.hashCode()); hashCode = hashCode * 31 + (label == null ? 0 : label.hashCode());

View file

@ -53,10 +53,10 @@ import androidx.annotation.NonNull;
@Override @Override
protected String toString(int state) { protected String toString(int state) {
switch (state) { return switch (state) {
case PRESSING_ON_SHIFTED: return "PRESSING_ON_SHIFTED"; case PRESSING_ON_SHIFTED -> "PRESSING_ON_SHIFTED";
case IGNORING: return "IGNORING"; case IGNORING -> "IGNORING";
default: return super.toString(state); default -> super.toString(state);
} };
} }
} }

View file

@ -16,7 +16,7 @@ import kotlin.math.sqrt
class EmojiParser(private val params: KeyboardParams, private val context: Context) { class EmojiParser(private val params: KeyboardParams, private val context: Context) {
fun parse(splitKeyboard: Boolean): ArrayList<ArrayList<KeyParams>> { // todo: split should be read from params, but currently this is disabled, right? fun parse(): ArrayList<ArrayList<KeyParams>> {
val emojiArrayId = when (params.mId.mElementId) { val emojiArrayId = when (params.mId.mElementId) {
KeyboardId.ELEMENT_EMOJI_RECENTS -> R.array.emoji_recents KeyboardId.ELEMENT_EMOJI_RECENTS -> R.array.emoji_recents
KeyboardId.ELEMENT_EMOJI_CATEGORY1 -> R.array.emoji_smileys_emotion KeyboardId.ELEMENT_EMOJI_CATEGORY1 -> R.array.emoji_smileys_emotion
@ -32,34 +32,11 @@ class EmojiParser(private val params: KeyboardParams, private val context: Conte
else -> throw(IllegalStateException("can only parse emoji categories where an array exists")) else -> throw(IllegalStateException("can only parse emoji categories where an array exists"))
} }
val emojiArray = context.resources.getStringArray(emojiArrayId) val emojiArray = context.resources.getStringArray(emojiArrayId)
val moreEmojisArray = if (params.mId.mElementId == KeyboardId.ELEMENT_EMOJI_CATEGORY2) val moreEmojisArray = if (params.mId.mElementId != KeyboardId.ELEMENT_EMOJI_CATEGORY2) null
context.resources.getStringArray(R.array.emoji_people_body_more) else context.resources.getStringArray(R.array.emoji_people_body_more)
else null
if (moreEmojisArray != null && emojiArray.size != moreEmojisArray.size) if (moreEmojisArray != null && emojiArray.size != moreEmojisArray.size)
throw(IllegalStateException("Inconsistent array size between codesArray and moreKeysArray")) throw(IllegalStateException("Inconsistent array size between codesArray and moreKeysArray"))
// now we have the params in one long list -> split into lines and maybe add spacer
// todo: disabled, because it doesn't work properly... spacer keys get added to the end every 3 rows
// the sorting and sizing seems to be done in DynamicGridKeyboard
// only the template keys there are relevant for dimensions, resizing keys here doesn't have any effect
// -> this is really weird and unexpected, and should be changed (might also help with the text emojis...)
/* val numColumns = (1 / params.mDefaultRelativeKeyWidth).toInt()
val spacerNumKeys: Int
val spacerWidth: Float
if (splitKeyboard) {
val spacerRelativeWidth = Settings.getInstance().current.mSpacerRelativeWidth
// adjust gaps for the whole keyboard, so it's the same for all rows
params.mRelativeHorizontalGap *= 1f / (1f + spacerRelativeWidth)
params.mHorizontalGap = (params.mRelativeHorizontalGap * params.mId.mWidth).toInt()
// round the spacer width, so it's a number of keys, and number should be even if emoji count is even, odd otherwise
spacerNumKeys = (spacerRelativeWidth / params.mDefaultRelativeKeyWidth).roundTo(numColumns % 2 == 0)
spacerWidth = spacerNumKeys * params.mDefaultRelativeKeyWidth
} else {
spacerNumKeys = 0
spacerWidth = 0f
}
val spacerIndex = if (spacerNumKeys > 0) (numColumns - spacerNumKeys) / 2 else -1
*/
val row = ArrayList<KeyParams>(emojiArray.size) val row = ArrayList<KeyParams>(emojiArray.size)
var currentX = params.mLeftPadding.toFloat() var currentX = params.mLeftPadding.toFloat()
val currentY = params.mTopPadding.toFloat() // no need to ever change, assignment to rows into rows is done in DynamicGridKeyboard val currentY = params.mTopPadding.toFloat() // no need to ever change, assignment to rows into rows is done in DynamicGridKeyboard
@ -69,7 +46,7 @@ class EmojiParser(private val params: KeyboardParams, private val context: Conte
val defaultKeyWidth = (ResourceUtils.getDefaultKeyboardWidth(context.resources) - params.mLeftPadding - params.mRightPadding) * params.mDefaultRelativeKeyWidth val defaultKeyWidth = (ResourceUtils.getDefaultKeyboardWidth(context.resources) - params.mLeftPadding - params.mRightPadding) * params.mDefaultRelativeKeyWidth
val keyWidth = defaultKeyWidth * sqrt(Settings.getInstance().current.mKeyboardHeightScale) val keyWidth = defaultKeyWidth * sqrt(Settings.getInstance().current.mKeyboardHeightScale)
val defaultKeyboardHeight = ResourceUtils.getDefaultKeyboardHeight(context.resources, false) val defaultKeyboardHeight = ResourceUtils.getDefaultKeyboardHeight(context.resources, false)
val defaultBottomPadding = context.resources.getFraction(R.fraction.config_keyboard_bottom_padding_holo, defaultKeyboardHeight, defaultKeyboardHeight); val defaultBottomPadding = context.resources.getFraction(R.fraction.config_keyboard_bottom_padding_holo, defaultKeyboardHeight, defaultKeyboardHeight)
val emojiKeyboardHeight = ResourceUtils.getDefaultKeyboardHeight(context.resources, false) * 0.75f + params.mVerticalGap - defaultBottomPadding - context.resources.getDimensionPixelSize(R.dimen.config_emoji_category_page_id_height) val emojiKeyboardHeight = ResourceUtils.getDefaultKeyboardHeight(context.resources, false) * 0.75f + params.mVerticalGap - defaultBottomPadding - context.resources.getDimensionPixelSize(R.dimen.config_emoji_category_page_id_height)
val keyHeight = emojiKeyboardHeight * params.mDefaultRelativeRowHeight * Settings.getInstance().current.mKeyboardHeightScale // still apply height scale to key val keyHeight = emojiKeyboardHeight * params.mDefaultRelativeRowHeight * Settings.getInstance().current.mKeyboardHeightScale // still apply height scale to key
@ -81,9 +58,6 @@ class EmojiParser(private val params: KeyboardParams, private val context: Conte
keyParams.mFullHeight = keyHeight keyParams.mFullHeight = keyHeight
currentX += keyParams.mFullWidth currentX += keyParams.mFullWidth
row.add(keyParams) row.add(keyParams)
// if (row.size % numColumns == spacerIndex) { // also removed for now (would be missing setting the size and updating x
// repeat(spacerNumKeys) { row.add(KeyParams.newSpacer(params, params.mDefaultRelativeKeyWidth)) }
// }
} }
return arrayListOf(row) return arrayListOf(row)
} }
@ -104,7 +78,7 @@ class EmojiParser(private val params: KeyboardParams, private val context: Conte
return labelBuilder.toString() to Constants.CODE_OUTPUT_TEXT return labelBuilder.toString() to Constants.CODE_OUTPUT_TEXT
} }
private fun parseEmojiKey(spec: String, moreKeysString: String? = null): Key.KeyParams? { private fun parseEmojiKey(spec: String, moreKeysString: String? = null): KeyParams? {
val (label, code) = getLabelAndCode(spec) ?: return null val (label, code) = getLabelAndCode(spec) ?: return null
val sb = StringBuilder() val sb = StringBuilder()
moreKeysString?.split(";")?.let { moreKeys -> moreKeysString?.split(";")?.let { moreKeys ->

View file

@ -3,6 +3,7 @@ package org.dslul.openboard.inputmethod.keyboard.internal.keyboard_parser
import android.content.Context import android.content.Context
import android.content.res.Configuration import android.content.res.Configuration
import android.content.res.Resources import android.content.res.Resources
import android.os.Build
import org.dslul.openboard.inputmethod.latin.utils.Log import org.dslul.openboard.inputmethod.latin.utils.Log
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
import android.widget.Toast import android.widget.Toast
@ -24,7 +25,6 @@ import org.dslul.openboard.inputmethod.latin.spellcheck.AndroidSpellCheckerServi
import org.dslul.openboard.inputmethod.latin.utils.InputTypeUtils import org.dslul.openboard.inputmethod.latin.utils.InputTypeUtils
import org.dslul.openboard.inputmethod.latin.utils.RunInLocale import org.dslul.openboard.inputmethod.latin.utils.RunInLocale
import org.dslul.openboard.inputmethod.latin.utils.ScriptUtils import org.dslul.openboard.inputmethod.latin.utils.ScriptUtils
import org.dslul.openboard.inputmethod.latin.utils.SubtypeLocaleUtils
import org.dslul.openboard.inputmethod.latin.utils.sumOf import org.dslul.openboard.inputmethod.latin.utils.sumOf
import java.util.Locale import java.util.Locale
@ -53,6 +53,8 @@ abstract class KeyboardParser(private val params: KeyboardParams, private val co
// this thing does too much... make it more understandable after everything is implemented // this thing does too much... make it more understandable after everything is implemented
fun parseLayoutString(layoutContent: String): ArrayList<ArrayList<KeyParams>> { fun parseLayoutString(layoutContent: String): ArrayList<ArrayList<KeyParams>> {
params.readAttributes(context, null) params.readAttributes(context, null)
params.mProximityCharsCorrectionEnabled = infos.enableProximityCharsCorrection
params.mAllowRedundantMoreKeys = infos.allowRedundantMoreKeys
if (infos.touchPositionCorrectionData == null) // need to set correctly, as it's not properly done in readAttributes with attr = null if (infos.touchPositionCorrectionData == null) // need to set correctly, as it's not properly done in readAttributes with attr = null
params.mTouchPositionCorrection.load(emptyArray()) params.mTouchPositionCorrection.load(emptyArray())
else else
@ -648,7 +650,14 @@ abstract class KeyboardParser(private val params: KeyboardParams, private val co
val ril = object : RunInLocale<String>() { // todo (later): simpler way of doing this in a single line? val ril = object : RunInLocale<String>() { // todo (later): simpler way of doing this in a single line?
override fun job(res: Resources) = res.getString(id) override fun job(res: Resources) = res.getString(id)
} }
val locale = if (params.mId.locale.toString().lowercase() == "hi_zz") Locale("en", "IN") else params.mId.locale // crappy workaround... // crappy workaround...
val locale = when (params.mId.locale.toString().lowercase()) {
"hi_zz" -> Locale("en", "IN")
"sr_zz" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
Locale.forLanguageTag("sr-Latn")
else params.mId.locale // todo: copy strings to sr-rZZ when definitely not increasing min SDK to 21
else -> params.mId.locale
}
return ril.runInLocale(context.resources, locale) return ril.runInLocale(context.resources, locale)
} }
@ -743,10 +752,10 @@ abstract class KeyboardParser(private val params: KeyboardParams, private val co
companion object { companion object {
private val TAG = KeyboardParser::class.simpleName private val TAG = KeyboardParser::class.simpleName
fun parseFromAssets(params: KeyboardParams, context: Context): ArrayList<ArrayList<KeyParams>>? { fun parseFromAssets(params: KeyboardParams, context: Context): ArrayList<ArrayList<KeyParams>> {
val id = params.mId val id = params.mId
val layoutName = params.mId.mSubtype.keyboardLayoutSetName val layoutName = params.mId.mSubtype.keyboardLayoutSetName
val layoutFileNames = context.assets.list("layouts") ?: return null val layoutFileNames = context.assets.list("layouts")!!
return when { return when {
id.mElementId == KeyboardId.ELEMENT_SYMBOLS && ScriptUtils.getScriptFromSpellCheckerLocale(params.mId.locale) == ScriptUtils.SCRIPT_ARABIC id.mElementId == KeyboardId.ELEMENT_SYMBOLS && ScriptUtils.getScriptFromSpellCheckerLocale(params.mId.locale) == ScriptUtils.SCRIPT_ARABIC
-> SimpleKeyboardParser(params, context).parseLayoutFromAssets("symbols_arabic") -> SimpleKeyboardParser(params, context).parseLayoutFromAssets("symbols_arabic")
@ -759,18 +768,17 @@ abstract class KeyboardParser(private val params: KeyboardParams, private val co
id.mElementId == KeyboardId.ELEMENT_NUMBER -> JsonKeyboardParser(params, context).parseLayoutFromAssets("number") id.mElementId == KeyboardId.ELEMENT_NUMBER -> JsonKeyboardParser(params, context).parseLayoutFromAssets("number")
id.mElementId == KeyboardId.ELEMENT_PHONE -> JsonKeyboardParser(params, context).parseLayoutFromAssets("phone") id.mElementId == KeyboardId.ELEMENT_PHONE -> JsonKeyboardParser(params, context).parseLayoutFromAssets("phone")
id.mElementId == KeyboardId.ELEMENT_PHONE_SYMBOLS -> JsonKeyboardParser(params, context).parseLayoutFromAssets("phone_symbols") id.mElementId == KeyboardId.ELEMENT_PHONE_SYMBOLS -> JsonKeyboardParser(params, context).parseLayoutFromAssets("phone_symbols")
!id.isAlphabetKeyboard -> null
layoutFileNames.contains("$layoutName.json") -> JsonKeyboardParser(params, context).parseLayoutFromAssets(layoutName) layoutFileNames.contains("$layoutName.json") -> JsonKeyboardParser(params, context).parseLayoutFromAssets(layoutName)
layoutFileNames.contains("${getSimpleLayoutName(layoutName, params)}.txt") layoutFileNames.contains("${getSimpleLayoutName(layoutName, params)}.txt")
-> SimpleKeyboardParser(params, context).parseLayoutFromAssets(layoutName) -> SimpleKeyboardParser(params, context).parseLayoutFromAssets(layoutName)
else -> null else -> throw IllegalStateException("can't parse layout $layoutName with id $id and elementId ${id.mElementId}")
} }
} }
@JvmStatic // unsupported without JvmStatic @JvmStatic // unsupported without JvmStatic
// todo: should be removed in the end (after removing old parser), and the internal layout names changed for easier finding // todo: should be removed in the end (after removing old parser), and the internal layout names changed for easier finding
// currently it's spread out everywhere... method.xml, locale_and_extra_value_to_keyboard_layout_set_map, getKeyboardLayoutNameForLocale, ... // currently it's spread out everywhere... method.xml, locale_and_extra_value_to_keyboard_layout_set_map, getKeyboardLayoutNameForLocale, ...
protected fun getSimpleLayoutName(layoutName: String, params: KeyboardParams) = when (layoutName) { protected fun getSimpleLayoutName(layoutName: String, params: KeyboardParams): String = when (layoutName) {
"swiss", "german", "serbian_qwertz" -> "qwertz" "swiss", "german", "serbian_qwertz" -> "qwertz"
"nordic", "spanish" -> if (params.mId.locale.language == "eo") "eo" else "qwerty" "nordic", "spanish" -> if (params.mId.locale.language == "eo") "eo" else "qwerty"
"south_slavic", "east_slavic" -> params.mId.locale.language // layouts are split per language now, much less convoluted "south_slavic", "east_slavic" -> params.mId.locale.language // layouts are split per language now, much less convoluted

View file

@ -342,8 +342,8 @@ private val dollar = "$" to arrayOf("£", "¢", "€", "¥", "₱")
private val euroCountries = "AD|AT|BE|BG|HR|CY|CZ|DA|EE|FI|FR|DE|GR|HU|IE|IT|XK|LV|LT|LU|MT|MO|ME|NL|PL|PT|RO|SM|SK|SI|ES|VA".toRegex() private val euroCountries = "AD|AT|BE|BG|HR|CY|CZ|DA|EE|FI|FR|DE|GR|HU|IE|IT|XK|LV|LT|LU|MT|MO|ME|NL|PL|PT|RO|SM|SK|SI|ES|VA".toRegex()
private val euroLocales = "bg|ca|cs|da|de|el|en|es|et|eu|fi|fr|ga|gl|hr|hu|it|lb|lt|lv|mt|nl|pl|pt|ro|sk|sl|sq|sr|sv".toRegex() private val euroLocales = "bg|ca|cs|da|de|el|en|es|et|eu|fi|fr|ga|gl|hr|hu|it|lb|lt|lv|mt|nl|pl|pt|ro|sk|sl|sq|sr|sv".toRegex()
const val MORE_KEYS_ALL = 2; const val MORE_KEYS_ALL = 2
const val MORE_KEYS_MORE = 1; const val MORE_KEYS_MORE = 1
const val MORE_KEYS_NORMAL = 0; const val MORE_KEYS_NORMAL = 0
const val LANGUAGE_TEXTS_FOLDER = "language_key_texts" const val LANGUAGE_TEXTS_FOLDER = "language_key_texts"

View file

@ -2,7 +2,6 @@
package org.dslul.openboard.inputmethod.keyboard.internal.keyboard_parser package org.dslul.openboard.inputmethod.keyboard.internal.keyboard_parser
import android.content.Context import android.content.Context
import org.dslul.openboard.inputmethod.latin.utils.Log
import org.dslul.openboard.inputmethod.keyboard.internal.KeyboardParams import org.dslul.openboard.inputmethod.keyboard.internal.KeyboardParams
import org.dslul.openboard.inputmethod.keyboard.internal.keyboard_parser.floris.KeyData import org.dslul.openboard.inputmethod.keyboard.internal.keyboard_parser.floris.KeyData
import org.dslul.openboard.inputmethod.keyboard.internal.keyboard_parser.floris.toTextKey import org.dslul.openboard.inputmethod.keyboard.internal.keyboard_parser.floris.toTextKey

View file

@ -1,781 +0,0 @@
package org.dslul.openboard.inputmethod.keyboard.internal.keyboard_parser;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.os.Build;
import android.text.TextUtils;
import android.util.AttributeSet;
import org.dslul.openboard.inputmethod.latin.utils.Log;
import android.util.TypedValue;
import android.util.Xml;
import org.dslul.openboard.inputmethod.keyboard.Key;
import org.dslul.openboard.inputmethod.keyboard.KeyboardId;
import org.dslul.openboard.inputmethod.keyboard.KeyboardTheme;
import org.dslul.openboard.inputmethod.keyboard.internal.CodesArrayParser;
import org.dslul.openboard.inputmethod.keyboard.internal.KeyStyle;
import org.dslul.openboard.inputmethod.keyboard.internal.KeyboardIconsSet;
import org.dslul.openboard.inputmethod.keyboard.internal.KeyboardParams;
import org.dslul.openboard.inputmethod.keyboard.internal.MoreCodesArrayParser;
import org.dslul.openboard.inputmethod.latin.R;
import org.dslul.openboard.inputmethod.latin.common.Constants;
import org.dslul.openboard.inputmethod.latin.common.StringUtils;
import org.dslul.openboard.inputmethod.latin.utils.ResourceUtils;
import org.dslul.openboard.inputmethod.latin.utils.XmlParseUtils;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Locale;
/**
* Keyboard Building helper.
*
* This class parses Keyboard XML file and returns the KeysParams to eventually build a Keyboard.
* The Keyboard XML file looks like:
* <pre>
* &lt;!-- xml/keyboard.xml --&gt;
* &lt;Keyboard keyboard_attributes*&gt;
* &lt;!-- Keyboard Content --&gt;
* &lt;Row row_attributes*&gt;
* &lt;!-- Row Content --&gt;
* &lt;Key key_attributes* /&gt;
* &lt;Spacer horizontalGap="32.0dp" /&gt;
* &lt;include keyboardLayout="@xml/other_keys"&gt;
* ...
* &lt;/Row&gt;
* &lt;include keyboardLayout="@xml/other_rows"&gt;
* ...
* &lt;/Keyboard&gt;
* </pre>
* The XML file which is included in other file must have &lt;merge&gt; as root element,
* such as:
* <pre>
* &lt;!-- xml/other_keys.xml --&gt;
* &lt;merge&gt;
* &lt;Key key_attributes* /&gt;
* ...
* &lt;/merge&gt;
* </pre>
* and
* <pre>
* &lt;!-- xml/other_rows.xml --&gt;
* &lt;merge&gt;
* &lt;Row row_attributes*&gt;
* &lt;Key key_attributes* /&gt;
* &lt;/Row&gt;
* ...
* &lt;/merge&gt;
* </pre>
* You can also use switch-case-default tags to select Rows and Keys.
* <pre>
* &lt;switch&gt;
* &lt;case case_attribute*&gt;
* &lt;!-- Any valid tags at switch position --&gt;
* &lt;/case&gt;
* ...
* &lt;default&gt;
* &lt;!-- Any valid tags at switch position --&gt;
* &lt;/default&gt;
* &lt;/switch&gt;
* </pre>
* You can declare Key style and specify styles within Key tags.
* <pre>
* &lt;switch&gt;
* &lt;case mode="email"&gt;
* &lt;key-style styleName="f1-key" parentStyle="modifier-key"
* keyLabel=".com"
* /&gt;
* &lt;/case&gt;
* &lt;case mode="url"&gt;
* &lt;key-style styleName="f1-key" parentStyle="modifier-key"
* keyLabel="http://"
* /&gt;
* &lt;/case&gt;
* &lt;/switch&gt;
* ...
* &lt;Key keyStyle="shift-key" ... /&gt;
* </pre>
*/
// TODO: Write unit tests for this class.
public class XmlKeyboardParser implements AutoCloseable {
private static final String PARSER_TAG = "XmlKeyboardParser";
private static final boolean DEBUG = false;
// Keyboard XML Tags
private static final String TAG_KEYBOARD = "Keyboard";
private static final String TAG_ROW = "Row";
private static final String TAG_GRID_ROWS = "GridRows";
private static final String TAG_KEY = "Key";
private static final String TAG_SPACER = "Spacer";
private static final String TAG_INCLUDE = "include";
private static final String TAG_MERGE = "merge";
private static final String TAG_SWITCH = "switch";
private static final String TAG_CASE = "case";
private static final String TAG_DEFAULT = "default";
public static final String TAG_KEY_STYLE = "key-style";
protected final Context mContext;
protected final Resources mResources;
private final XmlResourceParser mParser;
private int mCurrentY = 0;
private XmlKeyboardRow mCurrentRow = null;
private final KeyboardParams mParams;
private final ArrayList<ArrayList<Key.KeyParams>> keysInRows = new ArrayList<>();
public XmlKeyboardParser(final int xmlId, final KeyboardParams params, final Context context) {
mParams = params;
mContext = context;
mResources = context.getResources();
mParser = mResources.getXml(xmlId);
}
@Override
public void close() {
mParser.close();
}
private int mIndent;
private static final String SPACES = " ";
private static String spaces(final int count) {
return (count < SPACES.length()) ? SPACES.substring(0, count) : SPACES;
}
private void startTag(final String format, final Object ... args) {
Log.d(PARSER_TAG, String.format(spaces(++mIndent * 2) + format, args));
}
private void endTag(final String format, final Object ... args) {
Log.d(PARSER_TAG, String.format(spaces(mIndent-- * 2) + format, args));
}
private void startEndTag(final String format, final Object ... args) {
Log.d(PARSER_TAG, String.format(spaces(++mIndent * 2) + format, args));
mIndent--;
}
public ArrayList<ArrayList<Key.KeyParams>> parseKeyboard() throws XmlPullParserException, IOException {
final XmlPullParser parser = mParser;
if (DEBUG) startTag("<%s> %s", TAG_KEYBOARD, mParams.mId);
while (parser.getEventType() != XmlPullParser.END_DOCUMENT) {
final int event = parser.next();
if (event == XmlPullParser.START_TAG) {
final String tag = parser.getName();
if (TAG_KEYBOARD.equals(tag)) {
// can attribute parsing moved outside / public, so that params can be adjusted before parsing the content?
// will be a problem with multiple keyboards in one xml... if that exists
parseKeyboardAttributes(parser);
startKeyboard();
parseKeyboardContent(parser, false);
return keysInRows;
}
throw new XmlParseUtils.IllegalStartTag(parser, tag, TAG_KEYBOARD);
}
}
throw new XmlParseUtils.ParseException("no end tag", parser);
}
/** this and parseKeyStyle are the only place where anything is written to params */
private void parseKeyboardAttributes(final XmlPullParser parser) {
final AttributeSet attr = Xml.asAttributeSet(parser);
mParams.readAttributes(mContext, attr);
}
private void parseKeyboardContent(final XmlPullParser parser, final boolean skip)
throws XmlPullParserException, IOException {
while (parser.getEventType() != XmlPullParser.END_DOCUMENT) {
final int event = parser.next();
if (event == XmlPullParser.START_TAG) {
final String tag = parser.getName();
if (TAG_ROW.equals(tag)) {
final XmlKeyboardRow row = parseRowAttributes(parser);
if (DEBUG) startTag("<%s>%s", TAG_ROW, skip ? " skipped" : "");
if (!skip) {
startRow(row);
}
parseRowContent(parser, row, skip);
} else if (TAG_GRID_ROWS.equals(tag)) {
if (DEBUG) startTag("<%s>%s", TAG_GRID_ROWS, skip ? " skipped" : "");
parseGridRows(parser, skip);
} else if (TAG_INCLUDE.equals(tag)) {
parseIncludeKeyboardContent(parser, skip);
} else if (TAG_SWITCH.equals(tag)) {
parseSwitchKeyboardContent(parser, skip);
} else if (TAG_KEY_STYLE.equals(tag)) {
parseKeyStyle(parser, skip);
} else {
throw new XmlParseUtils.IllegalStartTag(parser, tag, TAG_ROW);
}
} else if (event == XmlPullParser.END_TAG) {
final String tag = parser.getName();
if (DEBUG) endTag("</%s>", tag);
if (TAG_KEYBOARD.equals(tag) || TAG_CASE.equals(tag) || TAG_DEFAULT.equals(tag) || TAG_MERGE.equals(tag)) {
return;
}
throw new XmlParseUtils.IllegalEndTag(parser, tag, TAG_ROW);
}
}
}
private XmlKeyboardRow parseRowAttributes(final XmlPullParser parser)
throws XmlPullParserException {
final AttributeSet attr = Xml.asAttributeSet(parser);
final TypedArray keyboardAttr = mResources.obtainAttributes(attr, R.styleable.Keyboard);
try {
if (keyboardAttr.hasValue(R.styleable.Keyboard_horizontalGap)) {
throw new XmlParseUtils.IllegalAttribute(parser, TAG_ROW, "horizontalGap");
}
if (keyboardAttr.hasValue(R.styleable.Keyboard_verticalGap)) {
throw new XmlParseUtils.IllegalAttribute(parser, TAG_ROW, "verticalGap");
}
return new XmlKeyboardRow(mResources, mParams, parser, mCurrentY);
} finally {
keyboardAttr.recycle();
}
}
private void parseRowContent(final XmlPullParser parser, final XmlKeyboardRow row,
final boolean skip) throws XmlPullParserException, IOException {
while (parser.getEventType() != XmlPullParser.END_DOCUMENT) {
final int event = parser.next();
if (event == XmlPullParser.START_TAG) {
final String tag = parser.getName();
if (TAG_KEY.equals(tag)) {
parseKey(parser, row, skip);
} else if (TAG_SPACER.equals(tag)) {
parseSpacer(parser, row, skip);
} else if (TAG_INCLUDE.equals(tag)) {
parseIncludeRowContent(parser, row, skip);
} else if (TAG_SWITCH.equals(tag)) {
parseSwitchRowContent(parser, row, skip);
} else if (TAG_KEY_STYLE.equals(tag)) {
parseKeyStyle(parser, skip);
} else {
throw new XmlParseUtils.IllegalStartTag(parser, tag, TAG_ROW);
}
} else if (event == XmlPullParser.END_TAG) {
final String tag = parser.getName();
if (DEBUG) endTag("</%s>", tag);
if (TAG_ROW.equals(tag)) {
if (!skip) {
endRow(row);
}
return;
}
if (TAG_CASE.equals(tag) || TAG_DEFAULT.equals(tag) || TAG_MERGE.equals(tag)) {
return;
}
throw new XmlParseUtils.IllegalEndTag(parser, tag, TAG_ROW);
}
}
}
private void parseGridRows(final XmlPullParser parser, final boolean skip)
throws XmlPullParserException, IOException {
if (skip) {
XmlParseUtils.checkEndTag(TAG_GRID_ROWS, parser);
if (DEBUG) {
startEndTag("<%s /> skipped", TAG_GRID_ROWS);
}
return;
}
final XmlKeyboardRow gridRows = new XmlKeyboardRow(mResources, mParams, parser, mCurrentY);
final TypedArray gridRowAttr = mResources.obtainAttributes(
Xml.asAttributeSet(parser), R.styleable.Keyboard_GridRows);
final int codesArrayId = gridRowAttr.getResourceId(
R.styleable.Keyboard_GridRows_codesArray, 0);
final int textsArrayId = gridRowAttr.getResourceId(
R.styleable.Keyboard_GridRows_textsArray, 0);
final int moreCodesArrayId = gridRowAttr.getResourceId(
R.styleable.Keyboard_GridRows_moreCodesArray, 0);
gridRowAttr.recycle();
if (codesArrayId == 0 && textsArrayId == 0) {
throw new XmlParseUtils.ParseException(
"Missing codesArray or textsArray attributes", parser);
}
if (codesArrayId != 0 && textsArrayId != 0) {
throw new XmlParseUtils.ParseException(
"Both codesArray and textsArray attributes specifed", parser);
}
if (textsArrayId != 0 && moreCodesArrayId != 0) {
throw new XmlParseUtils.ParseException(
"moreCodesArray is not compatible with textsArray", parser);
}
final String[] array = mResources.getStringArray(
codesArrayId != 0 ? codesArrayId : textsArrayId);
final String[] arrayMore = moreCodesArrayId != 0 ?
mResources.getStringArray(moreCodesArrayId) : null;
final int counts = array.length;
if (arrayMore != null && counts != arrayMore.length) {
throw new XmlParseUtils.ParseException(
"Inconsistent array size between codesArray and moreKeysArray", parser);
}
final float keyWidth = gridRows.getKeyWidth(null, 0.0f);
final int numColumns = (int)(mParams.mOccupiedWidth / keyWidth);
for (int index = 0; index < counts; index += numColumns) {
final XmlKeyboardRow row = new XmlKeyboardRow(mResources, mParams, parser, mCurrentY);
startRow(row);
final ArrayList<Key.KeyParams> keyParamsRow = keysInRows.get(keysInRows.size() - 1);
for (int c = 0; c < numColumns; c++) {
final int i = index + c;
if (i >= counts) {
break;
}
final String label;
final int code;
final String outputText;
final int supportedMinSdkVersion;
final String moreKeySpecs;
if (codesArrayId != 0) {
final String codeArraySpec = array[i];
label = CodesArrayParser.parseLabel(codeArraySpec);
code = CodesArrayParser.parseCode(codeArraySpec);
outputText = CodesArrayParser.parseOutputText(codeArraySpec);
supportedMinSdkVersion =
CodesArrayParser.getMinSupportSdkVersion(codeArraySpec);
moreKeySpecs = MoreCodesArrayParser.parseKeySpecs(
arrayMore != null ? arrayMore[i] : null);
} else {
final String textArraySpec = array[i];
// TODO: Utilize KeySpecParser or write more generic TextsArrayParser.
label = textArraySpec;
code = Constants.CODE_OUTPUT_TEXT;
outputText = textArraySpec + (char)Constants.CODE_SPACE;
supportedMinSdkVersion = 0;
moreKeySpecs = null;
}
if (Build.VERSION.SDK_INT < supportedMinSdkVersion) {
continue;
}
final int labelFlags = row.getDefaultKeyLabelFlags();
// TODO: Should be able to assign default keyActionFlags as well.
final int backgroundType = row.getDefaultBackgroundType();
final int x = (int)row.getKeyX(null);
final int y = row.getKeyY();
final int width = (int)keyWidth;
final int height = row.getRowHeight();
final String hintLabel = moreKeySpecs != null ? "\u25E5" : null;
final Key.KeyParams key = new Key.KeyParams(label, code, outputText, hintLabel, moreKeySpecs,
labelFlags, backgroundType, x, y, width, height, mParams);
// (relative) width is always default when using gridRows.getKeyWidth(null, 0.0f)
key.mRelativeWidth = mParams.mDefaultRelativeKeyWidth;
key.mRelativeHeight = gridRows.mRelativeRowHeight;
keyParamsRow.add(key);
row.advanceXPos(keyWidth);
}
endRow(row);
}
XmlParseUtils.checkEndTag(TAG_GRID_ROWS, parser);
}
private void parseKey(final XmlPullParser parser, final XmlKeyboardRow row, final boolean skip)
throws XmlPullParserException, IOException {
if (skip) {
XmlParseUtils.checkEndTag(TAG_KEY, parser);
if (DEBUG) startEndTag("<%s /> skipped", TAG_KEY);
return;
}
final TypedArray keyAttr = mResources.obtainAttributes(
Xml.asAttributeSet(parser), R.styleable.Keyboard_Key);
final KeyStyle keyStyle = mParams.mKeyStyles.getKeyStyle(keyAttr, parser);
final String keySpec = keyStyle.getString(keyAttr, R.styleable.Keyboard_Key_keySpec);
if (TextUtils.isEmpty(keySpec)) {
throw new XmlParseUtils.ParseException("Empty keySpec", parser);
}
final Key.KeyParams key = new Key.KeyParams(keySpec, keyAttr, keyStyle, mParams, row);
keyAttr.recycle();
if (DEBUG) {
startEndTag("<%s%s %s moreKeys=%s />", TAG_KEY, (key.mEnabled ? "" : " disabled"),
key, Arrays.toString(key.mMoreKeys));
}
XmlParseUtils.checkEndTag(TAG_KEY, parser);
keysInRows.get(keysInRows.size() - 1).add(key);
}
private void parseSpacer(final XmlPullParser parser, final XmlKeyboardRow row, final boolean skip)
throws XmlPullParserException, IOException {
if (skip) {
XmlParseUtils.checkEndTag(TAG_SPACER, parser);
if (DEBUG) startEndTag("<%s /> skipped", TAG_SPACER);
return;
}
final TypedArray keyAttr = mResources.obtainAttributes(
Xml.asAttributeSet(parser), R.styleable.Keyboard_Key);
final KeyStyle keyStyle = mParams.mKeyStyles.getKeyStyle(keyAttr, parser);
final Key.KeyParams spacer = Key.KeyParams.newSpacer(keyAttr, keyStyle, mParams, row);
keyAttr.recycle();
keysInRows.get(keysInRows.size() - 1).add(spacer);
if (DEBUG) startEndTag("<%s />", TAG_SPACER);
XmlParseUtils.checkEndTag(TAG_SPACER, parser);
}
private void parseIncludeKeyboardContent(final XmlPullParser parser, final boolean skip)
throws XmlPullParserException, IOException {
parseIncludeInternal(parser, null, skip);
}
private void parseIncludeRowContent(final XmlPullParser parser, final XmlKeyboardRow row,
final boolean skip) throws XmlPullParserException, IOException {
parseIncludeInternal(parser, row, skip);
}
private void parseIncludeInternal(final XmlPullParser parser, final XmlKeyboardRow row,
final boolean skip) throws XmlPullParserException, IOException {
if (skip) {
XmlParseUtils.checkEndTag(TAG_INCLUDE, parser);
if (DEBUG) startEndTag("</%s> skipped", TAG_INCLUDE);
return;
}
final AttributeSet attr = Xml.asAttributeSet(parser);
final TypedArray keyboardAttr = mResources.obtainAttributes(
attr, R.styleable.Keyboard_Include);
final TypedArray keyAttr = mResources.obtainAttributes(attr, R.styleable.Keyboard_Key);
final int keyboardLayout;
try {
XmlParseUtils.checkAttributeExists(
keyboardAttr, R.styleable.Keyboard_Include_keyboardLayout, "keyboardLayout",
TAG_INCLUDE, parser);
keyboardLayout = keyboardAttr.getResourceId(
R.styleable.Keyboard_Include_keyboardLayout, 0);
if (row != null) {
// Override current x coordinate.
row.setXPos(row.getKeyX(keyAttr));
// Push current Row attributes and update with new attributes.
row.pushRowAttributes(keyAttr);
}
} finally {
keyboardAttr.recycle();
keyAttr.recycle();
}
XmlParseUtils.checkEndTag(TAG_INCLUDE, parser);
if (DEBUG) {
startEndTag("<%s keyboardLayout=%s />",TAG_INCLUDE,
mResources.getResourceEntryName(keyboardLayout));
}
try (XmlResourceParser parserForInclude = mResources.getXml(keyboardLayout)) {
parseMerge(parserForInclude, row, skip);
} finally {
if (row != null) {
// Restore Row attributes.
row.popRowAttributes();
}
}
}
private void parseMerge(final XmlPullParser parser, final XmlKeyboardRow row, final boolean skip)
throws XmlPullParserException, IOException {
if (DEBUG) startTag("<%s>", TAG_MERGE);
while (parser.getEventType() != XmlPullParser.END_DOCUMENT) {
final int event = parser.next();
if (event == XmlPullParser.START_TAG) {
final String tag = parser.getName();
if (TAG_MERGE.equals(tag)) {
if (row == null) {
parseKeyboardContent(parser, skip);
} else {
parseRowContent(parser, row, skip);
}
return;
}
throw new XmlParseUtils.ParseException(
"Included keyboard layout must have <merge> root element", parser);
}
}
}
private void parseSwitchKeyboardContent(final XmlPullParser parser, final boolean skip)
throws XmlPullParserException, IOException {
parseSwitchInternal(parser, null, skip);
}
private void parseSwitchRowContent(final XmlPullParser parser, final XmlKeyboardRow row,
final boolean skip) throws XmlPullParserException, IOException {
parseSwitchInternal(parser, row, skip);
}
private void parseSwitchInternal(final XmlPullParser parser, final XmlKeyboardRow row,
final boolean skip) throws XmlPullParserException, IOException {
if (DEBUG) startTag("<%s> %s", TAG_SWITCH, mParams.mId);
boolean selected = false;
while (parser.getEventType() != XmlPullParser.END_DOCUMENT) {
final int event = parser.next();
if (event == XmlPullParser.START_TAG) {
final String tag = parser.getName();
if (TAG_CASE.equals(tag)) {
selected |= parseCase(parser, row, selected || skip);
} else if (TAG_DEFAULT.equals(tag)) {
selected |= parseDefault(parser, row, selected || skip);
} else {
throw new XmlParseUtils.IllegalStartTag(parser, tag, TAG_SWITCH);
}
} else if (event == XmlPullParser.END_TAG) {
final String tag = parser.getName();
if (TAG_SWITCH.equals(tag)) {
if (DEBUG) endTag("</%s>", TAG_SWITCH);
return;
}
throw new XmlParseUtils.IllegalEndTag(parser, tag, TAG_SWITCH);
}
}
}
private boolean parseCase(final XmlPullParser parser, final XmlKeyboardRow row, final boolean skip)
throws XmlPullParserException, IOException {
final boolean selected = parseCaseCondition(parser);
if (row == null) {
// Processing Rows.
parseKeyboardContent(parser, !selected || skip);
} else {
// Processing Keys.
parseRowContent(parser, row, !selected || skip);
}
return selected;
}
private boolean parseCaseCondition(final XmlPullParser parser) {
final KeyboardId id = mParams.mId;
if (id == null) {
return true;
}
final AttributeSet attr = Xml.asAttributeSet(parser);
final TypedArray caseAttr = mResources.obtainAttributes(attr, R.styleable.Keyboard_Case);
try {
final boolean keyboardLayoutSetMatched = matchString(caseAttr,
R.styleable.Keyboard_Case_keyboardLayoutSet,
id.mSubtype.getKeyboardLayoutSetName());
final boolean keyboardLayoutSetElementMatched = matchTypedValue(caseAttr,
R.styleable.Keyboard_Case_keyboardLayoutSetElement, id.mElementId,
KeyboardId.elementIdToName(id.mElementId));
final boolean keyboardThemeMacthed = matchTypedValue(caseAttr,
R.styleable.Keyboard_Case_keyboardTheme, mParams.mThemeId,
KeyboardTheme.getKeyboardThemeName(mParams.mThemeId));
final boolean modeMatched = matchTypedValue(caseAttr,
R.styleable.Keyboard_Case_mode, id.mMode, KeyboardId.modeName(id.mMode));
final boolean navigateNextMatched = matchBoolean(caseAttr,
R.styleable.Keyboard_Case_navigateNext, id.navigateNext());
final boolean navigatePreviousMatched = matchBoolean(caseAttr,
R.styleable.Keyboard_Case_navigatePrevious, id.navigatePrevious());
final boolean passwordInputMatched = matchBoolean(caseAttr,
R.styleable.Keyboard_Case_passwordInput, id.passwordInput());
final boolean clobberSettingsKeyMatched = matchBoolean(caseAttr,
R.styleable.Keyboard_Case_clobberSettingsKey, id.mDeviceLocked);
final boolean hasShortcutKeyMatched = matchBoolean(caseAttr,
R.styleable.Keyboard_Case_hasShortcutKey, id.mHasShortcutKey);
final boolean numberRowEnabledMatched = matchBoolean(caseAttr,
R.styleable.Keyboard_Case_numberRowEnabled,
id.mNumberRowEnabled);
final boolean languageSwitchKeyEnabledMatched = matchBoolean(caseAttr,
R.styleable.Keyboard_Case_languageSwitchKeyEnabled,
id.mLanguageSwitchKeyEnabled);
final boolean emojiKeyEnabledMatched = matchBoolean(caseAttr,
R.styleable.Keyboard_Case_emojiKeyEnabled,
id.mEmojiKeyEnabled);
final boolean isMultiLineMatched = matchBoolean(caseAttr,
R.styleable.Keyboard_Case_isMultiLine, id.isMultiLine());
final boolean imeActionMatched = matchInteger(caseAttr,
R.styleable.Keyboard_Case_imeAction, id.imeAction());
final boolean isIconDefinedMatched = isIconDefined(caseAttr,
R.styleable.Keyboard_Case_isIconDefined, mParams.mIconsSet);
final Locale locale = id.getLocale();
final boolean localeCodeMatched = matchLocaleCodes(caseAttr, locale);
final boolean languageCodeMatched = matchLanguageCodes(caseAttr, locale);
final boolean countryCodeMatched = matchCountryCodes(caseAttr, locale);
final boolean splitLayoutMatched = matchBoolean(caseAttr,
R.styleable.Keyboard_Case_isSplitLayout, id.mIsSplitLayout);
final boolean oneHandedModeEnabledMatched = matchBoolean(caseAttr,
R.styleable.Keyboard_Case_oneHandedModeEnabled,
id.mOneHandedModeEnabled);
final boolean selected = keyboardLayoutSetMatched && keyboardLayoutSetElementMatched
&& keyboardThemeMacthed && modeMatched && navigateNextMatched
&& navigatePreviousMatched && passwordInputMatched && clobberSettingsKeyMatched
&& hasShortcutKeyMatched && numberRowEnabledMatched && languageSwitchKeyEnabledMatched
&& emojiKeyEnabledMatched && isMultiLineMatched && imeActionMatched && isIconDefinedMatched
&& localeCodeMatched && languageCodeMatched && countryCodeMatched
&& splitLayoutMatched && oneHandedModeEnabledMatched;
if (DEBUG) {
startTag("<%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s>%s", TAG_CASE,
textAttr(caseAttr.getString(
R.styleable.Keyboard_Case_keyboardLayoutSet), "keyboardLayoutSet"),
textAttr(caseAttr.getString(
R.styleable.Keyboard_Case_keyboardLayoutSetElement),
"keyboardLayoutSetElement"),
textAttr(caseAttr.getString(
R.styleable.Keyboard_Case_keyboardTheme), "keyboardTheme"),
textAttr(caseAttr.getString(R.styleable.Keyboard_Case_mode), "mode"),
textAttr(caseAttr.getString(R.styleable.Keyboard_Case_imeAction),
"imeAction"),
booleanAttr(caseAttr, R.styleable.Keyboard_Case_navigateNext,
"navigateNext"),
booleanAttr(caseAttr, R.styleable.Keyboard_Case_navigatePrevious,
"navigatePrevious"),
booleanAttr(caseAttr, R.styleable.Keyboard_Case_clobberSettingsKey,
"clobberSettingsKey"),
booleanAttr(caseAttr, R.styleable.Keyboard_Case_passwordInput,
"passwordInput"),
booleanAttr(caseAttr, R.styleable.Keyboard_Case_hasShortcutKey,
"hasShortcutKey"),
booleanAttr(caseAttr, R.styleable.Keyboard_Case_numberRowEnabled,
"numberRowEnabled"),
booleanAttr(caseAttr, R.styleable.Keyboard_Case_languageSwitchKeyEnabled,
"languageSwitchKeyEnabled"),
booleanAttr(caseAttr, R.styleable.Keyboard_Case_emojiKeyEnabled,
"emojiKeyEnabled"),
booleanAttr(caseAttr, R.styleable.Keyboard_Case_isMultiLine,
"isMultiLine"),
booleanAttr(caseAttr, R.styleable.Keyboard_Case_isSplitLayout,
"splitLayout"),
textAttr(caseAttr.getString(R.styleable.Keyboard_Case_isIconDefined),
"isIconDefined"),
textAttr(caseAttr.getString(R.styleable.Keyboard_Case_localeCode),
"localeCode"),
textAttr(caseAttr.getString(R.styleable.Keyboard_Case_languageCode),
"languageCode"),
textAttr(caseAttr.getString(R.styleable.Keyboard_Case_countryCode),
"countryCode"),
booleanAttr(caseAttr, R.styleable.Keyboard_Case_oneHandedModeEnabled,
"oneHandedModeEnabled"),
selected ? "" : " skipped");
}
return selected;
} finally {
caseAttr.recycle();
}
}
private static boolean matchLocaleCodes(TypedArray caseAttr, final Locale locale) {
return matchString(caseAttr, R.styleable.Keyboard_Case_localeCode, locale.toString());
}
private static boolean matchLanguageCodes(TypedArray caseAttr, Locale locale) {
return matchString(caseAttr, R.styleable.Keyboard_Case_languageCode, locale.getLanguage());
}
private static boolean matchCountryCodes(TypedArray caseAttr, Locale locale) {
return matchString(caseAttr, R.styleable.Keyboard_Case_countryCode, locale.getCountry());
}
private static boolean matchInteger(final TypedArray a, final int index, final int value) {
// If <case> does not have "index" attribute, that means this <case> is wild-card for
// the attribute.
return !a.hasValue(index) || a.getInt(index, 0) == value;
}
private static boolean matchBoolean(final TypedArray a, final int index, final boolean value) {
// If <case> does not have "index" attribute, that means this <case> is wild-card for
// the attribute.
return !a.hasValue(index) || a.getBoolean(index, false) == value;
}
private static boolean matchString(final TypedArray a, final int index, final String value) {
// If <case> does not have "index" attribute, that means this <case> is wild-card for
// the attribute.
return !a.hasValue(index)
|| StringUtils.containsInArray(value, a.getString(index).split("\\|"));
}
private static boolean matchTypedValue(final TypedArray a, final int index, final int intValue,
final String strValue) {
// If <case> does not have "index" attribute, that means this <case> is wild-card for
// the attribute.
final TypedValue v = a.peekValue(index);
if (v == null) {
return true;
}
if (ResourceUtils.isIntegerValue(v)) {
return intValue == a.getInt(index, 0);
}
if (ResourceUtils.isStringValue(v)) {
return StringUtils.containsInArray(strValue, a.getString(index).split("\\|"));
}
return false;
}
private static boolean isIconDefined(final TypedArray a, final int index,
final KeyboardIconsSet iconsSet) {
if (!a.hasValue(index)) {
return true;
}
final String iconName = a.getString(index);
final int iconId = KeyboardIconsSet.getIconId(iconName);
return iconsSet.getIconDrawable(iconId) != null;
}
private boolean parseDefault(final XmlPullParser parser, final XmlKeyboardRow row,
final boolean skip) throws XmlPullParserException, IOException {
if (DEBUG) startTag("<%s>", TAG_DEFAULT);
if (row == null) {
parseKeyboardContent(parser, skip);
} else {
parseRowContent(parser, row, skip);
}
return true;
}
private void parseKeyStyle(final XmlPullParser parser, final boolean skip)
throws XmlPullParserException, IOException {
final AttributeSet attr = Xml.asAttributeSet(parser);
final TypedArray keyStyleAttr = mResources.obtainAttributes(
attr, R.styleable.Keyboard_KeyStyle);
final TypedArray keyAttrs = mResources.obtainAttributes(attr, R.styleable.Keyboard_Key);
try {
if (!keyStyleAttr.hasValue(R.styleable.Keyboard_KeyStyle_styleName)) {
throw new XmlParseUtils.ParseException("<" + TAG_KEY_STYLE
+ "/> needs styleName attribute", parser);
}
if (DEBUG) {
startEndTag("<%s styleName=%s />%s", TAG_KEY_STYLE,
keyStyleAttr.getString(R.styleable.Keyboard_KeyStyle_styleName),
skip ? " skipped" : "");
}
if (!skip) {
mParams.mKeyStyles.parseKeyStyleAttributes(keyStyleAttr, keyAttrs, parser);
}
} finally {
keyStyleAttr.recycle();
keyAttrs.recycle();
}
XmlParseUtils.checkEndTag(TAG_KEY_STYLE, parser);
}
private void startKeyboard() {
mCurrentY += mParams.mTopPadding;
}
private void startRow(final XmlKeyboardRow row) {
addEdgeSpace(mParams.mLeftPadding, row);
mCurrentRow = row;
keysInRows.add(new ArrayList<>());
}
private void endRow(final XmlKeyboardRow row) {
if (mCurrentRow == null) {
throw new RuntimeException("orphan end row tag");
}
addEdgeSpace(mParams.mRightPadding, row);
mCurrentY += row.getRowHeight();
mCurrentRow = null;
}
private void addEdgeSpace(final float width, final XmlKeyboardRow row) {
row.advanceXPos(width);
}
private static String textAttr(final String value, final String name) {
return value != null ? String.format(" %s=%s", name, value) : "";
}
private static String booleanAttr(final TypedArray a, final int index, final String name) {
return a.hasValue(index)
? String.format(" %s=%s", name, a.getBoolean(index, false)) : "";
}
}

View file

@ -1,184 +0,0 @@
/*
* Copyright (C) 2012 The Android Open Source Project
* modified
* SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
*/
package org.dslul.openboard.inputmethod.keyboard.internal.keyboard_parser;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.util.Xml;
import org.dslul.openboard.inputmethod.keyboard.Key;
import org.dslul.openboard.inputmethod.keyboard.Keyboard;
import org.dslul.openboard.inputmethod.keyboard.internal.KeyboardParams;
import org.dslul.openboard.inputmethod.latin.R;
import org.dslul.openboard.inputmethod.latin.utils.ResourceUtils;
import org.xmlpull.v1.XmlPullParser;
import java.util.ArrayDeque;
/**
* Container for keys in the keyboard. All keys in a row are at the same Y-coordinate.
* Some of the key size defaults can be overridden per row from what the {@link Keyboard}
* defines.
*/
public final class XmlKeyboardRow {
// keyWidth enum constants
private static final int KEYWIDTH_NOT_ENUM = 0;
private static final int KEYWIDTH_FILL_RIGHT = -1;
private final KeyboardParams mParams;
/** The height of this row. */
private final int mRowHeight;
final public float mRelativeRowHeight;
private final ArrayDeque<RowAttributes> mRowAttributesStack = new ArrayDeque<>();
// TODO: Add keyActionFlags.
private static class RowAttributes {
/** Default width of a key in this row, relative to keyboard width */
public final float mDefaultRelativeKeyWidth;
/** Default keyLabelFlags in this row. */
public final int mDefaultKeyLabelFlags;
/** Default backgroundType for this row */
public final int mDefaultBackgroundType;
/**
* Parse and create key attributes. This constructor is used to parse Row tag.
*
* @param keyAttr an attributes array of Row tag.
* @param defaultRelativeKeyWidth a default key width relative to keyboardWidth.
*/
public RowAttributes(final TypedArray keyAttr, final float defaultRelativeKeyWidth) {
mDefaultRelativeKeyWidth = keyAttr.getFraction(R.styleable.Keyboard_Key_keyWidth,
1, 1, defaultRelativeKeyWidth);
mDefaultKeyLabelFlags = keyAttr.getInt(R.styleable.Keyboard_Key_keyLabelFlags, 0);
mDefaultBackgroundType = keyAttr.getInt(R.styleable.Keyboard_Key_backgroundType,
Key.BACKGROUND_TYPE_NORMAL);
}
/**
* Parse and update key attributes using default attributes. This constructor is used
* to parse include tag.
*
* @param keyAttr an attributes array of include tag.
* @param defaultRowAttr default Row attributes.
*/
public RowAttributes(final TypedArray keyAttr, final RowAttributes defaultRowAttr) {
mDefaultRelativeKeyWidth = keyAttr.getFraction(R.styleable.Keyboard_Key_keyWidth,
1, 1, defaultRowAttr.mDefaultRelativeKeyWidth);
mDefaultKeyLabelFlags = keyAttr.getInt(R.styleable.Keyboard_Key_keyLabelFlags, 0)
| defaultRowAttr.mDefaultKeyLabelFlags;
mDefaultBackgroundType = keyAttr.getInt(R.styleable.Keyboard_Key_backgroundType,
defaultRowAttr.mDefaultBackgroundType);
}
}
private final int mCurrentY;
// Will be updated by {@link Key}'s constructor.
private float mCurrentX;
public XmlKeyboardRow(final Resources res, final KeyboardParams params,
final XmlPullParser parser, final int y) {
mParams = params;
final TypedArray keyboardAttr = res.obtainAttributes(Xml.asAttributeSet(parser),
R.styleable.Keyboard);
float relativeRowHeight = ResourceUtils.getDimensionOrFraction(keyboardAttr,
R.styleable.Keyboard_rowHeight, 1, params.mDefaultRelativeRowHeight);
keyboardAttr.recycle();
if (relativeRowHeight > 1) {
mRelativeRowHeight = -relativeRowHeight;
mRowHeight = (int) relativeRowHeight;
} else {
mRelativeRowHeight = relativeRowHeight;
mRowHeight = (int) (relativeRowHeight * params.mBaseHeight);
}
final TypedArray keyAttr = res.obtainAttributes(Xml.asAttributeSet(parser),
R.styleable.Keyboard_Key);
mRowAttributesStack.push(new RowAttributes(keyAttr, params.mDefaultRelativeKeyWidth));
keyAttr.recycle();
mCurrentY = y;
mCurrentX = 0.0f;
}
public int getRowHeight() {
return mRowHeight;
}
public void pushRowAttributes(final TypedArray keyAttr) {
final RowAttributes newAttributes = new RowAttributes(keyAttr, mRowAttributesStack.peek());
mRowAttributesStack.push(newAttributes);
}
public void popRowAttributes() {
mRowAttributesStack.pop();
}
public float getDefaultRelativeKeyWidth() {
return mRowAttributesStack.peek().mDefaultRelativeKeyWidth;
}
public int getDefaultKeyLabelFlags() {
return mRowAttributesStack.peek().mDefaultKeyLabelFlags;
}
public int getDefaultBackgroundType() {
return mRowAttributesStack.peek().mDefaultBackgroundType;
}
public void setXPos(final float keyXPos) {
mCurrentX = keyXPos;
}
public void advanceXPos(final float width) {
mCurrentX += width;
}
public int getKeyY() {
return mCurrentY;
}
public float getKeyX(final TypedArray keyAttr) {
if (keyAttr == null || !keyAttr.hasValue(R.styleable.Keyboard_Key_keyXPos)) {
return mCurrentX;
}
final float keyXPos = keyAttr.getFraction(R.styleable.Keyboard_Key_keyXPos,
mParams.mBaseWidth, mParams.mBaseWidth, 0);
if (keyXPos >= 0) {
return keyXPos + mParams.mLeftPadding;
}
// If keyXPos is negative, the actual x-coordinate will be
// keyboardWidth + keyXPos.
// keyXPos shouldn't be less than mCurrentX because drawable area for this
// key starts at mCurrentX. Or, this key will overlaps the adjacent key on
// its left hand side.
final int keyboardRightEdge = mParams.mOccupiedWidth - mParams.mRightPadding;
return Math.max(keyXPos + keyboardRightEdge, mCurrentX);
}
public float getRelativeKeyWidth(final TypedArray keyAttr) {
if (keyAttr == null)
return getDefaultRelativeKeyWidth();
final int widthType = ResourceUtils.getEnumValue(keyAttr,
R.styleable.Keyboard_Key_keyWidth, KEYWIDTH_NOT_ENUM);
if (widthType == KEYWIDTH_FILL_RIGHT)
return -1f;
// else KEYWIDTH_NOT_ENUM
return keyAttr.getFraction(R.styleable.Keyboard_Key_keyWidth,
1, 1, getDefaultRelativeKeyWidth());
}
public float getKeyWidth(final TypedArray keyAttr, final float keyXPos) {
final float relativeWidth = getRelativeKeyWidth(keyAttr);
if (relativeWidth == -1f) {
// If keyWidth is fillRight, the actual key width will be determined to fill
// out the area up to the right edge of the keyboard.
final int keyboardRightEdge = mParams.mOccupiedWidth - mParams.mRightPadding;
return keyboardRightEdge - keyXPos;
}
return relativeWidth * mParams.mBaseWidth;
}
}

View file

@ -298,7 +298,7 @@ class AdvancedSettingsFragment : SubScreenFragment() {
override fun onSharedPreferenceChanged(prefs: SharedPreferences, key: String?) { override fun onSharedPreferenceChanged(prefs: SharedPreferences, key: String?) {
when (key) { when (key) {
Settings.PREF_SHOW_SETUP_WIZARD_ICON -> SystemBroadcastReceiver.toggleAppIcon(requireContext()) Settings.PREF_SHOW_SETUP_WIZARD_ICON -> SystemBroadcastReceiver.toggleAppIcon(requireContext())
Settings.PREF_MORE_MORE_KEYS, Settings.PREF_USE_NEW_KEYBOARD_PARSING -> KeyboardLayoutSet.onSystemLocaleChanged() Settings.PREF_MORE_MORE_KEYS -> KeyboardLayoutSet.onSystemLocaleChanged()
} }
} }
} }

View file

@ -103,7 +103,6 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
public static final String PREF_GESTURE_FLOATING_PREVIEW_TEXT = "pref_gesture_floating_preview_text"; public static final String PREF_GESTURE_FLOATING_PREVIEW_TEXT = "pref_gesture_floating_preview_text";
public static final String PREF_GESTURE_SPACE_AWARE = "pref_gesture_space_aware"; public static final String PREF_GESTURE_SPACE_AWARE = "pref_gesture_space_aware";
public static final String PREF_SHOW_SETUP_WIZARD_ICON = "pref_show_setup_wizard_icon"; public static final String PREF_SHOW_SETUP_WIZARD_ICON = "pref_show_setup_wizard_icon";
public static final String PREF_USE_NEW_KEYBOARD_PARSING = "pref_use_new_keyboard_parsing3"; // todo: remove later
public static final String PREF_ONE_HANDED_MODE = "pref_one_handed_mode_enabled_p_"; public static final String PREF_ONE_HANDED_MODE = "pref_one_handed_mode_enabled_p_";
public static final String PREF_ONE_HANDED_GRAVITY = "pref_one_handed_mode_gravity_p_"; public static final String PREF_ONE_HANDED_GRAVITY = "pref_one_handed_mode_gravity_p_";

View file

@ -108,7 +108,6 @@ public class SettingsValues {
public final boolean mUrlDetectionEnabled; public final boolean mUrlDetectionEnabled;
public final List<String> mPinnedKeys; public final List<String> mPinnedKeys;
public final float mBottomPaddingScale; public final float mBottomPaddingScale;
public final boolean mUseNewKeyboardParsing;
// From the input box // From the input box
@NonNull @NonNull
@ -246,7 +245,6 @@ public class SettingsValues {
mPinnedKeys = Settings.readPinnedKeys(prefs); mPinnedKeys = Settings.readPinnedKeys(prefs);
mSpacingAndPunctuations = new SpacingAndPunctuations(res, mUrlDetectionEnabled); mSpacingAndPunctuations = new SpacingAndPunctuations(res, mUrlDetectionEnabled);
mBottomPaddingScale = prefs.getFloat(Settings.PREF_BOTTOM_PADDING_SCALE, DEFAULT_SIZE_SCALE); mBottomPaddingScale = prefs.getFloat(Settings.PREF_BOTTOM_PADDING_SCALE, DEFAULT_SIZE_SCALE);
mUseNewKeyboardParsing = prefs.getBoolean(Settings.PREF_USE_NEW_KEYBOARD_PARSING, true);
} }
public boolean isApplicationSpecifiedCompletionsOn() { public boolean isApplicationSpecifiedCompletionsOn() {

View file

@ -92,9 +92,10 @@ public final class AndroidSpellCheckerService extends SpellCheckerService
return mRecommendedThreshold; return mRecommendedThreshold;
} }
// todo: this needs to be adjusted!
private static String getKeyboardLayoutNameForLocale(final Locale locale) { private static String getKeyboardLayoutNameForLocale(final Locale locale) {
// See b/19963288. // See b/19963288.
if (locale.getLanguage().equals("sr")) { if (locale.getLanguage().equals("sr") || locale.getLanguage().equals("mk")) {
return "south_slavic"; return "south_slavic";
} }
final int script = ScriptUtils.getScriptFromSpellCheckerLocale(locale); final int script = ScriptUtils.getScriptFromSpellCheckerLocale(locale);

View file

@ -39,7 +39,7 @@ public class ScriptUtils {
public static final int SCRIPT_TAMIL = 15; public static final int SCRIPT_TAMIL = 15;
public static final int SCRIPT_TELUGU = 16; public static final int SCRIPT_TELUGU = 16;
public static final int SCRIPT_THAI = 17; public static final int SCRIPT_THAI = 17;
public static final int SCRIPT_BULGARIAN = 18; public static final int SCRIPT_BULGARIAN = 18; // todo: why is bulgarian a separate script?
public static final int SCRIPT_HANGUL = 19; public static final int SCRIPT_HANGUL = 19;
private static final TreeMap<String, Integer> mLanguageCodeToScriptCode; private static final TreeMap<String, Integer> mLanguageCodeToScriptCode;
@ -56,6 +56,7 @@ public class ScriptUtils {
mLanguageCodeToScriptCode.put("bg", SCRIPT_BULGARIAN); mLanguageCodeToScriptCode.put("bg", SCRIPT_BULGARIAN);
mLanguageCodeToScriptCode.put("bn", SCRIPT_BENGALI); mLanguageCodeToScriptCode.put("bn", SCRIPT_BENGALI);
mLanguageCodeToScriptCode.put("sr", SCRIPT_CYRILLIC); mLanguageCodeToScriptCode.put("sr", SCRIPT_CYRILLIC);
mLanguageCodeToScriptCode.put("mk", SCRIPT_CYRILLIC);
mLanguageCodeToScriptCode.put("ru", SCRIPT_CYRILLIC); mLanguageCodeToScriptCode.put("ru", SCRIPT_CYRILLIC);
mLanguageCodeToScriptCode.put("ka", SCRIPT_GEORGIAN); mLanguageCodeToScriptCode.put("ka", SCRIPT_GEORGIAN);
mLanguageCodeToScriptCode.put("el", SCRIPT_GREEK); mLanguageCodeToScriptCode.put("el", SCRIPT_GREEK);
@ -70,6 +71,15 @@ public class ScriptUtils {
mLanguageCodeToScriptCode.put("th", SCRIPT_THAI); mLanguageCodeToScriptCode.put("th", SCRIPT_THAI);
mLanguageCodeToScriptCode.put("uk", SCRIPT_CYRILLIC); mLanguageCodeToScriptCode.put("uk", SCRIPT_CYRILLIC);
mLanguageCodeToScriptCode.put("ko", SCRIPT_HANGUL); mLanguageCodeToScriptCode.put("ko", SCRIPT_HANGUL);
mLanguageCodeToScriptCode.put("hi", SCRIPT_DEVANAGARI);
mLanguageCodeToScriptCode.put("kn", SCRIPT_KANNADA);
mLanguageCodeToScriptCode.put("kh", SCRIPT_KHMER);
mLanguageCodeToScriptCode.put("mr", SCRIPT_DEVANAGARI);
mLanguageCodeToScriptCode.put("mn", SCRIPT_CYRILLIC);
mLanguageCodeToScriptCode.put("be", SCRIPT_CYRILLIC);
mLanguageCodeToScriptCode.put("kk", SCRIPT_CYRILLIC);
mLanguageCodeToScriptCode.put("ky", SCRIPT_CYRILLIC);
mLanguageCodeToScriptCode.put("ne", SCRIPT_DEVANAGARI);
// only Latin, Cyrillic, Greek and Armenian have upper/lower case // only Latin, Cyrillic, Greek and Armenian have upper/lower case
// https://unicode.org/faq/casemap_charprop.html#3 // https://unicode.org/faq/casemap_charprop.html#3

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 903 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 958 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 811 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 639 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 928 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

View file

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/btn_keyboard_key_pressed_klp_light" />
</selector>

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/suggested_word_background_selected_lxx_base" />
</shape>

View file

@ -18,6 +18,5 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
latin:keyLetterSize="@dimen/config_suggestion_text_size" latin:keyLetterSize="@dimen/config_suggestion_text_size"
latin:keyLabelSize="@dimen/config_suggestion_text_size" latin:keyLabelSize="@dimen/config_suggestion_text_size"
latin:keyHintLetterRatio="@fraction/config_more_suggestions_info_ratio" latin:keyHintLetterRatio="@fraction/config_more_suggestions_info_ratio" />
latin:keyHintLetterColor="@android:color/white" />
</LinearLayout> </LinearLayout>

View file

@ -47,11 +47,6 @@
<fraction name="config_key_shifted_letter_hint_ratio_lxx">40%</fraction> <fraction name="config_key_shifted_letter_hint_ratio_lxx">40%</fraction>
<fraction name="config_language_on_spacebar_text_ratio">40.000%</fraction> <fraction name="config_language_on_spacebar_text_ratio">40.000%</fraction>
<!-- For 5-row keyboard -->
<fraction name="config_key_vertical_gap_5row">3.20%p</fraction>
<fraction name="config_key_letter_ratio_5row">65%</fraction>
<fraction name="config_key_shifted_letter_hint_ratio_5row">48%</fraction>
<dimen name="config_suggestions_strip_height">36dp</dimen> <dimen name="config_suggestions_strip_height">36dp</dimen>
<dimen name="config_suggestions_strip_horizontal_margin">54dp</dimen> <dimen name="config_suggestions_strip_horizontal_margin">54dp</dimen>
<dimen name="config_suggestions_strip_edge_key_width">48dp</dimen> <dimen name="config_suggestions_strip_edge_key_width">48dp</dimen>

View file

@ -36,11 +36,6 @@
<fraction name="config_language_on_spacebar_text_ratio">30.0%</fraction> <fraction name="config_language_on_spacebar_text_ratio">30.0%</fraction>
<dimen name="config_key_shifted_letter_hint_padding">4dp</dimen> <dimen name="config_key_shifted_letter_hint_padding">4dp</dimen>
<!-- For 5-row keyboard -->
<fraction name="config_key_vertical_gap_5row">3.20%p</fraction>
<fraction name="config_key_letter_ratio_5row">62%</fraction>
<fraction name="config_key_shifted_letter_hint_ratio_5row">36%</fraction>
<dimen name="config_suggestions_strip_height">44dp</dimen> <dimen name="config_suggestions_strip_height">44dp</dimen>
<dimen name="config_suggestions_strip_horizontal_margin">180.0dp</dimen> <dimen name="config_suggestions_strip_horizontal_margin">180.0dp</dimen>
<dimen name="config_suggestions_strip_edge_key_width">54dp</dimen> <dimen name="config_suggestions_strip_edge_key_width">54dp</dimen>

View file

@ -50,11 +50,6 @@
<dimen name="config_key_hint_letter_padding">3dp</dimen> <dimen name="config_key_hint_letter_padding">3dp</dimen>
<dimen name="config_key_shifted_letter_hint_padding">3dp</dimen> <dimen name="config_key_shifted_letter_hint_padding">3dp</dimen>
<!-- For 5-row keyboard -->
<fraction name="config_key_vertical_gap_5row">3.20%p</fraction>
<fraction name="config_key_letter_ratio_5row">52%</fraction>
<fraction name="config_key_shifted_letter_hint_ratio_5row">27%</fraction>
<dimen name="config_suggestions_strip_height">44dp</dimen> <dimen name="config_suggestions_strip_height">44dp</dimen>
<dimen name="config_suggestions_strip_horizontal_margin">54dp</dimen> <dimen name="config_suggestions_strip_horizontal_margin">54dp</dimen>
<dimen name="config_suggestions_strip_edge_key_width">54dp</dimen> <dimen name="config_suggestions_strip_edge_key_width">54dp</dimen>

View file

@ -35,11 +35,6 @@
<fraction name="config_key_shifted_letter_hint_ratio_lxx">24%</fraction> <fraction name="config_key_shifted_letter_hint_ratio_lxx">24%</fraction>
<fraction name="config_language_on_spacebar_text_ratio">30.00%</fraction> <fraction name="config_language_on_spacebar_text_ratio">30.00%</fraction>
<!-- For 5-row keyboard -->
<fraction name="config_key_vertical_gap_5row">2.65%p</fraction>
<fraction name="config_key_letter_ratio_5row">53%</fraction>
<fraction name="config_key_shifted_letter_hint_ratio_5row">30%</fraction>
<dimen name="config_suggestions_strip_height">40dp</dimen> <dimen name="config_suggestions_strip_height">40dp</dimen>
<dimen name="config_suggestions_strip_horizontal_margin">340dp</dimen> <dimen name="config_suggestions_strip_horizontal_margin">340dp</dimen>
<dimen name="config_suggestions_strip_edge_key_width">54dp</dimen> <dimen name="config_suggestions_strip_edge_key_width">54dp</dimen>

View file

@ -45,11 +45,6 @@
<dimen name="config_key_hint_letter_padding">3dp</dimen> <dimen name="config_key_hint_letter_padding">3dp</dimen>
<dimen name="config_key_shifted_letter_hint_padding">3dp</dimen> <dimen name="config_key_shifted_letter_hint_padding">3dp</dimen>
<!-- For 5-row keyboard -->
<fraction name="config_key_vertical_gap_5row">2.95%p</fraction>
<fraction name="config_key_letter_ratio_5row">51%</fraction>
<fraction name="config_key_shifted_letter_hint_ratio_5row">33%</fraction>
<dimen name="config_suggestions_strip_height">40dp</dimen> <dimen name="config_suggestions_strip_height">40dp</dimen>
<dimen name="config_suggestions_strip_horizontal_margin">100dp</dimen> <dimen name="config_suggestions_strip_horizontal_margin">100dp</dimen>
<dimen name="config_suggestions_strip_edge_key_width">54dp</dimen> <dimen name="config_suggestions_strip_edge_key_width">54dp</dimen>

View file

@ -13,10 +13,6 @@
<!-- System theming colors for LXX_Dark theme, overriding some colors in main colors.xml --> <!-- System theming colors for LXX_Dark theme, overriding some colors in main colors.xml -->
<color name="highlight_color_lxx_dark">@android:color/system_accent1_500</color> <color name="highlight_color_lxx_dark">@android:color/system_accent1_500</color>
<color name="gesture_trail_color_lxx_dark">@android:color/system_accent1_200</color> <color name="gesture_trail_color_lxx_dark">@android:color/system_accent1_200</color>
<color name="sliding_key_input_preview_color_lxx_dark">@android:color/system_accent1_900</color>
<color name="action_key_background_lxx_dark">@color/highlight_color_lxx_dark</color>
<color name="action_key_background_pressed_lxx_dark">@android:color/system_accent1_200</color>
<color name="icon_tint_system_accent_lxx_dark">@color/highlight_color_lxx_dark</color>
<!-- colors used when user sets keyboard background color to be determined automatically --> <!-- colors used when user sets keyboard background color to be determined automatically -->
<color name="keyboard_background_light">@android:color/system_neutral1_100</color> <color name="keyboard_background_light">@android:color/system_neutral1_100</color>

View file

@ -412,24 +412,14 @@
positive is to right. The value is in proportion of the width of positive is to right. The value is in proportion of the width of
{@link org.dslul.openboard.inputmethod.latin.utils.TypefaceUtils#KEY_LABEL_REFERENCE_CHAR}. --> {@link org.dslul.openboard.inputmethod.latin.utils.TypefaceUtils#KEY_LABEL_REFERENCE_CHAR}. -->
<attr name="keyHintLabelOffCenterRatio" format="fraction" /> <attr name="keyHintLabelOffCenterRatio" format="fraction" />
<!-- Color to use for the label in a key. -->
<attr name="keyTextColor" format="color" />
<attr name="keyTextShadowColor" format="color" /> <attr name="keyTextShadowColor" format="color" />
<!-- Color to use for the label in a key when in inactivated state. --> <!-- Color to use for the label in a key when in inactivated state. -->
<attr name="keyTextInactivatedColor" format="color" /> <attr name="keyTextInactivatedColor" format="color" />
<!-- Color to use for the label in a key that has followFunctionalTextColor keyLabelFlags. -->
<attr name="functionalTextColor" format="color" />
<!-- Key hint letter (= one character hint label) color -->
<attr name="keyHintLetterColor" format="color" />
<!-- Key hint label color -->
<attr name="keyHintLabelColor" format="color" />
<!-- Shifted letter hint colors --> <!-- Shifted letter hint colors -->
<attr name="keyShiftedLetterHintInactivatedColor" format="color" /> <attr name="keyShiftedLetterHintInactivatedColor" format="color" />
<attr name="keyShiftedLetterHintActivatedColor" format="color" /> <attr name="keyShiftedLetterHintActivatedColor" format="color" />
<!-- Key preview visual parameters --> <!-- Key preview visual parameters -->
<!-- The text color for key press feedback. -->
<attr name="keyPreviewTextColor" format="color" />
<!-- Size of the text for key press feedback popup, in the proportion of key height. --> <!-- Size of the text for key press feedback popup, in the proportion of key height. -->
<attr name="keyPreviewTextRatio" format="fraction" /> <attr name="keyPreviewTextRatio" format="fraction" />
</declare-styleable> </declare-styleable>
@ -571,33 +561,6 @@
<attr name="allowRedundantMoreKeys" format="boolean" /> <attr name="allowRedundantMoreKeys" format="boolean" />
</declare-styleable> </declare-styleable>
<declare-styleable name="KeyboardLayoutSet_Feature">
<!-- This should be aligned with
{@link org.dslul.openboard.inputmethod.latin.utils.ScriptUtils#SCRIPT_ARABIC} etc. -->
<attr name="supportedScript" format="enum">
<enum name="arabic" value="0" />
<enum name="armenian" value="1" />
<enum name="bengali" value="2" />
<enum name="cyrillic" value="3" />
<enum name="devanagari" value="4" />
<enum name="georgian" value="5" />
<enum name="greek" value="6" />
<enum name="hebrew" value="7" />
<enum name="kannada" value="8" />
<enum name="khmer" value="9" />
<enum name="lao" value="10" />
<enum name="latin" value="11" />
<enum name="malayalam" value="12" />
<!-- Myanmar is disabled. <enum name="myanmar" value="13" /> -->
<enum name="sinhala" value="14" />
<enum name="tamil" value="15" />
<enum name="telugu" value="16" />
<enum name="thai" value="17" />
<enum name="bulgarian" value="18" />
<enum name="hangul" value="19" />
</attr>
</declare-styleable>
<declare-styleable name="SeekBarDialogPreference"> <declare-styleable name="SeekBarDialogPreference">
<attr name="maxValue" format="integer" /> <attr name="maxValue" format="integer" />
<attr name="minValue" format="integer" /> <attr name="minValue" format="integer" />

View file

@ -12,24 +12,12 @@
<color name="key_background_normal_lxx_light_border">#FFFFFF</color> <color name="key_background_normal_lxx_light_border">#FFFFFF</color>
<color name="key_background_functional_lxx_light_border">#CCCED5</color> <color name="key_background_functional_lxx_light_border">#CCCED5</color>
<!-- todo: choose which to keep and use for what, which to remove
some color appear used, but are overridden in code (maybe also the attrs can be removed)
some are actually used, choose one of the many similar ones to keep
-->
<color name="highlight_color_lxx_dark">#5E97F6</color> <color name="highlight_color_lxx_dark">#5E97F6</color>
<color name="gesture_trail_color_lxx_dark">#5E97F6</color> <color name="gesture_trail_color_lxx_dark">#5E97F6</color>
<color name="sliding_key_input_preview_color_lxx_dark">#436baf</color>
<color name="action_key_background_lxx_dark">#5E97F6</color>
<color name="action_key_background_pressed_lxx_dark">#86b0f6</color>
<color name="gesture_trail_color_lxx_light">#1A73E8</color> <color name="gesture_trail_color_lxx_light">#1A73E8</color>
<color name="key_functional_text_color_lxx_light">#CC37474F</color>
<color name="key_text_inactive_color_lxx_light">#B337474F</color> <color name="key_text_inactive_color_lxx_light">#B337474F</color>
<color name="language_on_spacebar_text_color_lxx_light">#B337474F</color>
<color name="highlight_color_holo_white">#FFF0F0F0</color> <color name="highlight_color_holo_white">#FFF0F0F0</color>
<color name="key_text_color_blue">@android:color/white</color>
<color name="key_text_inactivated_color_holo">#66E0E4E5</color> <color name="key_text_inactivated_color_holo">#66E0E4E5</color>
<color name="key_hint_letter_color_holo">#80000000</color>
<color name="key_hint_label_color_holo">#A0FFFFFF</color>
<color name="key_shifted_letter_hint_inactivated_color_holo">#66E0E4E5</color> <color name="key_shifted_letter_hint_inactivated_color_holo">#66E0E4E5</color>
<color name="key_shifted_letter_hint_activated_color_holo">@android:color/white</color> <color name="key_shifted_letter_hint_activated_color_holo">@android:color/white</color>
<color name="spacebar_text_shadow_color_holo">#80000000</color> <color name="spacebar_text_shadow_color_holo">#80000000</color>
@ -57,7 +45,6 @@
<color name="keyboard_background_lxx_base">@android:color/white</color> <color name="keyboard_background_lxx_base">@android:color/white</color>
<color name="key_background_lxx_base">@android:color/white</color> <color name="key_background_lxx_base">@android:color/white</color>
<color name="action_key_background_lxx_base">@android:color/white</color> <color name="action_key_background_lxx_base">@android:color/white</color>
<color name="suggested_word_background_selected_lxx_base">@android:color/white</color>
<color name="emoji_tab_page_indicator_background_lxx_base">@android:color/white</color> <color name="emoji_tab_page_indicator_background_lxx_base">@android:color/white</color>
<!-- Color resources for LXX_Base_Border theme. --> <!-- Color resources for LXX_Base_Border theme. -->

View file

@ -55,11 +55,6 @@
<dimen name="config_key_hint_letter_padding">1dp</dimen> <dimen name="config_key_hint_letter_padding">1dp</dimen>
<dimen name="config_key_shifted_letter_hint_padding">2dp</dimen> <dimen name="config_key_shifted_letter_hint_padding">2dp</dimen>
<!-- For 5-row keyboard -->
<fraction name="config_key_vertical_gap_5row">3.20%p</fraction>
<fraction name="config_key_letter_ratio_5row">55%</fraction>
<fraction name="config_key_shifted_letter_hint_ratio_5row">41%</fraction>
<dimen name="config_suggestions_strip_height">40dp</dimen> <dimen name="config_suggestions_strip_height">40dp</dimen>
<dimen name="config_suggestions_strip_horizontal_margin">36dp</dimen> <dimen name="config_suggestions_strip_horizontal_margin">36dp</dimen>
<dimen name="config_suggestions_strip_edge_key_width">36dp</dimen> <dimen name="config_suggestions_strip_edge_key_width">36dp</dimen>

View file

@ -162,10 +162,6 @@
<string name="space_language_slide">Space bar language slide</string> <string name="space_language_slide">Space bar language slide</string>
<!-- Description for "space_language_slide" option. --> <!-- Description for "space_language_slide" option. -->
<string name="space_language_slide_summary">Swipe upwards on the spacebar to change the language</string> <string name="space_language_slide_summary">Swipe upwards on the spacebar to change the language</string>
<!-- Preferences item for enabling the simplified keyboard parser and future other parsers (will be removed after some testing) -->
<string name="use_new_keyboard_parsing">Use new keyboard parser</string>
<!-- Description for "use_new_keyboard_parsing" option (will be removed after some testing) -->
<string name="use_new_keyboard_parsing_summary">Use this setting if you encounter issues with changed keyboard layouts (please report the problem). This setting will be removed at some point.</string>
<!-- Preferences item and dialog title for backup and restore --> <!-- Preferences item and dialog title for backup and restore -->
<string name="backup_restore_title">Backup and restore</string> <string name="backup_restore_title">Backup and restore</string>
<!-- Message for backup and restore dialog --> <!-- Message for backup and restore dialog -->

View file

@ -47,14 +47,9 @@
<item name="keyBackground">@drawable/btn_keyboard_key_holo_white</item> <item name="keyBackground">@drawable/btn_keyboard_key_holo_white</item>
<item name="functionalKeyBackground">@drawable/btn_keyboard_key_pressed_klp_light</item> <item name="functionalKeyBackground">@drawable/btn_keyboard_key_pressed_klp_light</item>
<item name="spacebarBackground">@drawable/btn_keyboard_spacebar_holo_white</item> <item name="spacebarBackground">@drawable/btn_keyboard_spacebar_holo_white</item>
<item name="keyTextColor">@color/key_text_color_blue</item>
<item name="keyTextInactivatedColor">@color/key_text_inactivated_color_holo</item> <item name="keyTextInactivatedColor">@color/key_text_inactivated_color_holo</item>
<item name="functionalTextColor">@color/key_text_color_blue</item>
<item name="keyHintLetterColor">@color/key_hint_letter_color_holo</item>
<item name="keyHintLabelColor">@color/key_hint_label_color_holo</item>
<item name="keyShiftedLetterHintInactivatedColor">@color/key_shifted_letter_hint_inactivated_color_holo</item> <item name="keyShiftedLetterHintInactivatedColor">@color/key_shifted_letter_hint_inactivated_color_holo</item>
<item name="keyShiftedLetterHintActivatedColor">@color/key_shifted_letter_hint_activated_color_holo</item> <item name="keyShiftedLetterHintActivatedColor">@color/key_shifted_letter_hint_activated_color_holo</item>
<item name="keyPreviewTextColor">@color/key_text_color_blue</item>
</style> </style>
<style <style
name="MainKeyboardView.HoloBase" name="MainKeyboardView.HoloBase"

View file

@ -32,14 +32,9 @@
<item name="android:background">@color/keyboard_background_lxx_base</item> <item name="android:background">@color/keyboard_background_lxx_base</item>
<item name="keyBackground">@drawable/btn_keyboard_key_lxx_base</item> <item name="keyBackground">@drawable/btn_keyboard_key_lxx_base</item>
<item name="functionalKeyBackground">@drawable/btn_keyboard_key_lxx_base</item> <item name="functionalKeyBackground">@drawable/btn_keyboard_key_lxx_base</item>
<item name="keyTextColor">@color/key_text_color_lxx_light</item>
<item name="keyTextInactivatedColor">@color/key_text_inactive_color_lxx_light</item> <item name="keyTextInactivatedColor">@color/key_text_inactive_color_lxx_light</item>
<item name="functionalTextColor">@color/key_functional_text_color_lxx_light</item>
<item name="keyHintLetterColor">@color/key_hint_letter_color_lxx_light</item>
<item name="keyHintLabelColor">@color/key_text_inactive_color_lxx_light</item>
<item name="keyShiftedLetterHintInactivatedColor">@color/key_text_inactive_color_lxx_light</item> <item name="keyShiftedLetterHintInactivatedColor">@color/key_text_inactive_color_lxx_light</item>
<item name="keyShiftedLetterHintActivatedColor">@color/key_text_color_lxx_light</item> <item name="keyShiftedLetterHintActivatedColor">@color/key_text_color_lxx_light</item>
<item name="keyPreviewTextColor">@color/key_text_color_lxx_light</item>
</style> </style>
<style <style
name="MainKeyboardView.LXX_Base" name="MainKeyboardView.LXX_Base"

View file

@ -34,14 +34,9 @@
<item name="android:background">@color/keyboard_background_lxx_base</item> <item name="android:background">@color/keyboard_background_lxx_base</item>
<item name="keyBackground">@drawable/btn_keyboard_key_rounded_base</item> <item name="keyBackground">@drawable/btn_keyboard_key_rounded_base</item>
<item name="functionalKeyBackground">@drawable/btn_keyboard_key_rounded_base</item> <item name="functionalKeyBackground">@drawable/btn_keyboard_key_rounded_base</item>
<item name="keyTextColor">@color/key_text_color_lxx_light</item>
<item name="keyTextInactivatedColor">@color/key_text_inactive_color_lxx_light</item> <item name="keyTextInactivatedColor">@color/key_text_inactive_color_lxx_light</item>
<item name="functionalTextColor">@color/key_functional_text_color_lxx_light</item>
<item name="keyHintLetterColor">@color/key_hint_letter_color_lxx_light</item>
<item name="keyHintLabelColor">@color/key_text_inactive_color_lxx_light</item>
<item name="keyShiftedLetterHintInactivatedColor">@color/key_text_inactive_color_lxx_light</item> <item name="keyShiftedLetterHintInactivatedColor">@color/key_text_inactive_color_lxx_light</item>
<item name="keyShiftedLetterHintActivatedColor">@color/key_text_color_lxx_light</item> <item name="keyShiftedLetterHintActivatedColor">@color/key_text_color_lxx_light</item>
<item name="keyPreviewTextColor">@color/key_text_color_lxx_light</item>
<!-- Specific attributes for this theme --> <!-- Specific attributes for this theme -->
<item name="keyHintLetterPadding">3dp</item> <item name="keyHintLetterPadding">3dp</item>
<item name="keyHintLabelVerticalAdjustment">15%p</item> <!-- For normal keys --> <item name="keyHintLabelVerticalAdjustment">15%p</item> <!-- For normal keys -->

View file

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2011 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res-auto"
latin:keyboardLeftPadding="10%p"
latin:keyboardRightPadding="10%p"
latin:keyWidth="26.67%p"
latin:touchPositionCorrectionData="@array/touch_position_correction_data_default"
>
<include
latin:keyboardLayout="@xml/rows_number" />
</Keyboard>

View file

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-License-Identifier: GPL-3.0-only
-->
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res-auto"
latin:keyWidth="16%p"
latin:touchPositionCorrectionData="@array/touch_position_correction_data_default"
>
<include
latin:keyboardLayout="@xml/rows_numpad" />
</Keyboard>

View file

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2011 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res-auto"
latin:keyboardLeftPadding="10%p"
latin:keyboardRightPadding="10%p"
latin:keyWidth="26.67%p"
latin:touchPositionCorrectionData="@array/touch_position_correction_data_default"
>
<include
latin:keyboardLayout="@xml/rows_phone" />
</Keyboard>

View file

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2008 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res-auto"
latin:keyboardLeftPadding="10%p"
latin:keyboardRightPadding="10%p"
latin:keyWidth="26.67%p"
latin:touchPositionCorrectionData="@array/touch_position_correction_data_default"
>
<include
latin:keyboardLayout="@xml/rows_phone_symbols" />
</Keyboard>

View file

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-License-Identifier: GPL-3.0-only
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res-auto">
<switch>
<case
latin:numberRowEnabled="true"
latin:isSplitLayout="true"
>
<Row
latin:keyWidth="8%p"
>
<include
latin:keyboardLayout="@xml/rowkeys_symbols1_left1" />
<Spacer
latin:keyWidth="20.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_symbols1_right1" />
</Row>
</case>
<case
latin:numberRowEnabled="true"
latin:isSplitLayout="false"
>
<Row
latin:keyWidth="10%p"
>
<include
latin:keyboardLayout="@xml/rowkeys_symbols1" />
</Row>
</case>
</switch>
</merge>

View file

@ -1,59 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res-auto"
>
<switch>
<!-- Split the 4th row for split layouts -->
<case
latin:isSplitLayout="true"
>
<Row
latin:keyWidth="8.0%p"
latin:backgroundType="functional"
>
<Key
latin:keyStyle="toSymbolKeyStyle" />
<include
latin:keyboardLayout="@xml/key_comma" />
<!-- Space key. -->
<include
latin:keyboardLayout="@xml/key_space_3kw"
latin:backgroundType="normal" />
<Spacer
latin:keyWidth="15.0%p" />
<Key
latin:keyStyle="spaceKeyStyle"
latin:keyWidth="21.0%p" />
<include
latin:keyboardLayout="@xml/key_period" />
<Key
latin:keyStyle="enterKeyStyle"
latin:keyWidth="fillRight" />
</Row>
</case>
<default>
<Row
latin:keyWidth="10%p"
>
<Key
latin:keyStyle="toSymbolKeyStyle"
latin:keyWidth="15%p" />
<include
latin:keyboardLayout="@xml/key_comma" />
<include
latin:keyXPos="25%p"
latin:keyboardLayout="@xml/key_space_5kw" />
<include
latin:keyboardLayout="@xml/key_period" />
<Key
latin:keyStyle="enterKeyStyle"
latin:keyWidth="fillRight" />
</Row>
</default>
</switch>
</merge>

View file

@ -1,102 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2011 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res-auto"
>
<include
latin:keyboardLayout="@xml/key_styles_common" />
<include
latin:keyboardLayout="@xml/row_optional_number_row" />
<!-- First row -->
<Row>
<switch>
<!-- Split keyboard layout for the first row -->
<case
latin:isSplitLayout="true"
>
<include
latin:keyboardLayout="@xml/rowkeys_azerty1_left5"
latin:keyWidth="8.0%p" />
<Spacer
latin:keyWidth="20.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_azerty1_right5"
latin:keyWidth="8.0%p" />
</case>
<!-- Regular layout for the first row -->
<default>
<include
latin:keyboardLayout="@xml/rowkeys_azerty1"
latin:keyWidth="10%p"/>
</default>
</switch>
</Row>
<!-- Second row -->
<Row>
<switch>
<!-- Split keyboard layout for the second row -->
<case
latin:isSplitLayout="true"
>
<include
latin:keyboardLayout="@xml/rowkeys_azerty2_left5"
latin:keyWidth="8.0%p" />
<Spacer
latin:keyWidth="20.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_azerty2_right5"
latin:keyWidth="8.0%p" />
</case>
<!-- Regular layout for the second row -->
<default>
<include
latin:keyboardLayout="@xml/rowkeys_azerty2"
latin:keyWidth="10%p" />
</default>
</switch>
</Row>
<!-- Third row row -->
<Row>
<switch>
<!-- Split keyboard layout for the third row -->
<case
latin:isSplitLayout="true"
>
<Key
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="13.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_azerty3_left4"
latin:keyWidth="8.0%p" />
<Spacer
latin:keyWidth="18.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_azerty3_right3"
latin:keyWidth="8.0%p" />
<Key
latin:keyStyle="deleteKeyStyle"
latin:keyWidth="fillRight" />
</case>
<!-- Regular layout for the third row -->
<default
latin:keyWidth="10%p"
>
<Key
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="15%p" />
<include
latin:keyboardLayout="@xml/rowkeys_azerty3" />
<Key
latin:keyStyle="deleteKeyStyle"
latin:keyWidth="fillRight" />
</default>
</switch>
</Row>
<include
latin:keyboardLayout="@xml/row_qwerty4" />
</merge>

View file

@ -1,103 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res-auto"
>
<include
latin:keyboardLayout="@xml/key_styles_common" />
<include
latin:keyboardLayout="@xml/row_optional_number_row" />
<!-- First row -->
<Row>
<switch>
<!-- Split keyboard layout for the first row -->
<case
latin:isSplitLayout="true"
>
<include
latin:keyboardLayout="@xml/rowkeys_bengali_unijoy1_left5"
latin:keyWidth="8.0%p" />
<Spacer
latin:keyWidth="20.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_bengali_unijoy1_right5"
latin:keyWidth="8.0%p" />
</case>
<!-- Regular layout for the first row -->
<default>
<include
latin:keyboardLayout="@xml/rowkeys_bengali_unijoy1"
latin:keyWidth="10%p"/>
</default>
</switch>
</Row>
<!-- Second row -->
<Row>
<switch>
<!-- Split keyboard layout for the second row -->
<case
latin:isSplitLayout="true"
>
<include
latin:keyboardLayout="@xml/rowkeys_bengali_unijoy2_left5"
latin:keyXPos="5.0%p"
latin:keyWidth="8.0%p" />
<Spacer
latin:keyWidth="18.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_bengali_unijoy2_right4"
latin:keyWidth="8.0%p" />
</case>
<!-- Regular layout for the second row -->
<default>
<include
latin:keyboardLayout="@xml/rowkeys_bengali_unijoy2"
latin:keyWidth="10%p"
latin:keyXPos="5%p" />
</default>
</switch>
</Row>
<!-- Third row row -->
<Row>
<switch>
<!-- Split keyboard layout for the third row -->
<case
latin:isSplitLayout="true"
>
<Key
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="13.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_bengali_unijoy3_left4"
latin:keyWidth="8.0%p" />
<Spacer
latin:keyWidth="18.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_bengali_unijoy3_right3"
latin:keyWidth="8.0%p" />
<Key
latin:keyStyle="deleteKeyStyle"
latin:keyWidth="fillRight" />
</case>
<!-- Regular layout for the third row -->
<default
latin:keyWidth="10%p"
>
<Key
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="15%p" />
<include
latin:keyboardLayout="@xml/rowkeys_bengali_unijoy3" />
<Key
latin:keyStyle="deleteKeyStyle"
latin:keyWidth="fillRight" />
</default>
</switch>
</Row>
<include
latin:keyboardLayout="@xml/row_qwerty4" />
</merge>

View file

@ -1,207 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-License-Identifier: GPL-3.0-only
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res-auto"
>
<include
latin:keyboardLayout="@xml/key_styles_common" />
<include
latin:keyboardLayout="@xml/key_styles_number" />
<include
latin:keyboardLayout="@xml/key_styles_currency" />
<!-- First row -->
<Row>
<!-- &#40; "(" LEFT PARENTHESIS SIGN -->
<!-- &#123; "{" LEFT CURLY BRACKET -->
<!-- &#91; "[" LEFT SQUARE BRACKET -->
<Key
latin:keySpec="&#40;"
latin:additionalMoreKeys="&#123;,&#91;"
latin:keyActionFlags="noKeyPreview"
latin:keyWidth="8.6%p" />
<!-- &#41; ")" RIGHT PARENTHESIS SIGN -->
<!-- &#125; "}" RIGHT CURLY BRACKET -->
<!-- &#93; "]" RIGHT SQUARE BRACKET -->
<Key
latin:keySpec="&#41;"
latin:additionalMoreKeys="&#125;,&#93;"
latin:keyActionFlags="noKeyPreview"
latin:keyWidth="8.6%p" />
<!-- &#58; ":" COLON SIGN -->
<Key
latin:keySpec="&#58;"
latin:keyActionFlags="noKeyPreview"
latin:keyWidth="8.6%p" />
<Key
latin:keySpec="1"
latin:keyStyle="numKeyStyle" />
<Key
latin:keySpec="2"
latin:keyStyle="numKeyStyle" />
<Key
latin:keySpec="3"
latin:keyStyle="numKeyStyle" />
<!-- &#43; "+" PLUS SIGN -->
<!-- &#177; "±" PLUS-MINUS SIGN -->
<Key
latin:keySpec="&#43;"
latin:additionalMoreKeys="&#177;"
latin:keyActionFlags="noKeyPreview"
latin:keyWidth="8.6%p" />
<!-- &#45; "-" HYPHEN-MINUS SIGN -->
<!-- &#126; "~" TILDE -->
<Key
latin:keySpec="&#45;"
latin:additionalMoreKeys="&#126;"
latin:keyActionFlags="noKeyPreview"
latin:keyWidth="8.6%p" />
<!-- &#32; " " SPACE -->
<Key
latin:keySpec="!icon/space_key_for_number_layout|&#32;"
latin:keyLabelFlags="alignIconToBottom"
latin:backgroundType="functional"
latin:keyActionFlags="noKeyPreview|enableLongPress"
latin:keyWidth="fillRight" />
</Row>
<!-- Second row -->
<Row>
<!-- &#33; "!" EXCLAMATION MARK SIGN -->
<Key
latin:keySpec="&#33;"
latin:keyActionFlags="noKeyPreview"
latin:keyWidth="8.6%p" />
<!-- &#63; "?" QUESTION MARK SIGN -->
<Key
latin:keySpec="&#63;"
latin:keyActionFlags="noKeyPreview"
latin:keyWidth="8.6%p" />
<!-- &#59; ";" SEMICOLON SIGN -->
<Key
latin:keySpec="&#59;"
latin:keyActionFlags="noKeyPreview"
latin:keyWidth="8.6%p" />
<Key
latin:keySpec="4"
latin:keyStyle="numKeyStyle" />
<Key
latin:keySpec="5"
latin:keyStyle="numKeyStyle" />
<Key
latin:keySpec="6"
latin:keyStyle="numKeyStyle" />
<!-- &#42; "*" ASTERISK SIGN -->
<!-- &#215; "×" MULTIPLICATION SIGN -->
<Key
latin:keySpec="&#42;"
latin:additionalMoreKeys="&#215;"
latin:keyActionFlags="noKeyPreview"
latin:keyWidth="8.6%p" />
<!-- &#47; "/" SOLIDUS SIGN -->
<!-- &#247; "÷" DIVISION SIGN -->
<Key
latin:keySpec="&#47;"
latin:additionalMoreKeys="&#247;"
latin:keyActionFlags="noKeyPreview"
latin:keyWidth="8.6%p" />
<Key
latin:keyStyle="deleteKeyStyle"
latin:backgroundType="functional"
latin:keyWidth="fillRight" />
</Row>
<!-- Third row -->
<Row>
<!-- &#124; "|" VERTICAL LINE -->
<Key
latin:keySpec="&#124;"
latin:keyActionFlags="noKeyPreview"
latin:keyWidth="8.6%p" />
<Key
latin:keyStyle="currencyKeyStyle"
latin:keyActionFlags="noKeyPreview"
latin:keyWidth="8.6%p" />
<!-- &#38; "&" AMPERSAND -->
<Key
latin:keySpec="&#38;"
latin:keyActionFlags="noKeyPreview"
latin:keyWidth="8.6%p" />
<Key
latin:keySpec="7"
latin:keyStyle="numKeyStyle" />
<Key
latin:keySpec="8"
latin:keyStyle="numKeyStyle" />
<Key
latin:keySpec="9"
latin:keyStyle="numKeyStyle" />
<!-- &#35; "#" NUMBER SIGN -->
<Key
latin:keySpec="&#35;"
latin:keyActionFlags="noKeyPreview"
latin:keyWidth="8.6%p" />
<!-- &#37; "%" PERCENT SIGN -->
<!-- &#8240; "‰" PER MILLE SIGN -->
<Key
latin:keySpec="&#37;"
latin:additionalMoreKeys="&#8240;"
latin:keyActionFlags="noKeyPreview"
latin:keyWidth="8.6%p" />
<Key
latin:keyStyle="enterKeyStyle"
latin:keyWidth="fillRight" />
</Row>
<!-- Fourth row -->
<Row>
<Key
latin:keyStyle="alphaNumpadKeyStyle"
latin:backgroundType="functional"
latin:keyActionFlags="noKeyPreview"
latin:keyWidth="8.6%p" />
<!-- &#60; "<" LESS-THAN SIGN -->
<!-- &#8804; "≤" LESS THAN OR EQUAL TO -->
<Key
latin:keySpec="&#60;"
latin:additionalMoreKeys="&#8804;"
latin:keyActionFlags="noKeyPreview"
latin:keyWidth="8.6%p" />
<!-- &#62; ">" GREATER-THAN SIGN -->
<!-- &#8805; "≥" GREATER THAN OR EQUAL TO -->
<Key
latin:keySpec="&#62;"
latin:additionalMoreKeys="&#8805;"
latin:keyActionFlags="noKeyPreview"
latin:keyWidth="8.6%p" />
<!-- &#44; "," COMMA SIGN -->
<Key
latin:keySpec="&#44;"
latin:additionalMoreKeys="!text/keyspec_clipboard_normal_key,!text/keyspec_emoji_normal_key,!text/keyspec_language_switch,!text/keyspec_start_onehanded_mode,!text/keyspec_settings"
latin:keyActionFlags="noKeyPreview" />
<Key
latin:keySpec="0"
latin:keyStyle="numKeyStyle" />
<!-- &#46; "." PERIOD SIGN -->
<!-- &#8230; "..." ELLIPSIS SIGN -->
<!-- &#8734; "∞" INFINITY -->
<!-- &#960; "π" GREEK SMALL LETTER PI -->
<!-- &#8730; "√" SQUARE ROOT -->
<!-- &#176; "°" DEGREE SIGN -->
<!-- &#94; "^" CIRCUMFLEX ACCENT -->
<Key
latin:keySpec="&#46;"
latin:additionalMoreKeys="&#8230;,&#8734;,&#960;,&#8730;,&#176;,&#94;"
latin:keyActionFlags="noKeyPreview" />
<!-- &#61; "=" EQUAL SIGN -->
<!-- &#8800; "≠" NOT EQUAL TO -->
<!-- &#8776; "≈" ALMOST EQUAL TO -->
<Key
latin:keySpec="&#61;"
latin:additionalMoreKeys="&#8800;,&#8776;"
latin:keyActionFlags="noKeyPreview"
latin:keyWidth="17.2%p" />
<Key
latin:keyStyle="symbolNumpadKeyStyle"
latin:backgroundType="functional"
latin:keyWidth="fillRight" />
</Row>
</merge>

View file

@ -1,103 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res-auto"
>
<include
latin:keyboardLayout="@xml/key_styles_common" />
<include
latin:keyboardLayout="@xml/row_optional_number_row" />
<!-- First row -->
<Row>
<switch>
<!-- Split keyboard layout for the first row -->
<case
latin:isSplitLayout="true"
>
<include
latin:keyboardLayout="@xml/rowkeys_qwerty1_left5"
latin:keyWidth="8.0%p" />
<Spacer
latin:keyWidth="20.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_qwerty1_right5"
latin:keyWidth="8.0%p" />
</case>
<!-- Regular layout for the first row -->
<default>
<include
latin:keyboardLayout="@xml/rowkeys_qwerty1"
latin:keyWidth="10%p"/>
</default>
</switch>
</Row>
<!-- Second row -->
<Row>
<switch>
<!-- Split keyboard layout for the second row -->
<case
latin:isSplitLayout="true"
>
<include
latin:keyboardLayout="@xml/rowkeys_qwerty2_left5"
latin:keyXPos="5.0%p"
latin:keyWidth="8.0%p" />
<Spacer
latin:keyWidth="18.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_qwerty2_right4"
latin:keyWidth="8.0%p" />
</case>
<!-- Regular layout for the second row -->
<default>
<include
latin:keyboardLayout="@xml/rowkeys_qwerty2"
latin:keyWidth="10%p"
latin:keyXPos="5%p" />
</default>
</switch>
</Row>
<!-- Third row row -->
<Row>
<switch>
<!-- Split keyboard layout for the third row -->
<case
latin:isSplitLayout="true"
>
<Key
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="13.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_qwerty3_left4"
latin:keyWidth="8.0%p" />
<Spacer
latin:keyWidth="18.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_qwerty3_right3"
latin:keyWidth="8.0%p" />
<Key
latin:keyStyle="deleteKeyStyle"
latin:keyWidth="fillRight" />
</case>
<!-- Regular layout for the third row -->
<default
latin:keyWidth="10%p"
>
<Key
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="15%p" />
<include
latin:keyboardLayout="@xml/rowkeys_qwerty3" />
<Key
latin:keyStyle="deleteKeyStyle"
latin:keyWidth="fillRight" />
</default>
</switch>
</Row>
<include
latin:keyboardLayout="@xml/row_qwerty4" />
</merge>

View file

@ -1,103 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2010 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res-auto"
>
<include
latin:keyboardLayout="@xml/key_styles_common" />
<include
latin:keyboardLayout="@xml/row_optional_number_row" />
<!-- First row -->
<Row>
<switch>
<!-- Split keyboard layout for the first row -->
<case
latin:isSplitLayout="true"
>
<include
latin:keyboardLayout="@xml/rowkeys_qwertz1_left5"
latin:keyWidth="8.0%p" />
<Spacer
latin:keyWidth="20.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_qwertz1_right5"
latin:keyWidth="8.0%p" />
</case>
<!-- Regular layout for the first row -->
<default>
<include
latin:keyboardLayout="@xml/rowkeys_qwertz1"
latin:keyWidth="10%p"/>
</default>
</switch>
</Row>
<!-- Second row -->
<Row>
<switch>
<!-- Split keyboard layout for the second row -->
<case
latin:isSplitLayout="true"
>
<include
latin:keyboardLayout="@xml/rowkeys_qwertz2_left5"
latin:keyXPos="5.0%p"
latin:keyWidth="8.0%p" />
<Spacer
latin:keyWidth="18.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_qwertz2_right4"
latin:keyWidth="8.0%p" />
</case>
<!-- Regular layout for the second row -->
<default>
<include
latin:keyboardLayout="@xml/rowkeys_qwertz2"
latin:keyWidth="10%p"
latin:keyXPos="5%p" />
</default>
</switch>
</Row>
<!-- Third row row -->
<Row>
<switch>
<!-- Split keyboard layout for the third row -->
<case
latin:isSplitLayout="true"
>
<Key
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="13.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_qwertz3_left4"
latin:keyWidth="8.0%p" />
<Spacer
latin:keyWidth="18.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_qwertz3_right3"
latin:keyWidth="8.0%p" />
<Key
latin:keyStyle="deleteKeyStyle"
latin:keyWidth="fillRight" />
</case>
<!-- Regular layout for the third row -->
<default
latin:keyWidth="10%p"
>
<Key
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="15%p" />
<include
latin:keyboardLayout="@xml/rowkeys_qwertz3" />
<Key
latin:keyStyle="deleteKeyStyle"
latin:keyWidth="fillRight" />
</default>
</switch>
</Row>
<include
latin:keyboardLayout="@xml/row_qwerty4" />
</merge>

View file

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2011 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res-auto"
latin:keyboardLeftPadding="10%p"
latin:keyboardRightPadding="10%p"
latin:keyWidth="18%p"
latin:touchPositionCorrectionData="@array/touch_position_correction_data_default"
>
<include
latin:keyboardLayout="@xml/rows_number" />
</Keyboard>

View file

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2011 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res-auto"
latin:keyboardLeftPadding="10%p"
latin:keyboardRightPadding="10%p"
latin:keyWidth="18%p"
latin:touchPositionCorrectionData="@array/touch_position_correction_data_default"
>
<include
latin:keyboardLayout="@xml/rows_phone" />
</Keyboard>

View file

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2011 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res-auto"
latin:keyboardLeftPadding="10%p"
latin:keyboardRightPadding="10%p"
latin:keyWidth="18%p"
latin:touchPositionCorrectionData="@array/touch_position_correction_data_default"
>
<!-- Tablet doesn't have phone symbols keyboard -->
<include
latin:keyboardLayout="@xml/rows_phone" />
</Keyboard>

View file

@ -1,55 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res-auto"
>
<!-- TODO: Consolidate the layout specification between protrait and landscape.
Ideally just the keyWidth should be different -->
<switch>
<!-- fa: Perisan
kn: Kannada
ne: Nepali
te: Telugu -->
<case
latin:languageCode="fa|kn|ne|te"
latin:languageSwitchKeyEnabled="true"
>
<Key
latin:keyStyle="languageSwitchKeyStyle" />
<Key
latin:keyStyle="spaceKeyStyle"
latin:keyWidth="7.0%p" />
<Key
latin:keyStyle="zwnjKeyStyle" />
</case>
<case
latin:languageCode="fa|kn|ne|te"
latin:languageSwitchKeyEnabled="false"
>
<Key
latin:keyStyle="spaceKeyStyle"
latin:keyWidth="14.0%p" />
<Key
latin:keyStyle="zwnjKeyStyle" />
</case>
<case
latin:languageSwitchKeyEnabled="true"
>
<Key
latin:keyStyle="languageSwitchKeyStyle" />
<Key
latin:keyStyle="spaceKeyStyle"
latin:keyWidth="15.0%p" />
</case>
<!-- languageSwitchKeyEnabled="false" -->
<default>
<Key
latin:keyStyle="spaceKeyStyle"
latin:keyWidth="22.0%p" />
</default>
</switch>
</merge>

View file

@ -1,61 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res-auto"
>
<switch>
<!-- Split the 4th row for split layouts -->
<case
latin:isSplitLayout="true"
>
<Row
latin:keyWidth="7.0%p"
latin:backgroundType="functional"
>
<Key
latin:keyStyle="toSymbolKeyStyle"
latin:keyWidth="10.0%p" />
<include
latin:keyboardLayout="@xml/key_comma" />
<!-- Space key. -->
<include
latin:keyboardLayout="@xml/key_space_3kw"
latin:backgroundType="normal" />
<Spacer
latin:keyWidth="25.0%p" />
<Key
latin:keyStyle="spaceKeyStyle"
latin:keyWidth="19.0%p" />
<include
latin:keyboardLayout="@xml/key_period" />
<include
latin:keyboardLayout="@xml/key_emoji" />
</Row>
</case>
<default>
<Row
latin:keyWidth="9.0%p"
latin:backgroundType="functional"
>
<Key
latin:keyStyle="toSymbolKeyStyle"
latin:keyWidth="10.0%p" />
<include
latin:keyboardLayout="@xml/key_comma" />
<!-- Space key. -->
<include
latin:keyXPos="19.0%p"
latin:keyboardLayout="@xml/key_space_7kw"
latin:backgroundType="normal" />
<include
latin:keyboardLayout="@xml/key_period" />
<include
latin:keyboardLayout="@xml/key_emoji" />
</Row>
</default>
</switch>
</merge>

View file

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2011 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res-auto"
>
<include
latin:keyboardLayout="@xml/key_styles_common" />
<include
latin:keyboardLayout="@xml/row_optional_number_row" />
<!-- First row -->
<Row>
<switch>
<!-- Split keyboard layout for the first row -->
<case
latin:isSplitLayout="true"
>
<include
latin:keyboardLayout="@xml/rowkeys_azerty1_left5"
latin:keyWidth="7.0%p" />
<Spacer
latin:keyWidth="20.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_azerty1_right5"
latin:keyWidth="7.0%p" />
<Key
latin:keyStyle="deleteKeyStyle"
latin:keyWidth="10.0%p" />
</case>
<!-- Regular layout for the first row -->
<default>
<include
latin:keyboardLayout="@xml/rowkeys_azerty1"
latin:keyWidth="9.0%p" />
<Key
latin:keyStyle="deleteKeyStyle"
latin:keyWidth="fillRight" />
</default>
</switch>
</Row>
<!-- Second row -->
<Row>
<switch>
<!-- Split keyboard layout for the second row -->
<case
latin:isSplitLayout="true"
>
<include
latin:keyboardLayout="@xml/rowkeys_azerty2_left5"
latin:keyXPos="4.0%p"
latin:keyWidth="7.0%p" />
<Spacer
latin:keyWidth="16.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_azerty2_right5"
latin:keyWidth="7.0%p" />
<Key
latin:keyStyle="enterKeyStyle"
latin:keyWidth="10.0%p" />
</case>
<!-- Regular layout for the second row -->
<default>
<include
latin:keyboardLayout="@xml/rowkeys_azerty2"
latin:keyWidth="9.0%p" />
<Key
latin:keyStyle="enterKeyStyle"
latin:keyWidth="fillRight" />
</default>
</switch>
</Row>
<!-- Third row -->
<Row>
<switch>
<!-- Split keyboard layout for the third row -->
<case
latin:isSplitLayout="true"
>
<Key
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="10.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_azerty3_left4"
latin:keyWidth="7.0%p" />
<Spacer
latin:keyWidth="17.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_azerty3_right3"
latin:keyWidth="7.0%p" />
<include
latin:keyboardLayout="@xml/keys_exclamation_question"
latin:keyWidth="7.0%p" />
<Key
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="10.0%p" />
</case>
<!-- Regular layout for the third row -->
<default>
<Key
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="10.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_azerty3"
latin:keyWidth="9.0%p" />
<include
latin:keyboardLayout="@xml/keys_exclamation_question"
latin:keyWidth="9.0%p" />
<Key
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="fillRight" />
</default>
</switch>
</Row>
<!-- Fourth row -->
<include
latin:keyboardLayout="@xml/row_qwerty4" />
</merge>

View file

@ -1,121 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2011 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res-auto"
>
<include
latin:keyboardLayout="@xml/key_styles_common" />
<include
latin:keyboardLayout="@xml/row_optional_number_row" />
<!-- First row -->
<Row>
<switch>
<!-- Split keyboard layout for the first row -->
<case
latin:isSplitLayout="true"
>
<include
latin:keyboardLayout="@xml/rowkeys_bengali_unijoy1_left5"
latin:keyWidth="7.0%p" />
<Spacer
latin:keyWidth="20.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_bengali_unijoy1_right5"
latin:keyWidth="7.0%p" />
<Key
latin:keyStyle="deleteKeyStyle"
latin:keyWidth="10.0%p" />
</case>
<!-- Regular layout for the first row -->
<default>
<include
latin:keyboardLayout="@xml/rowkeys_bengali_unijoy1"
latin:keyWidth="9.0%p" />
<Key
latin:keyStyle="deleteKeyStyle"
latin:keyWidth="fillRight" />
</default>
</switch>
</Row>
<!-- Second row -->
<Row>
<switch>
<!-- Split keyboard layout for the second row -->
<case
latin:isSplitLayout="true"
>
<include
latin:keyboardLayout="@xml/rowkeys_bengali_unijoy2_left5"
latin:keyXPos="4.0%p"
latin:keyWidth="7.0%p" />
<Spacer
latin:keyWidth="23.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_bengali_unijoy2_right4"
latin:keyWidth="7.0%p" />
<Key
latin:keyStyle="enterKeyStyle"
latin:keyWidth="10.0%p" />
</case>
<!-- Regular layout for the second row -->
<default>
<include
latin:keyboardLayout="@xml/rowkeys_bengali_unijoy2"
latin:keyXPos="4.5%p"
latin:keyWidth="9.0%p" />
<Key
latin:keyStyle="enterKeyStyle"
latin:keyWidth="fillRight" />
</default>
</switch>
</Row>
<!-- Third row -->
<Row>
<switch>
<!-- Split keyboard layout for the third row -->
<case
latin:isSplitLayout="true"
>
<Key
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="10.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_bengali_unijoy3_left4"
latin:keyWidth="7.0%p" />
<Spacer
latin:keyWidth="17.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_bengali_unijoy3_right3"
latin:keyWidth="7.0%p" />
<include
latin:keyboardLayout="@xml/keys_exclamation_question"
latin:keyWidth="7.0%p" />
<Key
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="10.0%p" />
</case>
<!-- Regular layout for the third row -->
<default>
<Key
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="10.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_bengali_unijoy3"
latin:keyWidth="9.0%p" />
<include
latin:keyboardLayout="@xml/keys_exclamation_question"
latin:keyWidth="9.0%p" />
<Key
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="fillRight" />
</default>
</switch>
</Row>
<!-- Fourth row -->
<include
latin:keyboardLayout="@xml/row_qwerty4" />
</merge>

View file

@ -1,145 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2011 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res-auto"
>
<include
latin:keyboardLayout="@xml/key_styles_common" />
<!-- TODO: Consolidate the layout specification between protrait and landscape.
Ideally just the keyWidth should be different and the spacer should adjust to fill
the available space. -->
<include
latin:keyboardLayout="@xml/row_optional_number_row" />
<!-- First row -->
<Row
latin:keyWidth="8.182%p"
>
<switch>
<!-- Split keyboard layout for the first row -->
<case
latin:isSplitLayout="true"
>
<include
latin:keyboardLayout="@xml/rowkeys_qwertz1_left5"
latin:keyWidth="6.75%p" />
<Spacer
latin:keyWidth="17%p" />
<include
latin:keyboardLayout="@xml/rowkeys_qwertz1_right5"
latin:keyWidth="6.75%p" />
<Key
latin:keySpec="!text/keyspec_swiss_row1_11"
latin:keyWidth="6.75%p" />
<Key
latin:keyStyle="deleteKeyStyle"
latin:keyWidth="fillRight" />
</case>
<!-- Regular layout for the first row -->
<default>
<include
latin:keyboardLayout="@xml/rowkeys_qwertz1"/>
<Key
latin:keySpec="!text/keyspec_swiss_row1_11"/>
<Key
latin:keyStyle="deleteKeyStyle"
latin:keyWidth="fillRight" />
</default>
</switch>
</Row>
<!-- Second row -->
<Row
latin:keyWidth="8.182%p"
>
<switch>
<!-- Split keyboard layout for the second row -->
<case
latin:isSplitLayout="true"
>
<include
latin:keyboardLayout="@xml/rowkeys_qwertz2_left5"
latin:keyWidth="6.75%p" />
<Spacer
latin:keyWidth="17%p" />
<include
latin:keyboardLayout="@xml/rowkeys_qwertz2_right4"
latin:keyWidth="6.75%p" />
<Key
latin:keySpec="!text/keyspec_swiss_row2_10"
latin:keyWidth="6.75%p" />
<Key
latin:keySpec="!text/keyspec_swiss_row2_11"
latin:keyWidth="6.75%p" />
<Key
latin:keyStyle="enterKeyStyle"
latin:keyWidth="fillRight" />
</case>
<!-- Regular layout for the second row -->
<default>
<include
latin:keyboardLayout="@xml/rowkeys_qwertz2"/>
<Key
latin:keySpec="!text/keyspec_swiss_row2_10"/>
<Key
latin:keySpec="!text/keyspec_swiss_row2_11"/>
<Key
latin:keyStyle="enterKeyStyle"
latin:keyWidth="fillRight" />
</default>
</switch>
</Row>
<!-- Third row -->
<Row
latin:keyWidth="8.182%p"
>
<switch>
<!-- Split keyboard layout for the third row -->
<case
latin:isSplitLayout="true"
>
<Key
latin:keyStyle="shiftKeyStyle"
latin:keyXPos="2.75%p"
latin:keyWidth="8.5%p" />
<include
latin:keyboardLayout="@xml/rowkeys_qwertz3_left4"
latin:keyWidth="6.75%p" />
<Spacer
latin:keyWidth="17%p" />
<include
latin:keyboardLayout="@xml/rowkeys_qwertz3_right3"
latin:keyWidth="6.75%p" />
<include
latin:keyboardLayout="@xml/keys_exclamation_question"
latin:keyWidth="6.75%p" />
<Key
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="fillRight" />
</case>
<!-- Regular layout for the third row -->
<default>
<Key
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="10.0%p" />
<Spacer
latin:keyWidth="3.181%p" />
<include
latin:keyboardLayout="@xml/rowkeys_qwertz3"/>
<include
latin:keyboardLayout="@xml/keys_exclamation_question"/>
<Key
latin:keySpec="ẞ" />
<Key
latin:keyStyle="shiftKeyStyle"
latin:keyXPos="-10.0%p"
latin:keyWidth="fillRight" />
</default>
</switch>
</Row>
<!-- Fourth row -->
<include
latin:keyboardLayout="@xml/row_qwerty4" />
</merge>

View file

@ -1,121 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2011 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res-auto"
>
<include
latin:keyboardLayout="@xml/key_styles_common" />
<include
latin:keyboardLayout="@xml/row_optional_number_row" />
<!-- First row -->
<Row>
<switch>
<!-- Split keyboard layout for the first row -->
<case
latin:isSplitLayout="true"
>
<include
latin:keyboardLayout="@xml/rowkeys_qwerty1_left5"
latin:keyWidth="7.0%p" />
<Spacer
latin:keyWidth="20.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_qwerty1_right5"
latin:keyWidth="7.0%p" />
<Key
latin:keyStyle="deleteKeyStyle"
latin:keyWidth="10.0%p" />
</case>
<!-- Regular layout for the first row -->
<default>
<include
latin:keyboardLayout="@xml/rowkeys_qwerty1"
latin:keyWidth="9.0%p" />
<Key
latin:keyStyle="deleteKeyStyle"
latin:keyWidth="fillRight" />
</default>
</switch>
</Row>
<!-- Second row -->
<Row>
<switch>
<!-- Split keyboard layout for the second row -->
<case
latin:isSplitLayout="true"
>
<include
latin:keyboardLayout="@xml/rowkeys_qwerty2_left5"
latin:keyXPos="4.0%p"
latin:keyWidth="7.0%p" />
<Spacer
latin:keyWidth="23.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_qwerty2_right4"
latin:keyWidth="7.0%p" />
<Key
latin:keyStyle="enterKeyStyle"
latin:keyWidth="10.0%p" />
</case>
<!-- Regular layout for the second row -->
<default>
<include
latin:keyboardLayout="@xml/rowkeys_qwerty2"
latin:keyXPos="4.5%p"
latin:keyWidth="9.0%p" />
<Key
latin:keyStyle="enterKeyStyle"
latin:keyWidth="fillRight" />
</default>
</switch>
</Row>
<!-- Third row -->
<Row>
<switch>
<!-- Split keyboard layout for the third row -->
<case
latin:isSplitLayout="true"
>
<Key
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="10.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_qwerty3_left4"
latin:keyWidth="7.0%p" />
<Spacer
latin:keyWidth="17.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_qwerty3_right3"
latin:keyWidth="7.0%p" />
<include
latin:keyboardLayout="@xml/keys_exclamation_question"
latin:keyWidth="7.0%p" />
<Key
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="10.0%p" />
</case>
<!-- Regular layout for the third row -->
<default>
<Key
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="10.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_qwerty3"
latin:keyWidth="9.0%p" />
<include
latin:keyboardLayout="@xml/keys_exclamation_question"
latin:keyWidth="9.0%p" />
<Key
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="fillRight" />
</default>
</switch>
</Row>
<!-- Fourth row -->
<include
latin:keyboardLayout="@xml/row_qwerty4" />
</merge>

View file

@ -1,121 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2011 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res-auto"
>
<include
latin:keyboardLayout="@xml/key_styles_common" />
<include
latin:keyboardLayout="@xml/row_optional_number_row" />
<!-- First row -->
<Row>
<switch>
<!-- Split keyboard layout for the first row -->
<case
latin:isSplitLayout="true"
>
<include
latin:keyboardLayout="@xml/rowkeys_qwertz1_left5"
latin:keyWidth="7.0%p" />
<Spacer
latin:keyWidth="20.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_qwertz1_right5"
latin:keyWidth="7.0%p" />
<Key
latin:keyStyle="deleteKeyStyle"
latin:keyWidth="10.0%p" />
</case>
<!-- Regular layout for the first row -->
<default>
<include
latin:keyboardLayout="@xml/rowkeys_qwertz1"
latin:keyWidth="9.0%p" />
<Key
latin:keyStyle="deleteKeyStyle"
latin:keyWidth="fillRight" />
</default>
</switch>
</Row>
<!-- Second row -->
<Row>
<switch>
<!-- Split keyboard layout for the second row -->
<case
latin:isSplitLayout="true"
>
<include
latin:keyboardLayout="@xml/rowkeys_qwertz2_left5"
latin:keyXPos="4.0%p"
latin:keyWidth="7.0%p" />
<Spacer
latin:keyWidth="23.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_qwertz2_right4"
latin:keyWidth="7.0%p" />
<Key
latin:keyStyle="enterKeyStyle"
latin:keyWidth="10.0%p" />
</case>
<!-- Regular layout for the second row -->
<default>
<include
latin:keyboardLayout="@xml/rowkeys_qwertz2"
latin:keyXPos="4.5%p"
latin:keyWidth="9.0%p" />
<Key
latin:keyStyle="enterKeyStyle"
latin:keyWidth="fillRight" />
</default>
</switch>
</Row>
<!-- Third row -->
<Row>
<switch>
<!-- Split keyboard layout for the third row -->
<case
latin:isSplitLayout="true"
>
<Key
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="10.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_qwertz3_left4"
latin:keyWidth="7.0%p" />
<Spacer
latin:keyWidth="17.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_qwertz3_right3"
latin:keyWidth="7.0%p" />
<include
latin:keyboardLayout="@xml/keys_exclamation_question"
latin:keyWidth="7.0%p" />
<Key
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="10.0%p" />
</case>
<!-- Regular layout for the third row -->
<default>
<Key
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="10.0%p" />
<include
latin:keyboardLayout="@xml/rowkeys_qwertz3"
latin:keyWidth="9.0%p" />
<include
latin:keyboardLayout="@xml/keys_exclamation_question"
latin:keyWidth="9.0%p" />
<Key
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="fillRight" />
</default>
</switch>
</Row>
<!-- Fourth row -->
<include
latin:keyboardLayout="@xml/row_qwerty4" />
</merge>

View file

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2011 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res-auto"
latin:keyWidth="18%p"
latin:touchPositionCorrectionData="@array/touch_position_correction_data_default"
>
<include
latin:keyboardLayout="@xml/rows_number" />
</Keyboard>

View file

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2011 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res-auto"
latin:keyWidth="18%p"
latin:touchPositionCorrectionData="@array/touch_position_correction_data_default"
>
<include
latin:keyboardLayout="@xml/rows_phone" />
</Keyboard>

View file

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2011 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res-auto"
latin:keyWidth="18%p"
latin:touchPositionCorrectionData="@array/touch_position_correction_data_default"
>
<!-- Tablet doesn't have phone symbols keyboard -->
<include
latin:keyboardLayout="@xml/rows_phone" />
</Keyboard>

View file

@ -1,42 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2012 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res-auto"
>
<switch>
<case
latin:mode="url"
>
<Key
latin:keySpec="/"
latin:keyStyle="settingsMoreKeysStyle" />
</case>
<case
latin:mode="email"
>
<Key
latin:keySpec="\@"
latin:keyStyle="settingsMoreKeysStyle" />
</case>
<case
latin:keyboardLayoutSet="dvorak"
>
<Key
latin:keySpec="!"
latin:moreKeys="!text/morekeys_exclamation,%"
latin:keyStyle="settingsMoreKeysStyle" />
</case>
<default>
<Key
latin:keySpec="!text/keyspec_tablet_comma"
latin:moreKeys="!text/morekeys_tablet_comma,%"
latin:keyHintLabel="!text/keyhintlabel_tablet_comma"
latin:keyLabelFlags="hasPopupHint"
latin:keyStyle="settingsMoreKeysStyle" />
</default>
</switch>
</merge>

View file

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res-auto"
>
<!-- The table period key which may have different label depending on locale -->
<!-- Kept as a separate file for cleaner overriding by an overlay. -->
<switch>
<case
latin:keyboardLayoutSet="dvorak"
>
<Key
latin:keySpec="\?"
latin:moreKeys="!text/morekeys_tablet_period,!text/morekeys_question" />
</case>
<default>
<Key
latin:keySpec="!text/keyspec_tablet_period"
latin:keyHintLabel="!text/keyhintlabel_tablet_period"
latin:keyLabelFlags="hasPopupHint"
latin:moreKeys="!text/morekeys_tablet_period"
latin:backgroundType="functional"
latin:keyStyle="hasShiftedLetterHintStyle" />
</default>
</switch>
</merge>

View file

@ -1,49 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res-auto"
>
<switch>
<case
latin:keyboardLayoutSet="farsi|kannada|nepali_romanized|nepali_traditional|telugu"
latin:languageSwitchKeyEnabled="true"
>
<Key
latin:keyStyle="languageSwitchKeyStyle" />
<Key
latin:keyStyle="spaceKeyStyle"
latin:keyWidth="8.0%p" />
<Key
latin:keyStyle="zwnjKeyStyle" />
</case>
<case
latin:keyboardLayoutSet="farsi|kannada|nepali_romanized|nepali_traditional|telugu"
latin:languageSwitchKeyEnabled="false"
>
<Key
latin:keyStyle="spaceKeyStyle"
latin:keyWidth="16.0%p" />
<Key
latin:keyStyle="zwnjKeyStyle" />
</case>
<case
latin:languageSwitchKeyEnabled="true"
>
<Key
latin:keyStyle="languageSwitchKeyStyle" />
<Key
latin:keyStyle="spaceKeyStyle"
latin:keyWidth="15.0%p" />
</case>
<!-- languageSwitchKeyEnabled="false" -->
<default>
<Key
latin:keyStyle="spaceKeyStyle"
latin:keyWidth="23.0%p" />
</default>
</switch>
</merge>

View file

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2012 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res-auto"
>
<Key
latin:keyStyle="spaceKeyStyle"
latin:keyWidth="45.0%p" />
</merge>

View file

@ -1,172 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2011 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res-auto"
>
<switch>
<case
latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLockShifted"
>
<key-style
latin:styleName="hasShiftedLetterHintStyle"
latin:keyLabelFlags="hasShiftedLetterHint|shiftedLetterActivated" />
</case>
<default>
<key-style
latin:styleName="hasShiftedLetterHintStyle"
latin:keyLabelFlags="hasShiftedLetterHint" />
</default>
</switch>
<include
latin:keyboardLayout="@xml/key_styles_settings" />
<!-- Functional key styles -->
<!-- Base style for shift key. A single space is used for dummy label in moreKeys. -->
<key-style
latin:styleName="baseForShiftKeyStyle"
latin:keyActionFlags="noKeyPreview"
latin:keyLabelFlags="preserveCase"
latin:moreKeys="!noPanelAutoMoreKey!, |!code/key_capslock" />
<switch>
<case
latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetAutomaticShifted"
>
<key-style
latin:styleName="shiftKeyStyle"
latin:keySpec="!icon/shift_key_shifted|!code/key_shift"
latin:backgroundType="stickyOff"
latin:parentStyle="baseForShiftKeyStyle" />
</case>
<case
latin:keyboardLayoutSetElement="alphabetShiftLocked|alphabetShiftLockShifted"
>
<key-style
latin:styleName="shiftKeyStyle"
latin:keySpec="!icon/shift_key_shifted|!code/key_shift"
latin:backgroundType="stickyOn"
latin:parentStyle="baseForShiftKeyStyle" />
</case>
<default>
<key-style
latin:styleName="shiftKeyStyle"
latin:keySpec="!icon/shift_key|!code/key_shift"
latin:backgroundType="stickyOff"
latin:parentStyle="baseForShiftKeyStyle" />
</default>
</switch>
<!-- numpadKeyStyle -->
<key-style
latin:styleName="numpadKeyStyle"
latin:keySpec="!icon/numpad_key|!code/key_numpad"
latin:keyActionFlags="noKeyPreview"
latin:backgroundType="functional" />
<!-- alphaNumpadKeyStyle -->
<key-style
latin:styleName="alphaNumpadKeyStyle"
latin:keySpec="!text/keylabel_to_alpha|!code/key_alphaNumpad"
latin:keyActionFlags="noKeyPreview"
latin:backgroundType="functional" />
<!-- symbolNumpadKeyStyle -->
<key-style
latin:styleName="symbolNumpadKeyStyle"
latin:keySpec="!text/keylabel_to_symbol|!code/key_symbolNumpad"
latin:keyActionFlags="noKeyPreview" />
<key-style
latin:styleName="deleteKeyStyle"
latin:keySpec="!icon/delete_key|!code/key_delete"
latin:keyActionFlags="isRepeatable|noKeyPreview"
latin:backgroundType="functional" />
<include
latin:keyboardLayout="@xml/key_styles_enter" />
<!-- TODO: Currently there is no way to specify icon alignment per theme. -->
<key-style
latin:styleName="spaceKeyStyle"
latin:keySpec="!icon/space_key|!code/key_space"
latin:backgroundType="spacebar"
latin:keyActionFlags="noKeyPreview|enableLongPress" />
<!-- U+200C: ZERO WIDTH NON-JOINER
U+200D: ZERO WIDTH JOINER -->
<key-style
latin:styleName="zwnjKeyStyle"
latin:keySpec="!icon/zwnj_key|&#x200C;"
latin:moreKeys="!icon/zwj_key|&#x200D;"
latin:keyLabelFlags="hasPopupHint"
latin:keyActionFlags="noKeyPreview" />
<key-style
latin:styleName="shortcutKeyStyle"
latin:keySpec="!icon/shortcut_key|!code/key_shortcut"
latin:keyIconDisabled="!icon/shortcut_key_disabled"
latin:keyActionFlags="noKeyPreview"
latin:backgroundType="functional" />
<key-style
latin:styleName="languageSwitchKeyStyle"
latin:keySpec="!text/keyspec_language_switch"
latin:keyActionFlags="noKeyPreview|altCodeWhileTyping|enableLongPress"
latin:altCode="!code/key_space"
latin:backgroundType="functional" />
<key-style
latin:styleName="emojiKeyStyle"
latin:keySpec="!icon/emoji_normal_key|!code/key_emoji"
latin:keyActionFlags="noKeyPreview"
latin:backgroundType="functional" />
<key-style
latin:styleName="settingsKeyStyle"
latin:keySpec="!icon/settings_key|!code/key_settings"
latin:keyActionFlags="noKeyPreview"
latin:backgroundType="functional" />
<switch>
<case
latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLockShifted"
latin:navigatePrevious="true"
>
<key-style
latin:styleName="tabKeyStyle"
latin:keySpec="!icon/tab_key|!code/key_action_previous"
latin:backgroundType="functional" />
</case>
<case
latin:keyboardLayoutSetElement="alphabet|alphabetAutomaticShifted|alphabetShiftLocked"
latin:navigateNext="true"
>
<key-style
latin:styleName="tabKeyStyle"
latin:keySpec="!icon/tab_key|!code/key_action_next"
latin:backgroundType="functional" />
</case>
<default>
<key-style
latin:styleName="tabKeyStyle"
latin:keySpec="!icon/tab_key|!code/key_tab"
latin:backgroundType="functional" />
</default>
</switch>
<key-style
latin:styleName="baseForLayoutSwitchKeyStyle"
latin:keyLabelFlags="preserveCase|followFunctionalTextColor"
latin:keyActionFlags="noKeyPreview"
latin:backgroundType="functional" />
<key-style
latin:styleName="toSymbolKeyStyle"
latin:keySpec="!text/keylabel_to_symbol|!code/key_switch_alpha_symbol"
latin:parentStyle="baseForLayoutSwitchKeyStyle" />
<key-style
latin:styleName="toAlphaKeyStyle"
latin:keySpec="!text/keylabel_to_alpha|!code/key_switch_alpha_symbol"
latin:parentStyle="baseForLayoutSwitchKeyStyle" />
<key-style
latin:styleName="toMoreSymbolKeyStyle"
latin:keySpec="!text/keylabel_tablet_to_more_symbol|!code/key_shift"
latin:parentStyle="baseForLayoutSwitchKeyStyle" />
<key-style
latin:styleName="backFromMoreSymbolKeyStyle"
latin:keySpec="!text/keylabel_to_symbol|!code/key_shift"
latin:parentStyle="baseForLayoutSwitchKeyStyle" />
<key-style
latin:styleName="comKeyStyle"
latin:keySpec="!text/keyspec_popular_domain"
latin:keyLabelFlags="autoXScale|fontNormal|hasPopupHint|preserveCase"
latin:moreKeys="!text/morekeys_popular_domain" />
</merge>

View file

@ -1,158 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2013 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res-auto"
>
<!-- Navigate more keys style -->
<include latin:keyboardLayout="@xml/key_styles_navigate_more_keys" />
<switch>
<case
latin:imeAction="actionNext"
latin:navigatePrevious="true"
>
<key-style
latin:styleName="navigateMoreKeysStyle"
latin:parentStyle="navigatePreviousMoreKeysStyle" />
</case>
<case
latin:imeAction="actionNext"
>
<key-style
latin:styleName="navigateMoreKeysStyle" />
</case>
<case
latin:imeAction="actionPrevious"
latin:navigateNext="true"
>
<key-style
latin:styleName="navigateMoreKeysStyle"
latin:parentStyle="navigateNextMoreKeysStyle" />
</case>
<case
latin:imeAction="actionPrevious"
>
<key-style
latin:styleName="navigateMoreKeysStyle" />
</case>
<case
latin:navigateNext="true"
latin:navigatePrevious="true"
>
<key-style
latin:styleName="navigateMoreKeysStyle"
latin:parentStyle="navigatePreviousNextMoreKeysStyle" />
</case>
<case
latin:navigateNext="true"
>
<key-style
latin:styleName="navigateMoreKeysStyle"
latin:parentStyle="navigateNextMoreKeysStyle" />
</case>
<case
latin:navigatePrevious="true"
>
<key-style
latin:styleName="navigateMoreKeysStyle"
latin:parentStyle="navigatePreviousMoreKeysStyle" />
</case>
<default>
<key-style
latin:styleName="navigateMoreKeysStyle" />
</default>
</switch>
<!-- Enter key style -->
<switch>
<case latin:keyboardTheme="HoloBase|LXXBaseBorder|RoundedBaseBorder">
<key-style
latin:styleName="defaultEnterKeyStyle"
latin:keySpec="!icon/enter_key|!code/key_enter"
latin:keyLabelFlags="preserveCase|autoXScale|followKeyLabelRatio|followFunctionalTextColor"
latin:keyActionFlags="noKeyPreview"
latin:backgroundType="action"
latin:parentStyle="navigateMoreKeysStyle" />
</case>
<!-- keyboardTheme="LXXBase" -->
<default>
<key-style
latin:styleName="defaultEnterKeyStyle"
latin:keySpec="!icon/enter_key|!code/key_enter"
latin:keyLabelFlags="preserveCase|autoXScale|followKeyLabelRatio|followFunctionalTextColor|keepBackgroundAspectRatio"
latin:keyActionFlags="noKeyPreview"
latin:backgroundType="action"
latin:parentStyle="navigateMoreKeysStyle" />
</default>
</switch>
<include latin:keyboardLayout="@xml/key_styles_actions" />
<switch>
<!-- Shift + Enter in textMultiLine field. -->
<case
latin:isMultiLine="true"
latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLockShifted"
>
<key-style
latin:styleName="enterKeyStyle"
latin:keySpec="!icon/enter_key|!code/key_shift_enter"
latin:parentStyle="defaultEnterKeyStyle" />
</case>
<case
latin:imeAction="actionGo"
>
<key-style
latin:styleName="enterKeyStyle"
latin:parentStyle="goActionKeyStyle" />
</case>
<case
latin:imeAction="actionNext"
>
<key-style
latin:styleName="enterKeyStyle"
latin:parentStyle="nextActionKeyStyle" />
</case>
<case
latin:imeAction="actionPrevious"
>
<key-style
latin:styleName="enterKeyStyle"
latin:parentStyle="previousActionKeyStyle" />
</case>
<case
latin:imeAction="actionDone"
>
<key-style
latin:styleName="enterKeyStyle"
latin:parentStyle="doneActionKeyStyle" />
</case>
<case
latin:imeAction="actionSend"
>
<key-style
latin:styleName="enterKeyStyle"
latin:parentStyle="sendActionKeyStyle" />
</case>
<case
latin:imeAction="actionSearch"
>
<key-style
latin:styleName="enterKeyStyle"
latin:parentStyle="searchActionKeyStyle" />
</case>
<case
latin:imeAction="actionCustomLabel"
>
<key-style
latin:styleName="enterKeyStyle"
latin:parentStyle="customLabelActionKeyStyle" />
</case>
<!-- imeAction is either actionNone or actionUnspecified. -->
<default>
<key-style
latin:styleName="enterKeyStyle"
latin:parentStyle="defaultEnterKeyStyle" />
</default>
</switch>
</merge>

View file

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2013 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res-auto"
>
<!-- U+0630: "ذ" ARABIC LETTER THAL -->
<Key
latin:keySpec="&#x0630;" />
<!-- U+0626: "ئ" ARABIC LETTER YEH WITH HAMZA ABOVE -->
<Key
latin:keySpec="&#x0626;" />
</merge>

View file

@ -1,45 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2012 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res-auto"
>
<switch>
<case
latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
>
<Key
latin:keySpec="&quot;"
latin:keyHintLabel="1"
latin:additionalMoreKeys="1" />
<Key
latin:keySpec="&lt;"
latin:keyHintLabel="2"
latin:additionalMoreKeys="2" />
<Key
latin:keySpec="&gt;"
latin:keyHintLabel="3"
latin:additionalMoreKeys="3" />
</case>
<default>
<Key
latin:keySpec="\'"
latin:keyHintLabel="1"
latin:additionalMoreKeys="1"
latin:moreKeys="!,&quot;" />
<Key
latin:keySpec=","
latin:keyHintLabel="2"
latin:additionalMoreKeys="2"
latin:moreKeys="\?,&lt;" />
<Key
latin:keySpec="."
latin:keyHintLabel="3"
latin:additionalMoreKeys="3"
latin:moreKeys="&gt;" />
</default>
</switch>
</merge>

View file

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2013 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res-auto"
>
<!-- U+0622: "آ" ARABIC LETTER ALEF WITH MADDA ABOVE -->
<Key
latin:keySpec="&#x0622;" />
<!-- U+0686: "چ" ARABIC LETTER TCHEH -->
<Key
latin:keySpec="&#x0686;" />
</merge>

View file

@ -1,40 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2012 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res-auto"
>
<switch>
<case
latin:keyboardLayoutSetElement="alphabet|alphabetAutomaticShifted|alphabetShiftLocked"
>
<Key
latin:keySpec="["
latin:keyHintLabel="{"
latin:additionalMoreKeys="{"
latin:keyStyle="hasShiftedLetterHintStyle" />
<Key
latin:keySpec="]"
latin:keyHintLabel="}"
latin:additionalMoreKeys="}"
latin:keyStyle="hasShiftedLetterHintStyle" />
<Key
latin:keySpec="\\"
latin:keyHintLabel="|"
latin:additionalMoreKeys="\\|"
latin:keyStyle="hasShiftedLetterHintStyle" />
</case>
<!-- keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted" -->
<default>
<Key
latin:keySpec="{" />
<Key
latin:keySpec="}" />
<Key
latin:keySpec="|" />
</default>
</switch>
</merge>

View file

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2012 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res-auto"
>
<switch>
<case
latin:keyboardLayoutSetElement="alphabet|alphabetAutomaticShifted|alphabetShiftLocked"
>
<Key
latin:keySpec=";"
latin:keyHintLabel=":"
latin:additionalMoreKeys=":"
latin:keyStyle="hasShiftedLetterHintStyle" />
<Key
latin:keySpec="\'"
latin:keyHintLabel="&quot;"
latin:additionalMoreKeys="&quot;"
latin:keyStyle="hasShiftedLetterHintStyle"
latin:moreKeys="!fixedColumnOrder!4,!text/double_quotes,%,!text/single_quotes" />
</case>
<!-- keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted" -->
<default>
<Key
latin:keySpec=":" />
<Key
latin:keySpec="&quot;"
latin:moreKeys="!fixedColumnOrder!3,!text/double_quotes,!text/single_quotes" />
</default>
</switch>
</merge>

View file

@ -1,50 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2012 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res-auto"
>
<switch>
<case
latin:keyboardLayoutSetElement="alphabet|alphabetAutomaticShifted|alphabetShiftLocked"
>
<Key
latin:keySpec=","
latin:keyHintLabel="&lt;"
latin:additionalMoreKeys="&lt;"
latin:keyStyle="hasShiftedLetterHintStyle" />
<Key
latin:keySpec="."
latin:keyHintLabel="&gt;"
latin:additionalMoreKeys="&gt;"
latin:keyStyle="hasShiftedLetterHintStyle" />
<Key
latin:keySpec="/"
latin:keyHintLabel="\?"
latin:additionalMoreKeys="\?"
latin:keyStyle="hasShiftedLetterHintStyle"
latin:moreKeys="!text/morekeys_question" />
</case>
<!-- keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted" -->
<default>
<!-- U+2039: "" SINGLE LEFT-POINTING ANGLE QUOTATION MARK
U+203A: "" SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
U+2264: "≤" LESS-THAN OR EQUAL TO
U+2265: "≥" GREATER-THAN EQUAL TO
U+00AB: "«" LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
U+00BB: "»" RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK -->
<Key
latin:keySpec="&lt;"
latin:moreKeys="!fixedColumnOrder!3,&#x2039;,&#x2264;,&#x00AB;" />
<Key
latin:keySpec="&gt;"
latin:moreKeys="!fixedColumnOrder!3,&#x203A;,&#x2265;,&#x00BB;" />
<Key
latin:keySpec="\?"
latin:moreKeys="!text/morekeys_question" />
</default>
</switch>
</merge>

Some files were not shown because too many files have changed in this diff Show more