added a notification when changing the language in mode ABC, because it may be confusing otherwise
This commit is contained in:
parent
ff74e55cf8
commit
b7c08928c9
3 changed files with 24 additions and 16 deletions
|
|
@ -283,22 +283,13 @@ public class TraditionalT9 extends KeyPadHandler {
|
||||||
|
|
||||||
|
|
||||||
protected boolean onKeyNextLanguage() {
|
protected boolean onKeyNextLanguage() {
|
||||||
if (mEditing == EDITING_DIALER) {
|
return nextLang();
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
nextLang();
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected boolean onKeyNextInputMode() {
|
protected boolean onKeyNextInputMode() {
|
||||||
if (mEditing == EDITING_DIALER) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
nextInputMode();
|
nextInputMode();
|
||||||
return true;
|
return (mEditing != EDITING_STRICT_NUMERIC && mEditing != EDITING_DIALER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -464,8 +455,7 @@ public class TraditionalT9 extends KeyPadHandler {
|
||||||
|
|
||||||
private void nextInputMode() {
|
private void nextInputMode() {
|
||||||
if (mEditing == EDITING_STRICT_NUMERIC || mEditing == EDITING_DIALER) {
|
if (mEditing == EDITING_STRICT_NUMERIC || mEditing == EDITING_DIALER) {
|
||||||
clearSuggestions();
|
mInputMode = !mInputMode.is123() ? InputMode.getInstance(settings, InputMode.MODE_123) : mInputMode;
|
||||||
mInputMode = InputMode.getInstance(settings, InputMode.MODE_123);
|
|
||||||
}
|
}
|
||||||
// when typing a word or viewing scrolling the suggestions, only change the case
|
// when typing a word or viewing scrolling the suggestions, only change the case
|
||||||
else if (!isSuggestionViewHidden()) {
|
else if (!isSuggestionViewHidden()) {
|
||||||
|
|
@ -474,7 +464,7 @@ public class TraditionalT9 extends KeyPadHandler {
|
||||||
// When we are in AUTO mode and the dictionary word is in uppercase,
|
// When we are in AUTO mode and the dictionary word is in uppercase,
|
||||||
// the mode would switch to UPPERCASE, but visually, the word would not change.
|
// the mode would switch to UPPERCASE, but visually, the word would not change.
|
||||||
// This is why we retry, until there is a visual change.
|
// This is why we retry, until there is a visual change.
|
||||||
for (int retries = 0; retries < 2; retries ++) {
|
for (int retries = 0; retries < 2; retries++) {
|
||||||
mInputMode.nextTextCase();
|
mInputMode.nextTextCase();
|
||||||
setSuggestions(mInputMode.getSuggestions(mLanguage), mSuggestionView.getCurrentIndex());
|
setSuggestions(mInputMode.getSuggestions(mLanguage), mSuggestionView.getCurrentIndex());
|
||||||
refreshComposingText();
|
refreshComposingText();
|
||||||
|
|
@ -502,9 +492,9 @@ public class TraditionalT9 extends KeyPadHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void nextLang() {
|
private boolean nextLang() {
|
||||||
if (mEditing == EDITING_STRICT_NUMERIC || mEditing == EDITING_DIALER) {
|
if (mEditing == EDITING_STRICT_NUMERIC || mEditing == EDITING_DIALER) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
clearSuggestions();
|
clearSuggestions();
|
||||||
|
|
@ -520,6 +510,9 @@ public class TraditionalT9 extends KeyPadHandler {
|
||||||
settings.saveInputLanguage(mLanguage.getId());
|
settings.saveInputLanguage(mLanguage.getId());
|
||||||
|
|
||||||
UI.updateStatusIcon(this, mLanguage, mInputMode);
|
UI.updateStatusIcon(this, mLanguage, mInputMode);
|
||||||
|
UI.toastInputMode(this, settings, mLanguage, mInputMode);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -190,11 +190,15 @@ public class SettingsStore {
|
||||||
return getFunctionKey(SectionKeymap.ITEM_SHOW_SETTINGS);
|
return getFunctionKey(SectionKeymap.ITEM_SHOW_SETTINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************* UI settings *************/
|
/************* UI settings *************/
|
||||||
|
|
||||||
|
public boolean getNotifyNextLanguageInModeAbc() { return prefs.getBoolean("notify_next_language_in_mode_abc", true); }
|
||||||
|
|
||||||
public boolean getDarkTheme() { return prefs.getBoolean("pref_dark_theme", true); }
|
public boolean getDarkTheme() { return prefs.getBoolean("pref_dark_theme", true); }
|
||||||
public void setDarkTheme(boolean yes) { prefsEditor.putBoolean("pref_dark_theme", yes); }
|
public void setDarkTheme(boolean yes) { prefsEditor.putBoolean("pref_dark_theme", yes); }
|
||||||
|
|
||||||
|
|
||||||
public boolean getShowSoftKeys() { return prefs.getBoolean("pref_show_soft_keys", true); }
|
public boolean getShowSoftKeys() { return prefs.getBoolean("pref_show_soft_keys", true); }
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -204,6 +208,7 @@ public class SettingsStore {
|
||||||
public boolean getAutoSpace() { return prefs.getBoolean("auto_space", false); }
|
public boolean getAutoSpace() { return prefs.getBoolean("auto_space", false); }
|
||||||
public boolean getAutoTextCase() { return prefs.getBoolean("auto_text_case", true); }
|
public boolean getAutoTextCase() { return prefs.getBoolean("auto_text_case", true); }
|
||||||
|
|
||||||
|
|
||||||
/************* internal settings *************/
|
/************* internal settings *************/
|
||||||
|
|
||||||
public int getDictionaryImportProgressUpdateInterval() { return 250; /* ms */ }
|
public int getDictionaryImportProgressUpdateInterval() { return 250; /* ms */ }
|
||||||
|
|
@ -217,6 +222,7 @@ public class SettingsStore {
|
||||||
public int getSuggestionSelectAnimationDuration() { return 66; }
|
public int getSuggestionSelectAnimationDuration() { return 66; }
|
||||||
public int getSuggestionTranslateAnimationDuration() { return 0; }
|
public int getSuggestionTranslateAnimationDuration() { return 0; }
|
||||||
|
|
||||||
|
|
||||||
/************* add word, last word *************/
|
/************* add word, last word *************/
|
||||||
|
|
||||||
public String getLastWord() {
|
public String getLastWord() {
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import io.github.sspanak.tt9.ime.TraditionalT9;
|
||||||
import io.github.sspanak.tt9.ime.modes.InputMode;
|
import io.github.sspanak.tt9.ime.modes.InputMode;
|
||||||
import io.github.sspanak.tt9.languages.Language;
|
import io.github.sspanak.tt9.languages.Language;
|
||||||
import io.github.sspanak.tt9.preferences.PreferencesActivity;
|
import io.github.sspanak.tt9.preferences.PreferencesActivity;
|
||||||
|
import io.github.sspanak.tt9.preferences.SettingsStore;
|
||||||
|
|
||||||
public class UI {
|
public class UI {
|
||||||
public static void showAddWordDialog(TraditionalT9 tt9, int language, String currentWord) {
|
public static void showAddWordDialog(TraditionalT9 tt9, int language, String currentWord) {
|
||||||
|
|
@ -49,6 +50,14 @@ public class UI {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void toastInputMode(Context context, SettingsStore settings, Language newLanguage, InputMode mode) {
|
||||||
|
if (mode.isABC() && settings.getNotifyNextLanguageInModeAbc()) {
|
||||||
|
String toastMessage = newLanguage.getName();
|
||||||
|
toastMessage += mode.getTextCase() == InputMode.CASE_LOWER ? " (abc)" : " (ABC)";
|
||||||
|
toast(context, toastMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void toast(Context context, CharSequence msg) {
|
public static void toast(Context context, CharSequence msg) {
|
||||||
Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
|
Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue