added an option to adjust the suggestion text size
This commit is contained in:
parent
ceec555ae2
commit
0a8361fc7d
21 changed files with 95 additions and 7 deletions
|
|
@ -33,7 +33,7 @@ abstract class UiHandler extends AbstractHandler {
|
|||
setInputView(mainView.getView());
|
||||
createSuggestionBar();
|
||||
getSuggestionOps().setDarkTheme();
|
||||
statusBar = new StatusBar(mainView.getView());
|
||||
statusBar = new StatusBar(settings, mainView.getView());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ public class AppearanceScreen extends BaseScreenFragment {
|
|||
ItemShowArrows showArrows = new ItemShowArrows(findPreference(ItemShowArrows.NAME), activity.getSettings());
|
||||
ItemNumpadFnKeyScale fnKeyWidth = new ItemNumpadFnKeyScale(findPreference(ItemNumpadFnKeyScale.NAME), activity.getSettings());
|
||||
ItemNumpadKeyFontSize numpadKeyFontSize = new ItemNumpadKeyFontSize(findPreference(ItemNumpadKeyFontSize.NAME), activity.getSettings());
|
||||
ItemSuggestionFontSize suggestionFontSize = new ItemSuggestionFontSize(findPreference(ItemSuggestionFontSize.NAME), activity.getSettings());
|
||||
|
||||
ItemSelectLayoutType selectLayout = new ItemSelectLayoutType(findPreference(ItemSelectLayoutType.NAME), activity)
|
||||
.addOnChangeItem(alignment)
|
||||
|
|
@ -43,7 +44,8 @@ public class AppearanceScreen extends BaseScreenFragment {
|
|||
.addOnChangeItem(numpadKeyFontSize)
|
||||
.addOnChangeItem(numpadKeyHeight)
|
||||
.addOnChangeItem(numpadShape)
|
||||
.addOnChangeItem(showArrows);
|
||||
.addOnChangeItem(showArrows)
|
||||
.addOnChangeItem(suggestionFontSize);
|
||||
|
||||
|
||||
ItemDropDown[] items = {
|
||||
|
|
@ -55,7 +57,8 @@ public class AppearanceScreen extends BaseScreenFragment {
|
|||
keyboardWidth,
|
||||
numpadShape,
|
||||
fnKeyWidth,
|
||||
numpadKeyFontSize
|
||||
numpadKeyFontSize,
|
||||
suggestionFontSize
|
||||
};
|
||||
|
||||
for (ItemDropDown item : items) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
package io.github.sspanak.tt9.preferences.screens.appearance;
|
||||
|
||||
import androidx.preference.DropDownPreference;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import io.github.sspanak.tt9.preferences.items.ItemDropDown;
|
||||
import io.github.sspanak.tt9.preferences.settings.SettingsStore;
|
||||
|
||||
public class ItemSuggestionFontSize extends ItemDropDown implements ItemLayoutChangeReactive{
|
||||
public static final String NAME = "pref_suggestion_font_size";
|
||||
private final SettingsStore settings;
|
||||
|
||||
public ItemSuggestionFontSize(DropDownPreference item, SettingsStore settings) {
|
||||
super(item);
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemDropDown populate() {
|
||||
LinkedHashMap<Integer, String> options = new LinkedHashMap<>();
|
||||
for (int i = 70; i <= 150; i += 5) {
|
||||
options.put(i, i + " %");
|
||||
}
|
||||
super.populateIntegers(options);
|
||||
super.setValue(String.valueOf(settings.getSuggestionFontSizePercent()));
|
||||
onLayoutChange(settings.getMainViewLayout());
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public void onLayoutChange(int mainViewLayout) {
|
||||
if (item != null) {
|
||||
item.setVisible(mainViewLayout != SettingsStore.LAYOUT_STEALTH);
|
||||
item.setIconSpaceReserved(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -123,6 +123,14 @@ public class SettingsUI extends SettingsTyping {
|
|||
return getStringifiedInt("pref_font_size", defaultSize);
|
||||
}
|
||||
|
||||
public float getSuggestionFontScale() {
|
||||
return getSuggestionFontSizePercent() / 100f;
|
||||
}
|
||||
|
||||
public int getSuggestionFontSizePercent() {
|
||||
return getStringifiedInt("pref_suggestion_font_size", 100);
|
||||
}
|
||||
|
||||
public boolean getSuggestionSmoothScroll() {
|
||||
return prefs.getBoolean("pref_suggestion_smooth_scroll", !DeviceInfo.noTouchScreen(context));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +1,27 @@
|
|||
package io.github.sspanak.tt9.ui.tray;
|
||||
|
||||
import android.text.SpannableString;
|
||||
import android.text.style.RelativeSizeSpan;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import io.github.sspanak.tt9.R;
|
||||
import io.github.sspanak.tt9.ime.modes.InputMode;
|
||||
import io.github.sspanak.tt9.ime.voice.VoiceInputOps;
|
||||
import io.github.sspanak.tt9.preferences.settings.SettingsStore;
|
||||
import io.github.sspanak.tt9.util.Logger;
|
||||
|
||||
public class StatusBar {
|
||||
@Nullable private final TextView statusView;
|
||||
@NonNull private final SettingsStore settings;
|
||||
@Nullable private String statusText;
|
||||
|
||||
|
||||
public StatusBar(@Nullable View mainView) {
|
||||
public StatusBar(@NonNull SettingsStore settings, @Nullable View mainView) {
|
||||
this.settings = settings;
|
||||
statusView = mainView != null ? mainView.findViewById(R.id.status_bar) : null;
|
||||
}
|
||||
|
||||
|
|
@ -63,6 +69,9 @@ public class StatusBar {
|
|||
return;
|
||||
}
|
||||
|
||||
statusView.setText(statusText);
|
||||
SpannableString scaledText = new SpannableString(statusText);
|
||||
scaledText.setSpan(new RelativeSizeSpan(settings.getSuggestionFontScale()), 0, statusText.length(), 0);
|
||||
|
||||
statusView.setText(scaledText);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package io.github.sspanak.tt9.ui.tray;
|
|||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.text.SpannableString;
|
||||
import android.text.style.RelativeSizeSpan;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
|
@ -21,6 +23,7 @@ public class SuggestionsAdapter extends RecyclerView.Adapter<SuggestionsAdapter.
|
|||
private final int textViewResourceId;
|
||||
private final LayoutInflater mInflater;
|
||||
private final List<String> mSuggestions;
|
||||
private float textSize;
|
||||
|
||||
private int colorDefault;
|
||||
private int colorHighlight;
|
||||
|
|
@ -46,7 +49,10 @@ public class SuggestionsAdapter extends RecyclerView.Adapter<SuggestionsAdapter.
|
|||
|
||||
@Override
|
||||
public void onBindViewHolder(ViewHolder holder, int position) {
|
||||
holder.suggestionItem.setText(mSuggestions.get(position));
|
||||
SpannableString scaledText = new SpannableString(mSuggestions.get(position));
|
||||
scaledText.setSpan(new RelativeSizeSpan(textSize), 0, scaledText.length(), 0);
|
||||
holder.suggestionItem.setText(scaledText);
|
||||
|
||||
holder.suggestionItem.setTag(position);
|
||||
holder.suggestionItem.setTextColor(selectedIndex == position ? colorHighlight : colorDefault);
|
||||
holder.suggestionItem.setBackgroundColor(selectedIndex == position ? backgroundHighlight : Color.TRANSPARENT);
|
||||
|
|
@ -73,6 +79,11 @@ public class SuggestionsAdapter extends RecyclerView.Adapter<SuggestionsAdapter.
|
|||
}
|
||||
|
||||
|
||||
public void setTextSize(float size) {
|
||||
textSize = size;
|
||||
}
|
||||
|
||||
|
||||
public void setColorDefault(int colorDefault) {
|
||||
this.colorDefault = colorDefault;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -276,6 +276,7 @@ public class SuggestionsBar {
|
|||
}
|
||||
|
||||
setBackground(false);
|
||||
mSuggestionsAdapter.setTextSize(settings.getSuggestionFontScale());
|
||||
|
||||
boolean smooth = settings.getSuggestionSmoothScroll() && visibleSuggestions.size() <= SettingsStore.SUGGESTIONS_MAX + 1;
|
||||
mView.setItemAnimator(smooth ? animator : null);
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@
|
|||
<string name="pref_double_zero_char">Символ при двойно натисната „0“</string>
|
||||
<string name="char_newline">Нов ред</string>
|
||||
<string name="char_space">Интервал</string>
|
||||
<string name="pref_suggestion_font_size">Размер на шрифта за предложенията</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>
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@
|
|||
<string name="pref_privacy_policy">Datenschutzerklärung</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_font_size">Schriftgröße der Vorschläge</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 7–8–9 anstelle von 1–2–3 hat.</string>
|
||||
|
|
|
|||
|
|
@ -80,6 +80,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_font_size">Tamaño de fuente de las sugerencias</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 7–8–9 en la primera fila, en lugar de 1–2–3.</string>
|
||||
|
|
|
|||
|
|
@ -109,6 +109,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_font_size">Taille de police des suggestions</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 7–8–9 sur le premier rang, au lieu de 1–2–3.</string>
|
||||
|
|
|
|||
|
|
@ -90,6 +90,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_font_size">Dimensione carattere suggerimenti</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 7–8–9 sulla prima riga, invece di 1–2–3.</string>
|
||||
|
|
@ -137,7 +138,7 @@
|
|||
<string name="pref_layout">Layout sullo schermo</string>
|
||||
<string name="dictionary_no_notifications">Notifiche del dizionario</string>
|
||||
<string name="dictionary_no_notifications_summary">Ricevere notifiche sugli aggiornamenti del dizionario e sul progresso del caricamento.</string>
|
||||
<string name="pref_numpad_key_font_size">Dimensione del carattere dei tasti</string>
|
||||
<string name="pref_numpad_key_font_size">Dimensione carattere dei tasti</string>
|
||||
<string name="pref_numpad_key_height">Altezza</string>
|
||||
<string name="pref_numpad_fn_key_width">Larghezza dei tasti lettera</string>
|
||||
<string name="pref_font_size">Dimensione del carattere delle impostazioni</string>
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@
|
|||
<string name="pref_privacy_policy">מדיניות פרטיות</string>
|
||||
<string name="pref_status_icon">סמל מצב</string>
|
||||
<string name="pref_status_icon_summary">הצגת סמל כאשר קלט המקלדת פעיל.</string>
|
||||
<string name="pref_suggestion_font_size">גודל גופן להצעות</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>
|
||||
|
|
|
|||
|
|
@ -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_font_size">Siūlymų šrifto dydis</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 7–8–9, o ne 1–2–3.</string>
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@
|
|||
<string name="pref_privacy_policy">Privacybeleid</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_font_size">Lettergrootte van suggesties</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 7–8–9 op de eerste rij heeft, in plaats van 1–2–3.</string>
|
||||
|
|
|
|||
|
|
@ -111,6 +111,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 7–8–9 na linha de cima, ao invés de 1–2–3.</string>
|
||||
<string name="pref_suggestion_font_size">Tamanho da fonte das sugestões</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>
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@
|
|||
<string name="key_hold_key">(зажать)</string>
|
||||
<string name="key_back">Назад</string>
|
||||
<string name="key_call">Позвонить</string>
|
||||
<string name="pref_suggestion_font_size">Размер шрифта подсказок</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>
|
||||
|
|
|
|||
|
|
@ -138,6 +138,7 @@
|
|||
<string name="pref_font_size">Yazı tipi boyutunu ayarla</string>
|
||||
<string name="pref_font_size_default">Standart</string>
|
||||
|
||||
<string name="pref_suggestion_font_size">Öneri yazı tipi boyutu</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 1–2–3 yerine 7–8–9 kullanıyorsanız bunu aktif edin.</string>
|
||||
|
|
|
|||
|
|
@ -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_font_size">Розмір шрифту пропозицій</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>
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@
|
|||
<string name="pref_privacy_policy">Privacy Policy</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_font_size">Suggestion Font Size</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 7–8–9 on the first row, instead of 1–2–3.</string>
|
||||
|
|
|
|||
|
|
@ -44,6 +44,10 @@
|
|||
app:key="pref_numpad_fn_key_width"
|
||||
app:title="@string/pref_numpad_fn_key_width" />
|
||||
|
||||
<DropDownPreference
|
||||
app:key="pref_suggestion_font_size"
|
||||
app:title="@string/pref_suggestion_font_size" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
app:key="pref_arrow_keys_visible"
|
||||
app:title="@string/pref_arrow_keys_visible"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue