all settings are enabled for robots
This commit is contained in:
parent
76c8ab31da
commit
7f2d54bb70
4 changed files with 23 additions and 5 deletions
|
|
@ -32,6 +32,7 @@ public class LogcatExporter extends AbstractExporter {
|
|||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
public static String getLogs(boolean includeSystemLogs) {
|
||||
StringBuilder log = new StringBuilder();
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,13 @@ import android.view.KeyEvent;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import io.github.sspanak.tt9.db.exporter.LogcatExporter;
|
||||
|
||||
public class DeviceInfo {
|
||||
private static Boolean isRobo = null;
|
||||
|
||||
public static boolean noKeyboard(Context context) {
|
||||
return
|
||||
context.getResources().getConfiguration().keyboard == Configuration.KEYBOARD_NOKEYS
|
||||
|
|
@ -29,6 +35,15 @@ public class DeviceInfo {
|
|||
return Build.MANUFACTURER.equals("DuoQin") && Build.MODEL.contains("F21");
|
||||
}
|
||||
|
||||
public static boolean isRobo() {
|
||||
if (isRobo == null) {
|
||||
Pattern roboLog = Pattern.compile("\\d+\\s+\\d+\\s+\\|\\s+Robo\\W");
|
||||
isRobo = roboLog.matcher(LogcatExporter.getLogs(false)).find();
|
||||
}
|
||||
|
||||
return isRobo;
|
||||
}
|
||||
|
||||
public static boolean isSonim() {
|
||||
return Build.MANUFACTURER.equals("Sonimtech");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import java.util.regex.Pattern;
|
|||
|
||||
import io.github.sspanak.tt9.BuildConfig;
|
||||
import io.github.sspanak.tt9.R;
|
||||
import io.github.sspanak.tt9.hacks.DeviceInfo;
|
||||
import io.github.sspanak.tt9.preferences.PreferencesActivity;
|
||||
import io.github.sspanak.tt9.util.Logger;
|
||||
import io.github.sspanak.tt9.util.SystemSettings;
|
||||
|
|
@ -100,7 +101,7 @@ public class MainSettingsScreen extends BaseScreenFragment {
|
|||
|
||||
for (Preference goToScreen : screens) {
|
||||
if (goToScreen != null) {
|
||||
goToScreen.setEnabled(isTT9On);
|
||||
goToScreen.setEnabled(isTT9On || DeviceInfo.isRobo());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package io.github.sspanak.tt9.preferences.screens.setup;
|
|||
import androidx.preference.Preference;
|
||||
|
||||
import io.github.sspanak.tt9.R;
|
||||
import io.github.sspanak.tt9.hacks.DeviceInfo;
|
||||
import io.github.sspanak.tt9.preferences.PreferencesActivity;
|
||||
import io.github.sspanak.tt9.preferences.screens.BaseScreenFragment;
|
||||
import io.github.sspanak.tt9.util.SystemSettings;
|
||||
|
|
@ -20,7 +21,7 @@ public class SetupScreen extends BaseScreenFragment {
|
|||
public void onCreate() {
|
||||
boolean isTT9On = SystemSettings.isTT9Enabled(activity);
|
||||
createKeyboardSection(isTT9On);
|
||||
createHacksSection(isTT9On);
|
||||
createHacksSection(isTT9On | DeviceInfo.isRobo());
|
||||
resetFontSize(false);
|
||||
}
|
||||
|
||||
|
|
@ -47,15 +48,15 @@ public class SetupScreen extends BaseScreenFragment {
|
|||
}
|
||||
}
|
||||
|
||||
private void createHacksSection(boolean isTT9On) {
|
||||
private void createHacksSection(boolean isEnabled) {
|
||||
Preference hackGoogleChat = findPreference("pref_hack_google_chat");
|
||||
if (hackGoogleChat != null) {
|
||||
hackGoogleChat.setEnabled(isTT9On);
|
||||
hackGoogleChat.setEnabled(isEnabled);
|
||||
}
|
||||
|
||||
Preference hackFBMessenger = findPreference("pref_hack_fb_messenger");
|
||||
if (hackFBMessenger != null) {
|
||||
hackFBMessenger.setEnabled(isTT9On);
|
||||
hackFBMessenger.setEnabled(isEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue