1
0
Fork 0

added an alternative suggestion scrolling method to fix invisible suggestions on some older devices

This commit is contained in:
sspanak 2023-08-11 18:04:20 +03:00 committed by Dimo Karaivanov
parent a1235e95ac
commit 936c7d3479
14 changed files with 48 additions and 1 deletions

View file

@ -23,6 +23,7 @@
<string name="dictionary_not_found">Неуспешно зареждане. Липсва речник за „%1$s“.</string>
<string name="dictionary_truncated">Речникът е изтрит успешно.</string>
<string name="pref_category_abc_mode">Режим АБВ</string>
<string name="pref_category_hacks">Съвместимост</string>
<string name="pref_category_appearance">Облик</string>
<string name="pref_category_function_keys">Бутони за бърз достъп</string>
<string name="pref_show_soft_function_keys">Бутони на екрана</string>
@ -49,6 +50,8 @@
<string name="dictionary_load_cancelled">Зареждането е отменено.</string>
<string name="pref_abc_auto_accept">Автоматичен избор на буква</string>
<string name="pref_abc_auto_accept_summary">Автоматично избирай текущата буква след кратко изчакване.</string>
<string name="pref_alternative_suggestion_scrolling">Алтернативен метод за превъртане на думи</string>
<string name="pref_alternative_suggestion_scrolling_summary">Включете, ако понякога не виждате целия списък с думи или не може да стигнете до всички (Андроид 9 или по-стари)</string>
<string name="pref_auto_space">Автоматичен интервал</string>
<string name="pref_auto_space_summary">Добавяй автоматично интервал след препинателни знаци и думи.</string>
<string name="pref_auto_text_case">Автоматични главни букви</string>

View file

@ -17,6 +17,7 @@
<string name="dictionary_loading">Lade Wörterbuch (%1$s)…</string>
<string name="dictionary_load_title">Wörterbuch laden</string>
<string name="dictionary_not_found">Wird nicht geladen. Wörterbuch für \"%1$s\" nicht gefunden.</string>
<string name="pref_category_hacks">Kompatibilität</string>
<string name="dictionary_loading_indeterminate">Lade Wörterbuch</string>
<string name="pref_category_keypad">Tastenfeld</string>
<string name="char_space">Leerzeichen</string>

View file

@ -11,6 +11,7 @@
<string name="add_word_exist">La palabra \"%1$s\" ya esta en el diccionario.</string>
<string name="add_word_title">Agregar palabra</string>
<string name="pref_category_abc_mode">Modo ABC</string>
<string name="pref_category_hacks">Compatibilidad</string>
<string name="pref_category_appearance">Apariencia</string>
<string name="pref_category_function_keys">Teclas de acceso rápido</string>
<string name="pref_category_predictive_mode">Texto predictivo</string>

View file

@ -22,6 +22,7 @@
<string name="dictionary_not_found">Echec du chargement. Dictionnaire «%1$s» introuvable.</string>
<string name="pref_category_function_keys">Raccourcis clavier</string>
<string name="pref_category_abc_mode">Saisie ABC</string>
<string name="pref_category_hacks">Compatibilité</string>
<string name="pref_category_appearance">Apparance</string>
<string name="dictionary_load_bad_char">Echec du chargement. Mot inadmissible «%1$s» à la ligne %2$d de langue «%3$s».</string>
<string name="dictionary_truncated">Le dictionaire est supprimé avec succès.</string>
@ -31,6 +32,7 @@
<string name="pref_category_predictive_mode">Saisie intuitive</string>
<string name="pref_abc_auto_accept">Sélection de lettre automatique</string>
<string name="pref_abc_auto_accept_summary">Ajouter automatiquement la lettre sélectionnée après un court délai.</string>
<string name="pref_alternative_suggestion_scrolling">Méthode alternative de défilement des mots</string>
<string name="pref_auto_space">Espace automatique</string>
<string name="pref_auto_text_case">Majuscules automatiques</string>
<string name="pref_auto_space_summary">Ajouter automatiquement un espace après signes de ponctuation et mots.</string>

View file

@ -20,6 +20,7 @@
<string name="dictionary_loading">Caricamento del dizionario (%1$s)…</string>
<string name="dictionary_load_title">Carica il dizionario</string>
<string name="dictionary_not_found">Impossibile caricare. Dizionario per “%1$s” non trovato.</string>
<string name="pref_category_hacks">Compatibilità</string>
<string name="pref_category_function_keys">Scorciatoie da tastiera</string>
<string name="dictionary_loading_indeterminate">Caricamento del dizionario</string>
<string name="dictionary_load_cancelled">Caricamento annullato.</string>

View file

@ -12,6 +12,7 @@
<string name="add_word_field_placeholder">הקלד מילה…</string>
<string name="pref_category_about">אודות</string>
<string name="pref_category_hacks">הגדרות תאימות</string>
<string name="pref_category_appearance">מראה</string>
<string name="pref_category_predictive_mode">מצב חיזוי</string>
<string name="pref_category_function_keys">בחר מקשי קיצור</string>

View file

@ -16,6 +16,7 @@
<string name="dictionary_load_title">Woordenboek laden</string>
<string name="dictionary_not_found">Laden mislukt. Woordenboek voor %1$s niet gevonden.</string>
<string name="dictionary_truncated">Woordenboek succesvol gewist.</string>
<string name="pref_category_hacks">Compatibiliteit</string>
<string name="dictionary_loading_indeterminate">Woordenboek laden</string>
<string name="pref_category_keypad">Toetsenbord</string>
<string name="char_space">Spatie</string>

View file

@ -12,6 +12,7 @@
<string name="add_word_field_placeholder">Escreva uma palavra…</string>
<string name="pref_category_about">Sobre</string>
<string name="pref_category_hacks">Compatibilidade</string>
<string name="pref_category_appearance">Aparência</string>
<string name="pref_category_predictive_mode">Modo Predictivo</string>
<string name="pref_category_function_keys">Atalhos</string>

View file

@ -28,10 +28,13 @@
<string name="char_space">Пробел</string>
<string name="char_newline">Новая строка</string>
<string name="pref_category_abc_mode">Режим AБВ</string>
<string name="pref_category_hacks">Cовместимость</string>
<string name="pref_category_appearance">Внешний вид</string>
<string name="pref_category_function_keys">Горячие клавиши</string>
<string name="pref_abc_auto_accept">Автоматический выбор буквы</string>
<string name="pref_abc_auto_accept_summary">Автоматически ввести выбранную букву после короткого ожидания.</string>
<string name="pref_alternative_suggestion_scrolling">Альтернативный метод прокрутки слов</string>
<string name="pref_alternative_suggestion_scrolling_summary">Включите, если иногда вы не видите все слова или у вас возникают проблемы с их прокруткой (Android 9 или старше).</string>
<string name="pref_auto_space">Авто пробел</string>
<string name="pref_auto_space_summary">Автоматически добавлять пробел после слов и знаков препинания.</string>
<string name="pref_auto_text_case">Авто заглавные буквы</string>

View file

@ -26,11 +26,14 @@
<string name="char_space">Пробіл</string>
<string name="char_newline">Новий рядок</string>
<string name="pref_category_abc_mode">Режим AБВ</string>
<string name="pref_category_hacks">Сумісность</string>
<string name="pref_category_appearance">Вигляд</string>
<string name="pref_category_predictive_mode">Режим підсказки</string>
<string name="pref_category_function_keys">Гарячі клавіші</string>
<string name="pref_abc_auto_accept">Автоматичний вибір букви</string>
<string name="pref_abc_auto_accept_summary">Автоматично ввести вибрану букву після короткої затримки.</string>
<string name="pref_alternative_suggestion_scrolling">Альтернативний метод прокручування слів</string>
<string name="pref_alternative_suggestion_scrolling_summary">Увімкніть, якщо іноді ви не бачите всі слова або у вас виникають проблеми з їх прокручуванням (Android 9 або старіша).</string>
<string name="pref_auto_space">Авто пробіл</string>
<string name="pref_auto_space_summary">Автоматично додавати пробіл після слів і розділових знаків.</string>
<string name="pref_auto_text_case">Авто заголовні букви</string>

View file

@ -20,6 +20,7 @@
<string name="pref_category_about">About</string>
<string name="pref_category_abc_mode">ABC Mode</string>
<string name="pref_category_hacks">Compatibility</string>
<string name="pref_category_appearance">Appearance</string>
<string name="pref_category_debug_options" translatable="false">Debug Options</string>
<string name="pref_category_log_messages" translatable="false">Recent Log Messages</string>
@ -30,6 +31,8 @@
<string name="pref_abc_auto_accept">Automatic Letter Select</string>
<string name="pref_abc_auto_accept_summary">Automatically type the selected letter after a short delay.</string>
<string name="pref_alternative_suggestion_scrolling">Alternative Suggestion Scrolling Method</string>
<string name="pref_alternative_suggestion_scrolling_summary">Enable if sometimes you can not see all suggestions or have trouble scrolling them (Android 9 or older).</string>
<string name="pref_auto_space">Automatic Space</string>
<string name="pref_auto_space_summary">Automatically add a space after punctuation or words.</string>
<string name="pref_auto_text_case">Automatic Capitalization</string>

View file

@ -11,4 +11,17 @@
app:key="global_default_keyboard"
app:layout="@layout/pref_text"
app:title="@string/setup_default_keyboard" />
<PreferenceCategory
app:title="@string/pref_category_hacks"
app:layout="@layout/pref_category"
app:singleLineTitle="true">
<SwitchPreferenceCompat
app:key="pref_alternative_suggestion_scrolling"
app:layout="@layout/pref_switch"
app:title="@string/pref_alternative_suggestion_scrolling"
app:summary="@string/pref_alternative_suggestion_scrolling_summary"/>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -265,6 +265,10 @@ public class SettingsStore {
/************* internal settings *************/
public int getSuggestionScrollingDelay() {
return prefs.getBoolean("pref_alternative_suggestion_scrolling", false) ? 200 : 0;
}
public int getDictionaryImportProgressUpdateInterval() { return 250; /* ms */ }
public int getDictionaryImportWordChunkSize() { return 1000; /* words */ }

View file

@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.view.View;
import androidx.core.content.ContextCompat;
@ -27,12 +28,17 @@ public class SuggestionsBar {
private final TraditionalT9 tt9;
private SuggestionsAdapter mSuggestionsAdapter;
private final Handler alternativeScrollingHandler = new Handler();
private final int suggestionScrollingDelay;
public SuggestionsBar(TraditionalT9 tt9, View mainView) {
super();
this.tt9 = tt9;
suggestionScrollingDelay = tt9.getSettings().getSuggestionScrollingDelay();
mView = mainView.findViewById(R.id.suggestions_bar);
mView.setLayoutManager(new LinearLayoutManager(mainView.getContext(), RecyclerView.HORIZONTAL,false));
@ -148,7 +154,11 @@ public class SuggestionsBar {
mSuggestionsAdapter.notifyItemChanged(oldIndex);
mSuggestionsAdapter.notifyItemChanged(selectedIndex);
mView.scrollToPosition(selectedIndex);
if (suggestionScrollingDelay > 0) {
alternativeScrollingHandler.postDelayed(() -> mView.scrollToPosition(selectedIndex), suggestionScrollingDelay);
} else {
mView.scrollToPosition(selectedIndex);
}
}