1
0
Fork 0

added an option to disable the suggestion-list scrolling animations

This commit is contained in:
sspanak 2025-03-26 15:49:58 +02:00 committed by Dimo Karaivanov
parent a5b6a20a50
commit 14d5f2fc44
18 changed files with 55 additions and 5 deletions

View file

@ -25,6 +25,7 @@ public class AppearanceScreen extends BaseScreenFragment {
private void createMainSection() {
(new ItemStatusIcon(findPreference(ItemStatusIcon.NAME), activity.getSettings())).populate();
(new ItemDragResize(findPreference(ItemDragResize.NAME), activity.getSettings())).populate();
(new ItemSuggestionSmoothScroll(findPreference(ItemSuggestionSmoothScroll.NAME), activity.getSettings())).populate();
ItemAlignment alignment = new ItemAlignment(findPreference(ItemAlignment.NAME), activity.getSettings());
ItemNumpadKeyHeight numpadKeyHeight = new ItemNumpadKeyHeight(findPreference(ItemNumpadKeyHeight.NAME), activity.getSettings());

View file

@ -0,0 +1,27 @@
package io.github.sspanak.tt9.preferences.screens.appearance;
import androidx.preference.Preference;
import androidx.preference.SwitchPreferenceCompat;
import io.github.sspanak.tt9.preferences.items.ItemClickable;
import io.github.sspanak.tt9.preferences.settings.SettingsStore;
public class ItemSuggestionSmoothScroll extends ItemClickable {
public static final String NAME = "pref_suggestion_smooth_scroll";
private final SettingsStore settings;
public ItemSuggestionSmoothScroll(Preference item, SettingsStore settings) {
super(item);
this.settings = settings;
}
@Override protected boolean onClick(Preference p) { return true; }
public ItemSuggestionSmoothScroll populate() {
if (item != null) {
((SwitchPreferenceCompat) item).setChecked(settings.getSuggestionSmoothScroll());
}
return this;
}
}

View file

@ -123,6 +123,10 @@ public class SettingsUI extends SettingsTyping {
return getStringifiedInt("pref_font_size", defaultSize);
}
public boolean getSuggestionSmoothScroll() {
return prefs.getBoolean("pref_suggestion_smooth_scroll", !DeviceInfo.noTouchScreen(context));
}
public int getTheme() {
return getStringifiedInt("pref_theme", AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
}

View file

@ -270,7 +270,8 @@ public class SuggestionsBar {
return;
}
mView.setItemAnimator(visibleSuggestions.size() <= SettingsStore.SUGGESTIONS_MAX + 1 ? animator : null);
boolean smooth = settings.getSuggestionSmoothScroll() && visibleSuggestions.size() <= SettingsStore.SUGGESTIONS_MAX + 1;
mView.setItemAnimator(smooth ? animator : null);
mSuggestionsAdapter.resetItems(selectedIndex);
if (selectedIndex > 0) {
@ -361,7 +362,8 @@ public class SuggestionsBar {
return;
}
mView.setItemAnimator(Math.abs(selectedIndex - lastScrollIndex) < SettingsStore.SUGGESTIONS_MAX ? animator : null);
boolean smooth = settings.getSuggestionSmoothScroll() && Math.abs(selectedIndex - lastScrollIndex) < SettingsStore.SUGGESTIONS_MAX;
mView.setItemAnimator(smooth ? animator : null);
mView.scrollToPosition(containsStem() && selectedIndex == 1 ? 0 : selectedIndex);
lastScrollIndex = selectedIndex;
}

View file

@ -23,7 +23,7 @@
<string name="pref_auto_capitals_after_newline">Автоматични главни букви на всеки ред</string>
<string name="pref_auto_capitals_after_newline_summary">Започвай всеки ред с главна буква, дори и да е в средата на изречение.</string>
<string name="pref_backspace_recomposing">Редактиране на думи</string>
<string name="pref_backspace_recomposing_summary">Връщай списъка с предложения при натискане на Backspace на края на дума. (Не работи в някои приложения.)</string>
<string name="pref_backspace_recomposing_summary">Връщай списъка с думи при натискане на Backspace на края на дума. (Не работи в някои приложения.)</string>
<string name="pref_choose_languages">Езици</string>
<string name="dictionary_truncate_title">Изтрий всички</string>
<string name="pref_numpad_shape_long_space">Дълъг интервал</string>
@ -126,6 +126,7 @@
<string name="pref_double_zero_char">Символ при двойно натисната „0“</string>
<string name="char_newline">Нов ред</string>
<string name="char_space">Интервал</string>
<string name="pref_suggestion_smooth_scroll">Плавно превъртане на списъка с думи</string>
<string name="pref_upside_down_keys">Бутони в обратен ред</string>
<string name="pref_upside_down_keys_summary">Включете настройката, ако на първият ред са 789, вместо 123.</string>
<string name="dictionary_truncate_unselected">Изтрий неизбраните</string>

View file

@ -48,6 +48,7 @@
<string name="pref_predict_word_pairs_summary">Häufig verwendete Phrasen merken, um die Genauigkeit der Vorschläge zu verbessern.</string>
<string name="pref_status_icon">Statusicon</string>
<string name="pref_status_icon_summary">Ein Icon anzeigen, wenn die Tastatureingabe aktiv ist.</string>
<string name="pref_suggestion_smooth_scroll">Sanftes Scrollen der Wortliste</string>
<string name="pref_upside_down_keys">Die Reihenfolge der Tasten umkehren</string>
<string name="pref_upside_down_keys_summary">Aktivieren Sie, wenn die Tastatur in der ersten Zeile 789 anstelle von 123 hat.</string>
<string name="dictionary_cancel_load">Laden abbrechen</string>

View file

@ -79,6 +79,7 @@
<string name="dictionary_load_no_internet">Error al descargar el diccionario para el idioma \"%1$s\". Verifique la conexión a Internet.</string>
<string name="dictionary_load_cancelled">Carga del diccionario cancelada.</string>
<string name="dictionary_loaded">Diccionario cargado con éxito.</string>
<string name="pref_suggestion_smooth_scroll">Desplazamiento suave de sugerencias</string>
<string name="pref_upside_down_keys">Orden de teclas inverso</string>
<string name="pref_upside_down_keys_summary">Habilite la configuración si hay 789 en la primera fila, en lugar de 123.</string>
<string name="pref_category_setup">Configuración inicial</string>

View file

@ -63,8 +63,8 @@
<string name="pref_abc_auto_accept_slow">Lente</string>
<string name="pref_allow_composing_text_summary">Afficher les mots dans les champs de texte en les tapant. Désactiver lorsqu\'une application interrompt la saisie.</string>
<string name="pref_alternative_suggestion_scrolling">Méthode alternative de défilement des mots</string>
<string name="pref_alternative_suggestion_scrolling_summary">Activez si parfois vous ne pouvez pas voir toutes les suggestions ou vous avez des difficultés à les défiler.</string>
<string name="pref_arrow_keys_visible_summary">Afficher les touches de défilement des deux côtés de la liste de suggestions de mots.</string>
<string name="pref_alternative_suggestion_scrolling_summary">Activez si parfois vous ne pouvez pas voir tous les mots ou vous avez des difficultés à les défiler.</string>
<string name="pref_arrow_keys_visible_summary">Afficher les touches de défilement des deux côtés de la liste de 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>
@ -107,6 +107,7 @@
<string name="char_newline">Nouvelle ligne</string>
<string name="pref_drag_resize_summary">Activer le redimensionnement et le déplacement du clavier en faisant glisser la barre détat ou la touche Paramètres.</string>
<string name="pref_double_zero_char">Caractère lorsque «0» est appuyé deux fois</string>
<string name="pref_suggestion_smooth_scroll">Défilement fluide de la liste de mots</string>
<string name="pref_upside_down_keys">Inverser l\'ordre des clés</string>
<string name="pref_upside_down_keys_summary">Activez le paramètre s\'il y a 789 sur le premier rang, au lieu de 123.</string>
<string name="dictionary_truncate_unselected">Supprimer les non sélectionnés</string>

View file

@ -89,6 +89,7 @@
<string name="key_volume_down">Abbassa il volume</string>
<string name="key_volume_up">Alza il volume</string>
<string name="char_newline">Nuova riga</string>
<string name="pref_suggestion_smooth_scroll">Scorrimento fluido dei suggerimenti</string>
<string name="pref_upside_down_keys">Invertire l\'ordine delle chiavi</string>
<string name="pref_upside_down_keys_summary">Abilita l\'impostazione se ci sono 789 sulla prima riga, invece di 123.</string>
<string name="pref_category_setup">Configurazione iniziale</string>

View file

@ -62,6 +62,7 @@
<string name="pref_predict_word_pairs_summary">לזכור ביטויים נפוצים כדי לשפר את דיוק ההצעות.</string>
<string name="pref_status_icon">סמל מצב</string>
<string name="pref_status_icon_summary">הצגת סמל כאשר קלט המקלדת פעיל.</string>
<string name="pref_suggestion_smooth_scroll">גלילה חלקה של הצעות</string>
<string name="pref_upside_down_keys">להפוך את סדר המקשים</string>
<string name="pref_upside_down_keys_summary">הפעל את ההגדרה אם המקלדת כוללת את המספרים 7-8-9 בשורה הראשונה, במקום 1-2-3.</string>
<string name="dictionary_cancel_load">ביטול טעינה</string>

View file

@ -58,6 +58,7 @@
<string name="pref_layout_tray">Tik žodžių sąrašas</string>
<string name="pref_haptic_feedback_summary">Vibruoti paspaudus virtualų klavišą. (Neįmanoma visuose įrenginiuose)</string>
<string name="pref_help">Pagalba</string>
<string name="pref_suggestion_smooth_scroll">Sklandus žodžių sąrašo slinkimas</string>
<string name="pref_upside_down_keys">Atvirkštinė klavišų tvarka</string>
<string name="pref_upside_down_keys_summary">Įjunkite šį nustatymą jei pirmoje eilutėje turite 789, o ne 123.</string>

View file

@ -48,6 +48,7 @@
<string name="pref_predict_word_pairs_summary">Veelgebruikte zinnen onthouden om de nauwkeurigheid van suggesties te verbeteren.</string>
<string name="pref_status_icon">Statusicoon</string>
<string name="pref_status_icon_summary">Een icoon tonen wanneer toetsenbordinvoer actief is.</string>
<string name="pref_suggestion_smooth_scroll">Vloeiend suggesties scrollen</string>
<string name="pref_upside_down_keys">De volgorde van de toetsen omkeren</string>
<string name="pref_upside_down_keys_summary">Activeer als het toetsenbord 789 op de eerste rij heeft, in plaats van 123.</string>
<string name="dictionary_cancel_load">Laden annuleren</string>

View file

@ -109,6 +109,7 @@
<string name="char_newline">Nova Linha</string>
<string name="char_space">Espaço</string>
<string name="pref_upside_down_keys_summary">Utilize essa opção se você possuir as teclas 789 na linha de cima, ao invés de 123.</string>
<string name="pref_suggestion_smooth_scroll">Rolagem suave de sugestões</string>
<string name="pref_upside_down_keys">Inverter ordem das teclas</string>
<string name="dictionary_truncate_unselected">Limpar Não Selecionados</string>
<string name="pref_dark_theme_yes">Sim</string>

View file

@ -103,6 +103,7 @@
<string name="key_hold_key">(зажать)</string>
<string name="key_back">Назад</string>
<string name="key_call">Позвонить</string>
<string name="pref_suggestion_smooth_scroll">Плавная прокрутка списка слов</string>
<string name="pref_upside_down_keys">Перевернутая клавиатура</string>
<string name="pref_upside_down_keys_summary">Используйте настройку, если в первом ряду 789 вместо 123.</string>
<string name="dictionary_truncate_unselected">Удалить невыбранные</string>

View file

@ -137,6 +137,7 @@
<string name="pref_font_size">Yazı tipi boyutunu ayarla</string>
<string name="pref_font_size_default">Standart</string>
<string name="pref_suggestion_smooth_scroll">Akıcı öneri kaydırma</string>
<string name="pref_upside_down_keys">Tuş Düzenini Tersine Çevir</string>
<string name="pref_upside_down_keys_summary">Eğer ilk satırda 123 yerine 789 kullanıyorsanız bunu aktif edin.</string>

View file

@ -64,6 +64,7 @@
<string name="pref_layout_tray">Лише список слів</string>
<string name="pref_haptic_feedback_summary">Вібрувати при натисканні віртуальної клавіші. (Неможливо на всіх пристроях)</string>
<string name="pref_help">Допомога</string>
<string name="pref_suggestion_smooth_scroll">Плавне гортання пропозицій</string>
<string name="pref_upside_down_keys">Зворотній порядок клавіш</string>
<string name="pref_upside_down_keys_summary">Використовуйте це налаштування, якщо у вас в першому ряді 789 замість 123.</string>

View file

@ -99,6 +99,7 @@
<string name="pref_predict_word_pairs_summary">Remember commonly used phrases to improve the suggestions accuracy.</string>
<string name="pref_status_icon">Status Icon</string>
<string name="pref_status_icon_summary">Show an icon when keyboard input is active.</string>
<string name="pref_suggestion_smooth_scroll">Smooth Suggestion Scrolling</string>
<string name="pref_upside_down_keys">Reverse Key Order</string>
<string name="pref_upside_down_keys_summary">Enable if the keypad has 789 on the first row, instead of 123.</string>

View file

@ -51,6 +51,9 @@
</PreferenceCategory>
<PreferenceCategory app:title="@string/pref_category_hacks">
<SwitchPreferenceCompat
app:key="pref_suggestion_smooth_scroll"
app:title="@string/pref_suggestion_smooth_scroll"/>
<SwitchPreferenceCompat
app:key="pref_alternative_suggestion_scrolling"