diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 894f1ef3..7190c115 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -23,10 +23,11 @@ - + diff --git a/README.md b/README.md index d89e2910..fbea9aa8 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ or get the APK from the [Releases Section](https://github.com/sspanak/tt9/releas ## System Requirements - Android 4.4 or higher. _(Tested and confirmed on Android 4.4.2, 5.1.1 and 11)_ - Free space: - - Minimum 15 Mb when not using Predictive mode and no dictionaries are loaded. + - Minimum 25 Mb when not using Predictive mode and no dictionaries are loaded. - Plenty of space per each enabled language in Predictive mode (25-100 Mb, depending on the word count). - A hardware keypad or a keyboard. The application is not usable on touchscreen-only devices. diff --git a/docs/user-manual.md b/docs/user-manual.md index e93094bd..1a579d23 100644 --- a/docs/user-manual.md +++ b/docs/user-manual.md @@ -4,12 +4,11 @@ TT9 is an IME (Input Method Editor) for Android devices with hardware keypad. It All source code, documentation and the privacy policy are available on Github: [https://github.com/sspanak/tt9](https://github.com/sspanak/tt9). ## Initial Setup -After installing, in order to use Traditional T9, you need to enable it as an Android keyboard. To do so: +After installing, in order to use Traditional T9, you need to enable it as an Android keyboard. To do so, click on the launcher icon. If you +need to take any action, you will see the Initial Setup screen, where you will be prompted to enable TT9 and set it as default system +keyboard. -- Go to Android Settings → System → Languages → Keyboards. -- Add Traditional T9 IME. - -_The actual menu names may vary depending on your Android version and phone._ +_If you don't see the icon right after installing, restart your phone and it should appear. Android is trying to save some battery life by not refreshing the newly installed apps list in some cases._ ### Enabling Predictive Mode With the default settings, it is only possible to type in 123 and ABC modes. In order to enable the Predictive mode, there are additional steps: @@ -124,15 +123,15 @@ On the Settings screen, you can choose languages for typing, configure the keypa ### How to access the Settings? #### Method 1 -- Start typing in a text field to wake up TT9. -- Use the on-screen gear button. +Click on the Traditional T9 launcher icon. #### Method 2 - Start typing in a text field to wake up TT9. -- Use the assigned hotkey [Default: Hold ✱]. +- Use the on-screen gear button or press the assigned hotkey [Default: Hold ✱]. #### Method 3 -- Go to Android Settings → System → Languages → Keyboards (or On-Screen Keyboards). This is where all installed keyboards are configured. +- Go to Android Settings → System → Languages → Keyboards (or On-Screen Keyboards/Virtual Keyboards). This is where all installed keyboards + are configured. - Select "Traditional T9". _The actual menu names may vary depending on your phone, Android version and language._ diff --git a/res/values-bg/strings.xml b/res/values-bg/strings.xml index 06b74947..8a0062bf 100644 --- a/res/values-bg/strings.xml +++ b/res/values-bg/strings.xml @@ -35,6 +35,11 @@ Настройки Възстанови стандартните бутони Възстановени са стандартните „бързи“ бутони. + Състояние + Избор на клавиатура по подразбиране + Назад към Настройки + Traditional T9 е активен + Traditional T9 е изключен. Натиснете тук, за да го включите от настройките на Андроид. (задръж) Зареждане на речник Зареждането е отменено. @@ -52,4 +57,5 @@ Бутони в обратен ред Включете настройката, ако на първият ред са 7–8–9, вместо 1–2–3. Изтрий неизбраните + Начална настройка diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index ae0e73bb..31a922f8 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -20,4 +20,5 @@ Tastenfeld Leerzeichen Neue Zeile + Ersteinrichtung diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml index f8171c2f..61f0d9bb 100644 --- a/res/values-es/strings.xml +++ b/res/values-es/strings.xml @@ -15,6 +15,9 @@ Idiomas Tema oscuro Espacio + Estado + Selecciona teclado predeterminado + Volver a la pantalla de configuración Nueva línea Cargar diccionario Cargando diccionario @@ -31,4 +34,5 @@ Diccionario cargado con éxito. Orden de teclas inverso Habilite la configuración si hay 7–8–9 en la primera fila, en lugar de 1–2–3. + Configuración inicial diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml index 079ee378..0d7f8f60 100644 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -37,10 +37,16 @@ Pas de dictionnaire pour langue «%1$s». Veuillez le charger à l\'écran Paramètres. Clavier Espace + État + Sélectionnez le clavier par défaut + Retour à l\'écran des paramètres + Traditional T9 est activé + Traditional T9 est désactivé. Cliquez ici pour l\'activer dans les paramètres Android. Nouvelle ligne Caractère lorsque «0» est appuyé deux fois Tapez un mot… Inverser l\'ordre des clés Activez le paramètre s\'il y a 7–8–9 sur le premier rang, au lieu de 1–2–3. Vider les non sélectionnés + Configuration initiale diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml index a5ba8f8c..360b0162 100644 --- a/res/values-it/strings.xml +++ b/res/values-it/strings.xml @@ -24,8 +24,12 @@ Caricamento annullato. Tastiera Spazio + Stato + Scegli Tastiera predefinita + Torna a Impostazioni Nuova riga Invertire l\'ordine delle chiavi Abilita l\'impostazione se ci sono 7–8–9 sulla prima riga, invece di 1–2–3. + Configurazione iniziale diff --git a/res/values-nl/strings.xml b/res/values-nl/strings.xml index 7e15deb8..54fc28fe 100644 --- a/res/values-nl/strings.xml +++ b/res/values-nl/strings.xml @@ -19,4 +19,5 @@ Toetsenbord Spatie Nieuwe regel + Initiële setup diff --git a/res/values-pt-rBR/strings.xml b/res/values-pt-rBR/strings.xml index 642d8a20..12166200 100644 --- a/res/values-pt-rBR/strings.xml +++ b/res/values-pt-rBR/strings.xml @@ -1,7 +1,5 @@ - https://github.com/sspanak/tt9/blob/master/docs/user-manual.md - Traditional T9 Configurações do Teclado Concluído Um erro inesperado aconteceu. @@ -9,7 +7,6 @@ Adicionar Palavra em branco, impossível adicionar. Palavra \"%1$s\" já está registrada. - Cannot add a word when no language is selected Adicionar Palavra Escreva uma palavra… diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml index 9bd236b8..77cfd905 100644 --- a/res/values-ru/strings.xml +++ b/res/values-ru/strings.xml @@ -45,6 +45,11 @@ Настройки Вернуть кнопки по умолчанию Настройки кнопок по умолчанию восстановлены. + Состояние + Выберите клавиатуру по умолчанию + Вернуться к настройкам + Traditional T9 активен + Traditional T9 отключен. Нажмите здесь, чтобы включить его в настройках Android. (зажать) Назад Позвонить @@ -52,4 +57,5 @@ Перевернутая клавиатура Используйте настройку, если в первом ряду 7–8–9 вместо 1–2–3. Очистить невыбранные + Начальная настройка diff --git a/res/values-uk/strings.xml b/res/values-uk/strings.xml index 117a5e66..fe952672 100644 --- a/res/values-uk/strings.xml +++ b/res/values-uk/strings.xml @@ -37,6 +37,11 @@ Кнопки на екрані Назад Виклик + Стан + Вибрати стандартну клавіатуру + Назад до налаштувань + Traditional T9 активний + Traditional T9 вимкнено. Натисніть тут, щоб увімкнути його в налаштуваннях Android. (затиснути) Додати нове слово Стерти @@ -52,4 +57,5 @@ Зворотна клавіатура Використовуйте налаштування, якщо 7–8–9 у першому рядку замість 1–2–3. Очистіть невибрані + Початкове налаштування diff --git a/res/values/strings.xml b/res/values/strings.xml index b90b2a81..0a299260 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -2,6 +2,7 @@ https://github.com/sspanak/tt9/blob/master/docs/user-manual.md Traditional T9 + TT9 TT9 Settings Completed Unexpected error occurred. @@ -18,6 +19,7 @@ Predictive Mode Select Hotkeys Keypad + Initial Setup Automatic Space Automatically add a space after punctuation or words. @@ -53,6 +55,13 @@ Restore Default Keys Default key settings restored. + + Status + Select Default Keyboard + Return to Settings + Traditional T9 is enabled + Traditional T9 is disabled. Click here to enable it from Android Settings. + (hold) -- Back diff --git a/res/xml/prefs_screen_setup.xml b/res/xml/prefs_screen_setup.xml new file mode 100644 index 00000000..fc8d7007 --- /dev/null +++ b/res/xml/prefs_screen_setup.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + diff --git a/src/io/github/sspanak/tt9/ime/helpers/GlobalKeyboardSettings.java b/src/io/github/sspanak/tt9/ime/helpers/GlobalKeyboardSettings.java new file mode 100644 index 00000000..a7a431d5 --- /dev/null +++ b/src/io/github/sspanak/tt9/ime/helpers/GlobalKeyboardSettings.java @@ -0,0 +1,27 @@ +package io.github.sspanak.tt9.ime.helpers; + +import android.content.Context; +import android.view.inputmethod.InputMethodInfo; +import android.view.inputmethod.InputMethodManager; + + +public class GlobalKeyboardSettings { + private final InputMethodManager inputManager; + private final String packageName; + + + public GlobalKeyboardSettings(Context context, InputMethodManager inputManager) { + this.inputManager = inputManager; + packageName = context.getPackageName(); + } + + + public boolean isTT9Enabled() { + for (final InputMethodInfo imeInfo : inputManager.getEnabledInputMethodList()) { + if (packageName.equals(imeInfo.getPackageName())) { + return true; + } + } + return false; + } +} diff --git a/src/io/github/sspanak/tt9/preferences/PreferencesActivity.java b/src/io/github/sspanak/tt9/preferences/PreferencesActivity.java index 62140cec..d53d13a6 100644 --- a/src/io/github/sspanak/tt9/preferences/PreferencesActivity.java +++ b/src/io/github/sspanak/tt9/preferences/PreferencesActivity.java @@ -1,6 +1,7 @@ package io.github.sspanak.tt9.preferences; import android.os.Bundle; +import android.view.inputmethod.InputMethodManager; import androidx.annotation.NonNull; import androidx.appcompat.app.ActionBar; @@ -14,20 +15,24 @@ import androidx.preference.PreferenceFragmentCompat; import io.github.sspanak.tt9.R; import io.github.sspanak.tt9.db.DictionaryDb; import io.github.sspanak.tt9.db.DictionaryLoader; +import io.github.sspanak.tt9.ime.helpers.GlobalKeyboardSettings; import io.github.sspanak.tt9.ime.helpers.InputModeValidator; import io.github.sspanak.tt9.preferences.screens.AppearanceScreen; import io.github.sspanak.tt9.preferences.screens.DictionariesScreen; import io.github.sspanak.tt9.preferences.screens.HotkeysScreen; +import io.github.sspanak.tt9.preferences.screens.SetupScreen; import io.github.sspanak.tt9.preferences.screens.KeyPadScreen; import io.github.sspanak.tt9.preferences.screens.MainSettingsScreen; import io.github.sspanak.tt9.ui.DictionaryLoadingBar; public class PreferencesActivity extends AppCompatActivity implements PreferenceFragmentCompat.OnPreferenceStartFragmentCallback { public SettingsStore settings; + public GlobalKeyboardSettings globalKeyboardSettings; @Override protected void onCreate(Bundle savedInstanceState) { + globalKeyboardSettings = new GlobalKeyboardSettings(this, (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)); settings = new SettingsStore(this); applyTheme(); @@ -78,7 +83,7 @@ public class PreferencesActivity extends AppCompatActivity implements Preference case "KeyPad": return new KeyPadScreen(this); default: - return new MainSettingsScreen(this); + return globalKeyboardSettings.isTT9Enabled() ? new MainSettingsScreen(this) : new SetupScreen(this); } } @@ -107,7 +112,7 @@ public class PreferencesActivity extends AppCompatActivity implements Preference } setContentView(R.layout.preferences_container); - displayScreen(new MainSettingsScreen(this), false); + displayScreen(getScreen("default"), false); } diff --git a/src/io/github/sspanak/tt9/preferences/items/ItemSelectGlobalKeyboard.java b/src/io/github/sspanak/tt9/preferences/items/ItemSelectGlobalKeyboard.java new file mode 100644 index 00000000..1c8d24fc --- /dev/null +++ b/src/io/github/sspanak/tt9/preferences/items/ItemSelectGlobalKeyboard.java @@ -0,0 +1,27 @@ +package io.github.sspanak.tt9.preferences.items; + +import android.content.Intent; +import android.provider.Settings; + +import androidx.preference.Preference; + +import io.github.sspanak.tt9.preferences.PreferencesActivity; + +public class ItemSelectGlobalKeyboard extends ItemClickable { + private final Intent clickIntent; + private final PreferencesActivity activity; + + public ItemSelectGlobalKeyboard(Preference item, PreferencesActivity prefs) { + super(item); + this.activity = prefs; + + clickIntent = new Intent(Settings.ACTION_INPUT_METHOD_SETTINGS); + clickIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + } + + @Override + protected boolean onClick(Preference p) { + activity.startActivity(clickIntent); + return false; + } +} diff --git a/src/io/github/sspanak/tt9/preferences/items/ItemSetDefaultGlobalKeyboard.java b/src/io/github/sspanak/tt9/preferences/items/ItemSetDefaultGlobalKeyboard.java new file mode 100644 index 00000000..4b89d3a6 --- /dev/null +++ b/src/io/github/sspanak/tt9/preferences/items/ItemSetDefaultGlobalKeyboard.java @@ -0,0 +1,23 @@ +package io.github.sspanak.tt9.preferences.items; + +import android.content.Context; +import android.view.inputmethod.InputMethodManager; + +import androidx.preference.Preference; + +import io.github.sspanak.tt9.preferences.PreferencesActivity; + +public class ItemSetDefaultGlobalKeyboard extends ItemClickable { + private final PreferencesActivity activity; + + public ItemSetDefaultGlobalKeyboard(Preference item, PreferencesActivity prefs) { + super(item); + this.activity = prefs; + } + + @Override + protected boolean onClick(Preference p) { + ((InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE)).showInputMethodPicker(); + return false; + } +} diff --git a/src/io/github/sspanak/tt9/preferences/screens/SetupScreen.java b/src/io/github/sspanak/tt9/preferences/screens/SetupScreen.java new file mode 100644 index 00000000..a1ac8bc1 --- /dev/null +++ b/src/io/github/sspanak/tt9/preferences/screens/SetupScreen.java @@ -0,0 +1,60 @@ +package io.github.sspanak.tt9.preferences.screens; + +import androidx.preference.Preference; + +import io.github.sspanak.tt9.BuildConfig; +import io.github.sspanak.tt9.R; +import io.github.sspanak.tt9.preferences.PreferencesActivity; +import io.github.sspanak.tt9.preferences.items.ItemSelectGlobalKeyboard; +import io.github.sspanak.tt9.preferences.items.ItemSetDefaultGlobalKeyboard; + +public class SetupScreen extends BaseScreenFragment { + public SetupScreen() { init(); } + public SetupScreen(PreferencesActivity activity) { init(activity); } + + @Override protected int getTitle() { return R.string.pref_category_setup;} + @Override protected int getXml() { return R.xml.prefs_screen_setup; } + + @Override + public void onCreate() { + createKeyboardSection(); + createAboutSection(); + } + + @Override + public void onResume() { + super.onResume(); + createKeyboardSection(); + } + + private void createKeyboardSection() { + boolean isTT9On = activity.globalKeyboardSettings.isTT9Enabled(); + + Preference statusItem = findPreference("global_tt9_status"); + if (statusItem != null) { + statusItem.setSummary( + isTT9On ? R.string.setup_tt9_on : R.string.setup_tt9_off + ); + + new ItemSelectGlobalKeyboard(statusItem, activity).enableClickHandler(); + } + + Preference defaultKeyboardItem = findPreference("global_default_keyboard"); + if (defaultKeyboardItem != null) { + new ItemSetDefaultGlobalKeyboard(defaultKeyboardItem, activity).enableClickHandler(); + } + + Preference goToMain = findPreference("goto_main_screen"); + if (goToMain != null) { + goToMain.setEnabled(isTT9On); + } + } + + + private void createAboutSection() { + Preference vi = findPreference("version_info"); + if (vi != null) { + vi.setSummary(BuildConfig.VERSION_FULL); + } + } +}