fixed inconsistencies with accepting words (there should be no functional changes)
This commit is contained in:
parent
ef7c5476a5
commit
29be10ea68
3 changed files with 8 additions and 6 deletions
|
|
@ -223,7 +223,7 @@ class ModeCheonjiin extends InputMode {
|
||||||
protected boolean loadEmojis() {
|
protected boolean loadEmojis() {
|
||||||
if (shouldDisplayEmojis()) {
|
if (shouldDisplayEmojis()) {
|
||||||
suggestions.clear();
|
suggestions.clear();
|
||||||
suggestions.addAll(new EmojiLanguage().getKeyCharacters(digitSequence.charAt(0) - '0', getEmojiGroup()));
|
suggestions.addAll(new EmojiLanguage().getKeyCharacters(digitSequence.charAt(digitSequence.length() - 1) - '0', getEmojiGroup()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -264,7 +264,7 @@ class ModeCheonjiin extends InputMode {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ... otherwise display our custom first groups, if available
|
// ... otherwise display our custom first groups, if available
|
||||||
int number = digitSequence.isEmpty() ? Integer.MAX_VALUE : digitSequence.charAt(0) - '0';
|
int number = digitSequence.isEmpty() ? Integer.MAX_VALUE : digitSequence.charAt(digitSequence.length() - 1) - '0';
|
||||||
if (KEY_CHARACTERS.size() > number) {
|
if (KEY_CHARACTERS.size() > number) {
|
||||||
suggestions.clear();
|
suggestions.clear();
|
||||||
suggestions.addAll(KEY_CHARACTERS.get(number));
|
suggestions.addAll(KEY_CHARACTERS.get(number));
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,13 @@ import io.github.sspanak.tt9.hacks.InputType;
|
||||||
import io.github.sspanak.tt9.ime.helpers.TextField;
|
import io.github.sspanak.tt9.ime.helpers.TextField;
|
||||||
import io.github.sspanak.tt9.languages.Language;
|
import io.github.sspanak.tt9.languages.Language;
|
||||||
import io.github.sspanak.tt9.languages.LanguageKind;
|
import io.github.sspanak.tt9.languages.LanguageKind;
|
||||||
|
import io.github.sspanak.tt9.languages.NaturalLanguage;
|
||||||
import io.github.sspanak.tt9.preferences.settings.SettingsStore;
|
import io.github.sspanak.tt9.preferences.settings.SettingsStore;
|
||||||
import io.github.sspanak.tt9.util.chars.Characters;
|
import io.github.sspanak.tt9.util.chars.Characters;
|
||||||
|
|
||||||
public class ModePinyin extends ModeIdeograms {
|
public class ModePinyin extends ModeIdeograms {
|
||||||
boolean ignoreNextSpace = false;
|
private final int SPECIAL_CHAR_KEY = NaturalLanguage.SPECIAL_CHAR_KEY.charAt(0) - '0';
|
||||||
|
private boolean ignoreNextSpace = false;
|
||||||
|
|
||||||
|
|
||||||
protected ModePinyin(SettingsStore settings, Language lang, InputType inputType, TextField textField) {
|
protected ModePinyin(SettingsStore settings, Language lang, InputType inputType, TextField textField) {
|
||||||
|
|
@ -42,7 +44,7 @@ public class ModePinyin extends ModeIdeograms {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onNumberPress(int number) {
|
protected void onNumberPress(int number) {
|
||||||
if (ignoreNextSpace && number == SPECIAL_CHAR_SEQUENCE.charAt(0) - '0') {
|
if (ignoreNextSpace && number == SPECIAL_CHAR_KEY) {
|
||||||
ignoreNextSpace = false;
|
ignoreNextSpace = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -62,7 +64,7 @@ public class ModePinyin extends ModeIdeograms {
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldAcceptPreviousSuggestion(int nextKey, boolean hold) {
|
public boolean shouldAcceptPreviousSuggestion(int nextKey, boolean hold) {
|
||||||
// In East Asian languages, 0-key must accept the current word, or type a space when there is no word.
|
// In East Asian languages, 0-key must accept the current word, or type a space when there is no word.
|
||||||
if (!digitSequence.isEmpty() && !digitSequence.endsWith(SPECIAL_CHAR_SEQUENCE) && nextKey == SPECIAL_CHAR_SEQUENCE.charAt(0) - '0') {
|
if (!digitSequence.isEmpty() && !digitSequence.endsWith(SPECIAL_CHAR_SEQUENCE) && nextKey == SPECIAL_CHAR_KEY) {
|
||||||
ignoreNextSpace = true;
|
ignoreNextSpace = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -403,7 +403,7 @@ class ModeWords extends ModeCheonjiin {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
final char SPECIAL_CHAR_KEY_CODE = SPECIAL_CHAR_SEQUENCE.charAt(0);
|
final char SPECIAL_CHAR_KEY_CODE = SPECIAL_CHAR_SEQUENCE.charAt(SPECIAL_CHAR_SEQUENCE.length() - 1);
|
||||||
final int SPECIAL_CHAR_KEY = SPECIAL_CHAR_KEY_CODE - '0';
|
final int SPECIAL_CHAR_KEY = SPECIAL_CHAR_KEY_CODE - '0';
|
||||||
|
|
||||||
// Prevent typing the preferred character when the user has scrolled the special char suggestions.
|
// Prevent typing the preferred character when the user has scrolled the special char suggestions.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue