1
0
Fork 0

added a notification when changing the language in mode ABC, because it may be confusing otherwise

This commit is contained in:
Dimo Karaivanov 2022-12-13 11:41:11 +02:00
parent ff74e55cf8
commit b7c08928c9
3 changed files with 24 additions and 16 deletions

View file

@ -283,22 +283,13 @@ public class TraditionalT9 extends KeyPadHandler {
protected boolean onKeyNextLanguage() {
if (mEditing == EDITING_DIALER) {
return false;
}
nextLang();
return true;
return nextLang();
}
protected boolean onKeyNextInputMode() {
if (mEditing == EDITING_DIALER) {
return false;
}
nextInputMode();
return true;
return (mEditing != EDITING_STRICT_NUMERIC && mEditing != EDITING_DIALER);
}
@ -464,8 +455,7 @@ public class TraditionalT9 extends KeyPadHandler {
private void nextInputMode() {
if (mEditing == EDITING_STRICT_NUMERIC || mEditing == EDITING_DIALER) {
clearSuggestions();
mInputMode = InputMode.getInstance(settings, InputMode.MODE_123);
mInputMode = !mInputMode.is123() ? InputMode.getInstance(settings, InputMode.MODE_123) : mInputMode;
}
// when typing a word or viewing scrolling the suggestions, only change the case
else if (!isSuggestionViewHidden()) {
@ -502,9 +492,9 @@ public class TraditionalT9 extends KeyPadHandler {
}
private void nextLang() {
private boolean nextLang() {
if (mEditing == EDITING_STRICT_NUMERIC || mEditing == EDITING_DIALER) {
return;
return false;
}
clearSuggestions();
@ -520,6 +510,9 @@ public class TraditionalT9 extends KeyPadHandler {
settings.saveInputLanguage(mLanguage.getId());
UI.updateStatusIcon(this, mLanguage, mInputMode);
UI.toastInputMode(this, settings, mLanguage, mInputMode);
return true;
}

View file

@ -190,11 +190,15 @@ public class SettingsStore {
return getFunctionKey(SectionKeymap.ITEM_SHOW_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 void setDarkTheme(boolean yes) { prefsEditor.putBoolean("pref_dark_theme", yes); }
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 getAutoTextCase() { return prefs.getBoolean("auto_text_case", true); }
/************* internal settings *************/
public int getDictionaryImportProgressUpdateInterval() { return 250; /* ms */ }
@ -217,6 +222,7 @@ public class SettingsStore {
public int getSuggestionSelectAnimationDuration() { return 66; }
public int getSuggestionTranslateAnimationDuration() { return 0; }
/************* add word, last word *************/
public String getLastWord() {

View file

@ -10,6 +10,7 @@ import io.github.sspanak.tt9.ime.TraditionalT9;
import io.github.sspanak.tt9.ime.modes.InputMode;
import io.github.sspanak.tt9.languages.Language;
import io.github.sspanak.tt9.preferences.PreferencesActivity;
import io.github.sspanak.tt9.preferences.SettingsStore;
public class UI {
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) {
Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
}