alternative suggestion scrolling is now enabled by default on older non-touchscreen phones
This commit is contained in:
parent
f017927d43
commit
31ca39bfb0
5 changed files with 43 additions and 6 deletions
|
|
@ -0,0 +1,31 @@
|
|||
package io.github.sspanak.tt9.preferences.screens.setup;
|
||||
|
||||
import androidx.preference.SwitchPreferenceCompat;
|
||||
|
||||
import io.github.sspanak.tt9.preferences.settings.SettingsStore;
|
||||
|
||||
public class ItemAlternativeSuggestionScrolling {
|
||||
public static final String NAME = "pref_alternative_suggestion_scrolling";
|
||||
|
||||
private final SwitchPreferenceCompat item;
|
||||
private final SettingsStore settings;
|
||||
|
||||
public ItemAlternativeSuggestionScrolling(SwitchPreferenceCompat item, SettingsStore settings) {
|
||||
this.item = item;
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
public ItemAlternativeSuggestionScrolling populate() {
|
||||
if (item != null) {
|
||||
item.setChecked(settings.getSuggestionScrollingDelay() > 0);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean yes) {
|
||||
if (item != null) {
|
||||
item.setEnabled(yes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -47,10 +47,9 @@ public class SetupScreen extends BaseScreenFragment {
|
|||
}
|
||||
|
||||
private void createHacksSection(boolean isTT9On) {
|
||||
Preference altScrolling = findPreference("pref_alternative_suggestion_scrolling");
|
||||
if (altScrolling != null) {
|
||||
altScrolling.setEnabled(isTT9On);
|
||||
}
|
||||
(new ItemAlternativeSuggestionScrolling(findPreference(ItemAlternativeSuggestionScrolling.NAME), activity.getSettings()))
|
||||
.populate()
|
||||
.setEnabled(isTT9On);
|
||||
|
||||
Preference hackGoogleChat = findPreference("pref_hack_google_chat");
|
||||
if (hackGoogleChat != null) {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
package io.github.sspanak.tt9.preferences.settings;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
|
||||
import io.github.sspanak.tt9.preferences.screens.debug.ItemInputHandlingMode;
|
||||
import io.github.sspanak.tt9.util.DeviceInfo;
|
||||
import io.github.sspanak.tt9.util.Logger;
|
||||
|
||||
class SettingsHacks extends BaseSettings {
|
||||
|
|
@ -26,7 +28,8 @@ class SettingsHacks extends BaseSettings {
|
|||
/************* hack settings *************/
|
||||
|
||||
public int getSuggestionScrollingDelay() {
|
||||
return prefs.getBoolean("pref_alternative_suggestion_scrolling", false) ? 200 : 0;
|
||||
boolean defaultOn = DeviceInfo.noTouchScreen(context) && Build.VERSION.SDK_INT < Build.VERSION_CODES.Q;
|
||||
return prefs.getBoolean("pref_alternative_suggestion_scrolling", defaultOn) ? 200 : 0;
|
||||
}
|
||||
|
||||
public boolean getFbMessengerHack() {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,15 @@
|
|||
package io.github.sspanak.tt9.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public class DeviceInfo {
|
||||
public static boolean noTouchScreen(Context context) {
|
||||
return !context.getPackageManager().hasSystemFeature("android.hardware.touchscreen");
|
||||
}
|
||||
|
||||
public static boolean isQinF21() {
|
||||
return Build.MANUFACTURER.equals("DuoQin") && Build.MODEL.contains("F21");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
app:singleLineTitle="true">
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
app:defaultValue="false"
|
||||
app:key="pref_alternative_suggestion_scrolling"
|
||||
app:layout="@layout/pref_switch"
|
||||
app:title="@string/pref_alternative_suggestion_scrolling"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue