mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-20 14:19:08 +00:00
parent
ca67fc71a6
commit
3989c1348a
4 changed files with 10 additions and 5 deletions
|
@ -1052,7 +1052,6 @@ public class Key implements Comparable<Key> {
|
|||
return popupKeysColumnAndFlags;
|
||||
}
|
||||
|
||||
// only for testing
|
||||
public String getOutputText() {
|
||||
return mOptionalAttributes == null ? null : mOptionalAttributes.mOutputText;
|
||||
}
|
||||
|
|
|
@ -98,6 +98,9 @@ public class KeyboardParams {
|
|||
// should be enabled for all alphabet layouts, except for specific layouts when shifted
|
||||
public boolean mProximityCharsCorrectionEnabled;
|
||||
|
||||
// only for removing redundant popup keys
|
||||
public List<Key.KeyParams> baseKeys;
|
||||
|
||||
@NonNull
|
||||
public final TouchPositionCorrection mTouchPositionCorrection = new TouchPositionCorrection();
|
||||
|
||||
|
@ -145,12 +148,12 @@ public class KeyboardParams {
|
|||
}
|
||||
|
||||
public void removeRedundantPopupKeys() {
|
||||
if (mAllowRedundantPopupKeys) {
|
||||
if (mAllowRedundantPopupKeys || baseKeys == null) {
|
||||
return;
|
||||
}
|
||||
final PopupKeySpec.LettersOnBaseLayout lettersOnBaseLayout =
|
||||
new PopupKeySpec.LettersOnBaseLayout();
|
||||
for (final Key key : mSortedKeys) {
|
||||
for (final Key.KeyParams key : baseKeys) {
|
||||
lettersOnBaseLayout.addLetter(key);
|
||||
}
|
||||
final ArrayList<Key> allKeys = new ArrayList<>(mSortedKeys);
|
||||
|
@ -159,6 +162,7 @@ public class KeyboardParams {
|
|||
final Key filteredKey = Key.removeRedundantPopupKeys(key, lettersOnBaseLayout);
|
||||
mSortedKeys.add(mUniqueKeysCache.getUniqueKey(filteredKey));
|
||||
}
|
||||
baseKeys = null;
|
||||
}
|
||||
|
||||
private int mMaxHeightCount = 0;
|
||||
|
|
|
@ -118,8 +118,8 @@ public final class PopupKeySpec {
|
|||
private final SparseIntArray mCodes = new SparseIntArray();
|
||||
private final HashSet<String> mTexts = new HashSet<>();
|
||||
|
||||
public void addLetter(@NonNull final Key key) {
|
||||
final int code = key.getCode();
|
||||
public void addLetter(@NonNull final Key.KeyParams key) {
|
||||
final int code = key.mCode;
|
||||
if (code > 32) {
|
||||
mCodes.put(code, 0);
|
||||
} else if (code == KeyCode.MULTIPLE_CODE_POINTS) {
|
||||
|
|
|
@ -91,6 +91,8 @@ class KeyboardParser(private val params: KeyboardParams, private val context: Co
|
|||
if (params.mId.isAlphaOrSymbolKeyboard && params.mId.mNumberRowEnabled)
|
||||
baseKeys.add(0, numberRow
|
||||
.mapTo(mutableListOf()) { it.copy(newLabelFlags = Key.LABEL_FLAGS_DISABLE_HINT_LABEL or defaultLabelFlags) })
|
||||
if (!params.mAllowRedundantPopupKeys)
|
||||
params.baseKeys = baseKeys.flatMap { it.map { it.toKeyParams(params) } }
|
||||
|
||||
val allFunctionalKeys = RawKeyboardParser.parseLayout(params, context, true)
|
||||
adjustBottomFunctionalRowAndBaseKeys(allFunctionalKeys, baseKeys)
|
||||
|
|
Loading…
Add table
Reference in a new issue