Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Long press for domain select.
Browse files Browse the repository at this point in the history
  • Loading branch information
daoshengmu committed Mar 26, 2020
1 parent 47806c5 commit b06ac39
Showing 1 changed file with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -578,10 +578,11 @@ public void onLongPress(Keyboard.Key popupKey) {
mPopUpHoverDeviceId = -1;

mIsLongPress = true;

} else if (popupKey.codes[0] == CustomKeyboard.KEYCODE_SHIFT) {
mIsLongPress = !mIsCapsLock;

} else if (popupKey.codes[0] == CustomKeyboard.KEYCODE_DOMAIN) {
handleDomainLongPress();
mIsLongPress = true;
}
}

Expand Down Expand Up @@ -824,6 +825,12 @@ private void handleEmojiInput() {
}

private void handleDomain() {
if (!mIsLongPress) {
handleText(mCurrentKeyboard.getDomains()[0]);
}
}

private void handleDomainLongPress() {
ArrayList<KeyboardSelectorView.Item> items = new ArrayList<>();
for (String item: mCurrentKeyboard.getDomains()) {
items.add(new KeyboardSelectorView.Item(item, item));
Expand All @@ -837,6 +844,15 @@ private void handleDomain() {
mDomainHoverDeviceId = -1;
}

private void handleDomainChange(KeyboardSelectorView.Item aItem) {
handleText(aItem.title, true);

disableShift(getSymbolsKeyboard());
handleShift(false);
hideOverlays();
updateCandidates();
}

private void handleLanguageChange(KeyboardInterface aKeyboard) {
cleanComposingText();

Expand Down Expand Up @@ -869,15 +885,6 @@ private void handleLanguageChange(KeyboardInterface aKeyboard) {
mCurrentKeyboard.getAlphabeticKeyboard().setSpaceKeyLabel(spaceText);
}

private void handleDomainChange(KeyboardSelectorView.Item aItem) {
handleText(aItem.title, true);

disableShift(getSymbolsKeyboard());
handleShift(false);
hideOverlays();
updateCandidates();
}

private void disableShift(@NonNull CustomKeyboard keyboard) {
int[] shiftIndices = keyboard.getShiftKeyIndices();
for (int shiftIndex: shiftIndices) {
Expand Down

0 comments on commit b06ac39

Please sign in to comment.