1
0
Fork 0

removed the CandidateView hack, as it turned out to have no effect

This commit is contained in:
sspanak 2024-04-25 23:06:43 +03:00 committed by Dimo Karaivanov
parent 2760a30af2
commit 480e541527
19 changed files with 20 additions and 109 deletions

View file

@ -10,10 +10,6 @@ import android.view.KeyEvent;
import androidx.annotation.NonNull;
public class DeviceInfo {
public static boolean noTouchScreen(Context context) {
return !context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN);
}
public static boolean noKeyboard(Context context) {
return
context.getResources().getConfiguration().keyboard == Configuration.KEYBOARD_NOKEYS
@ -21,24 +17,24 @@ public class DeviceInfo {
&& !KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_POUND);
}
public static boolean isQinF21() {
return Build.MANUFACTURER.equals("DuoQin") && Build.MODEL.contains("F21");
public static boolean noTouchScreen(Context context) {
return !context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN);
}
public static boolean isLgX100S() {
return Build.MANUFACTURER.equals("LGE") && Build.MODEL.contains("X100S");
}
public static boolean isQinF21() {
return Build.MANUFACTURER.equals("DuoQin") && Build.MODEL.contains("F21");
}
public static boolean isSonim() {
return Build.MANUFACTURER.equals("Sonimtech");
}
public static boolean isSonimGen1(Context context) {
return isSonim() && noTouchScreen(context) && Build.VERSION.SDK_INT < Build.VERSION_CODES.P;
}
public static boolean isSonimGen2(Context context) {
return isSonim() && noTouchScreen(context) && Build.VERSION.SDK_INT <= Build.VERSION_CODES.R;
return isSonim() && Build.VERSION.SDK_INT == Build.VERSION_CODES.R && noTouchScreen(context);
}
@NonNull

View file

@ -47,8 +47,16 @@ public class TraditionalT9 extends MainViewOps {
// Some devices have their own super.onCreateXxxView(), which does some magic allowing our MainView to remain visible.
// This is why we must call the super method, instead of returning null, as in the AOSP code.
@Override public View onCreateInputView() { return settings.getCandidatesView() ? super.onCreateInputView() : createMainView(); }
@Override public View onCreateCandidatesView() { return settings.getCandidatesView() ? createMainView() : super.onCreateCandidatesView(); }
@Override
public View onCreateInputView() {
mainView.forceCreateView();
initTray();
setDarkTheme();
setStatusText(mInputMode.toString());
suggestionOps.set(mInputMode.getSuggestions());
return mainView.getView();
}
@Override
@ -124,13 +132,7 @@ public class TraditionalT9 extends MainViewOps {
private void initTray() {
if (settings.getCandidatesView()) {
setCandidatesView(mainView.getView());
setInputView(mainView.getBlankView());
} else {
setCandidatesView(mainView.getBlankView());
setInputView(mainView.getView());
}
setInputView(mainView.getView());
createSuggestionBar(mainView.getView());
statusBar = new StatusBar(mainView.getView());
}
@ -152,9 +154,7 @@ public class TraditionalT9 extends MainViewOps {
setDarkTheme();
mainView.render();
if (settings.getCandidatesView()) {
setCandidatesViewShown(true);
} else if (!isInputViewShown()) {
if (!isInputViewShown()) {
updateInputViewShown();
}
}
@ -188,7 +188,6 @@ public class TraditionalT9 extends MainViewOps {
setStatusIcon(mInputMode);
setStatusText(mInputMode.toString());
setCandidatesViewShown(false);
if (isInputViewShown()) {
updateInputViewShown();
}
@ -210,21 +209,6 @@ public class TraditionalT9 extends MainViewOps {
}
/**
* createMainView
* Generates the actual UI of TT9.
*/
private View createMainView() {
mainView.forceCreateView();
initTray();
setDarkTheme();
setStatusText(mInputMode.toString());
suggestionOps.set(mInputMode.getSuggestions());
return mainView.getView();
}
/**
* Populates the UI elements with strings and icons
*/

View file

@ -39,7 +39,6 @@ public class AppearanceScreen extends BaseScreenFragment {
private void createHacksSection() {
ItemSwitch[] items = {
new ItemAlternativeSuggestionScrolling(findPreference(ItemAlternativeSuggestionScrolling.NAME), activity.getSettings()),
new ItemCandidatesView(findPreference(ItemCandidatesView.NAME), activity.getSettings()),
new ItemClearInsets(findPreference(ItemClearInsets.NAME), activity.getSettings())
};

View file

@ -1,32 +0,0 @@
package io.github.sspanak.tt9.preferences.screens.appearance;
import androidx.preference.SwitchPreferenceCompat;
import io.github.sspanak.tt9.R;
import io.github.sspanak.tt9.preferences.items.ItemSwitch;
import io.github.sspanak.tt9.preferences.settings.SettingsStore;
public class ItemCandidatesView extends ItemSwitch {
public static final String NAME = "pref_candidates_view";
private final SettingsStore settings;
public ItemCandidatesView(SwitchPreferenceCompat item, SettingsStore settings) {
super(item);
this.settings = settings;
}
@Override
protected boolean getDefaultValue() {
return settings.getCandidatesView();
}
@Override
public ItemSwitch populate() {
if (item != null) {
String appName = item.getContext().getString(R.string.app_name_short);
item.setSummary(item.getContext().getString(R.string.pref_hack_candidate_view_summary, appName));
}
return super.populate();
}
}

View file

@ -32,12 +32,8 @@ class SettingsHacks extends BaseSettings {
return prefs.getBoolean("pref_alternative_suggestion_scrolling", defaultOn) ? 200 : 0;
}
public boolean getCandidatesView() {
return prefs.getBoolean("pref_candidates_view", DeviceInfo.isSonimGen1(context));
}
public boolean clearInsets() {
return prefs.getBoolean("pref_clear_insets", DeviceInfo.isSonimGen1(context) || DeviceInfo.isSonimGen2(context));
return prefs.getBoolean("pref_clear_insets", DeviceInfo.isSonimGen2(context));
}
public boolean getFbMessengerHack() {

View file

@ -44,10 +44,6 @@ public class MainView {
}
}
public View getBlankView() {
return new MainLayoutStealth(tt9).getView();
}
public View getView() {
return main.getView();
}

View file

@ -44,8 +44,6 @@
<string name="pref_hack_fb_messenger">Изпращай с „ОК“ във Facebook Messenger</string>
<string name="pref_hack_always_on_top">Винаги видим</string>
<string name="pref_hack_always_on_top_summary">Не позволява на другите приложения да покриват %1$s или да го изместват извън екрана.</string>
<string name="pref_hack_candidate_view">Алтернативен метод за изобразяване</string>
<string name="pref_hack_candidate_view_summary">Включете, ако %1$s става невидим в някои приложения или изобщо не се активира. След промяната на тази опция е необходимо да рестартирате.</string>
<string name="pref_hack_google_chat">Изпращай съобщения с „ОК“ в Google Chat</string>
<string name="key_back">Назад</string>
<string name="key_call">Зелена слушалка</string>

View file

@ -96,8 +96,6 @@
<string name="pref_double_zero_char">Zeichen bei doppeltem Drücken der Taste „0“</string>
<string name="pref_hack_always_on_top">Immer im Vordergrund</string>
<string name="pref_hack_always_on_top_summary">Andere Anwendungen nicht erlauben, %1$s zu überdecken oder vom Bildschirm zu schieben.</string>
<string name="pref_hack_candidate_view">Alternative Anzeigemethode</string>
<string name="pref_hack_candidate_view_summary">Aktivieren Sie, wenn %1$s in einigen Apps unsichtbar wird oder überhaupt nicht aktiviert wird. Nach dem Ändern dieser Option ist ein Neustart erforderlich.</string>
<string name="pref_hack_google_chat">Nachrichten mit \"OK\" in Google Chat senden</string>
<string name="pref_hack_key_pad_debounce_time">Schutz vor versehentlichem Tastenwiederholen</string>
<string name="pref_hack_key_pad_debounce_off">Aus</string>

View file

@ -116,8 +116,6 @@
<string name="pref_hack_fb_messenger">Enviar con «OK» en Facebook Messenger</string>
<string name="pref_hack_always_on_top">Siempre encima</string>
<string name="pref_hack_always_on_top_summary">No permitir que otras aplicaciones cubran %1$s o lo empujen fuera de la pantalla.</string>
<string name="pref_hack_candidate_view">Método de visualización alternativo</string>
<string name="pref_hack_candidate_view_summary">Habilítelo si %1$s se vuelve invisible en algunas aplicaciones o no se activa en absoluto. Se requiere reiniciar después de cambiar esta opción.</string>
<string name="pref_hack_google_chat">Enviar mensajes con «OK» en Google Chat</string>
<string name="pref_hack_key_pad_debounce_time">Protección contra la repetición accidental de teclas</string>
<string name="pref_hack_key_pad_debounce_off">Apagado</string>

View file

@ -44,8 +44,6 @@
<string name="pref_hack_fb_messenger">Envoyer avec «OK» dans Facebook Messenger</string>
<string name="pref_hack_always_on_top">Toujours au premier plan</string>
<string name="pref_hack_always_on_top_summary">Ne pas permettre aux autres applications de couvrir %1$s ou de le pousser hors de l\'écran.</string>
<string name="pref_hack_candidate_view">Méthode d\'affichage alternative</string>
<string name="pref_hack_candidate_view_summary">Activez si %1$s devient invisible dans certaines applications ou ne s\'active pas du tout. Un redémarrage est nécessaire après la modification de cette option.</string>
<string name="pref_hack_google_chat">Envoyer des messages avec «OK» dans Google Chat</string>
<string name="dictionary_loading_indeterminate">Chargement du dictionnaire</string>
<string name="dictionary_load_cancelled">Chargement est annulé.</string>

View file

@ -98,8 +98,6 @@
<string name="pref_double_zero_char">Simbolo quando si preme due volte il tasto \"0\"</string>
<string name="pref_hack_always_on_top">Sempre in primo piano</string>
<string name="pref_hack_always_on_top_summary">Non consentire ad altre applicazioni di coprire %1$s o di spingerlo fuori dallo schermo.</string>
<string name="pref_hack_candidate_view">Metodo di visualizzazione alternativo</string>
<string name="pref_hack_candidate_view_summary">Abilita se %1$s diventa invisibile in alcune app o non si attiva affatto. È necessario riavviare dopo aver modificato questa opzione.</string>
<string name="pref_hack_google_chat">Inviare messaggi con \"OK\" su Google Chat</string>
<string name="pref_hack_key_pad_debounce_time">Protezione contro la ripetizione accidentale dei tasti</string>
<string name="pref_hack_key_pad_debounce_off">Spento</string>

View file

@ -113,8 +113,6 @@
<string name="pref_hack_fb_messenger">שלח עם \"OK\" ב-Facebook Messenger.</string>
<string name="pref_hack_always_on_top">נראה תמיד</string>
<string name="pref_hack_always_on_top_summary">אל תאפשר ליישומים אחרים לכסות %1$s או לדחות אותו מהמסך.</string>
<string name="pref_hack_candidate_view">שיטת תצוגה אלטרנטיבית</string>
<string name="pref_hack_candidate_view_summary">הפעל אם %1$s נהפך לבלתי נראה בכמה אפליקציות או אם לא מפעיל בכלל. נדרש איתחול לאחר שינוי האפשרות הזו.</string>
<string name="pref_hack_google_chat">שלח הודעות עם \"OK\" ב-Google Chat</string>
<string name="pref_hack_key_pad_debounce_time">הגנה מפני חזרת מפתח בשוגג</string>
<string name="pref_hack_key_pad_debounce_off">כבוי</string>

View file

@ -107,8 +107,6 @@
<string name="pref_category_delete_words">Trinti pridėtus žodžius</string>
<string name="pref_hack_always_on_top">Visada viršuje</string>
<string name="pref_hack_always_on_top_summary">Neleisti kitiems programoms uždengti %1$s arba atstumti jį nuo ekrano.</string>
<string name="pref_hack_candidate_view">Alternatyvus rodymo metodas</string>
<string name="pref_hack_candidate_view_summary">Įjungti, jei %1$s tampa nematomas kai kuriuose programose arba išvis neįsijungia. Po šios parinkties pakeitimo reikalingas iš naujo paleidimas.</string>
<string name="pref_hack_google_chat">Siųsti žinutes su „OK“ „Google Chat“ programoje</string>
<string name="pref_hack_key_pad_debounce_time">Apsauga nuo atsitiktinio rakto pasikartojimo</string>
<string name="pref_hack_key_pad_debounce_off">Išjungta</string>

View file

@ -94,8 +94,6 @@
<string name="pref_double_zero_char">Teken bij dubbelklikken op toets \"0\"</string>
<string name="pref_hack_always_on_top">Altijd bovenaan</string>
<string name="pref_hack_always_on_top_summary">Andere applicaties niet toestaan om %1$s te bedekken of van het scherm te duwen.</string>
<string name="pref_hack_candidate_view">Alternatieve weergavemethode</string>
<string name="pref_hack_candidate_view_summary">Inschakelen als %1$s onzichtbaar wordt in sommige apps of helemaal niet wordt geactiveerd. Een herstart is vereist na het wijzigen van deze optie.</string>
<string name="pref_hack_google_chat">Stuur berichten met \"OK\" in Google Chat</string>
<string name="pref_hack_key_pad_debounce_time">Bescherming tegen het per ongeluk herhalen van toetsen</string>
<string name="pref_hack_key_pad_debounce_off">Uit</string>

View file

@ -115,8 +115,6 @@
<string name="pref_hack_fb_messenger">Enviar com \"OK\" no Facebook Messenger</string>
<string name="pref_hack_always_on_top">Sempre na frente</string>
<string name="pref_hack_always_on_top_summary">Não permitir que outras aplicações cubram %1$s ou o empurrem para fora do ecrã.</string>
<string name="pref_hack_candidate_view">Método de exibição alternativo</string>
<string name="pref_hack_candidate_view_summary">Ative se o %1$s se tornar invisível em alguns aplicativos ou não ativar de forma alguma. É necessário reiniciar após alterar esta opção.</string>
<string name="pref_hack_google_chat">Enviar mensagens com \"OK\" no Google Chat</string>
<string name="pref_hack_key_pad_debounce_time">Proteção contra repetição acidental de teclas</string>
<string name="pref_hack_key_pad_debounce_off">Desligado</string>

View file

@ -116,8 +116,6 @@
<string name="donate_summary">Если вам нравится %1$s, вы можете поддержать его разработку по: %2$s.</string>
<string name="pref_hack_always_on_top">Поверх других приложений</string>
<string name="pref_hack_always_on_top_summary">Не разрешать другим приложениям перекрывать %1$s или выталкивать его с экрана.</string>
<string name="pref_hack_candidate_view">Альтернативный метод отображения</string>
<string name="pref_hack_candidate_view_summary">Включите, если %1$s становится невидимым в некоторых приложениях или вообще не активируется. Перезагрузка требуется после изменения этой опции.</string>
<string name="pref_hack_google_chat">Отправка сообщения с «ОК» в Google Chat</string>
<string name="pref_hack_key_pad_debounce_time">Защита от случайного повторения нажатий</string>
<string name="pref_hack_key_pad_debounce_off">Выключена</string>

View file

@ -51,8 +51,6 @@
<string name="pref_double_zero_char">Символ при подвійному натискання клавіші 0</string>
<string name="pref_hack_always_on_top">Поверх інших програм</string>
<string name="pref_hack_always_on_top_summary">Не дозволяти іншим програмам перекривати %1$s або змушувати його зникати з екрану.</string>
<string name="pref_hack_candidate_view">Альтернативний метод відображення</string>
<string name="pref_hack_candidate_view_summary">Увімкніть, якщо %1$s стає невидимим у деяких додатках або взагалі не активується. Перезавантаження потрібно після зміни цієї опції.</string>
<string name="pref_hack_google_chat">Відправляти повідомлення по натиску \"OK\" в Google Chat</string>
<string name="pref_hack_fb_messenger">Відправляти повідомлення по натиску \"OK\" в Messenger</string>
<string name="pref_hack_key_pad_debounce_time">Захист від випадкового повторення натискань</string>

View file

@ -56,8 +56,6 @@
<string name="pref_double_zero_char">Character for Double 0-key Press</string>
<string name="pref_hack_always_on_top">Always on Top</string>
<string name="pref_hack_always_on_top_summary">Prevent other apps from covering %1$s or pushing it off the screen.</string>
<string name="pref_hack_candidate_view">Alternative Display Method</string>
<string name="pref_hack_candidate_view_summary">Enable if %1$s becomes invisible in some apps or does not activate at all. Changing this setting requires a reboot.</string>
<string name="pref_hack_google_chat">Send messages with \"OK\" in Google Chat</string>
<string name="pref_hack_fb_messenger">Send with \"OK\" in Facebook Messenger</string>
<string name="pref_hack_key_pad_debounce_time">Accidental Key Repeat Protection</string>

View file

@ -26,10 +26,6 @@
app:title="@string/pref_alternative_suggestion_scrolling"
app:summary="@string/pref_alternative_suggestion_scrolling_summary"/>
<SwitchPreferenceCompat
app:key="pref_candidates_view"
app:title="@string/pref_hack_candidate_view" />
<SwitchPreferenceCompat
app:key="pref_clear_insets"
app:title="@string/pref_hack_always_on_top" />