enabled the status icon by default on Qin F21
This commit is contained in:
parent
4f7d908b74
commit
4d69eb750d
5 changed files with 37 additions and 2 deletions
|
|
@ -24,5 +24,7 @@ public class AppearanceScreen extends BaseScreenFragment {
|
||||||
.populate()
|
.populate()
|
||||||
.enableClickHandler()
|
.enableClickHandler()
|
||||||
.preview();
|
.preview();
|
||||||
|
|
||||||
|
(new ItemStatusIcon(findPreference(ItemStatusIcon.NAME), activity.getSettings())).populate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
package io.github.sspanak.tt9.preferences.screens.appearance;
|
||||||
|
|
||||||
|
import androidx.preference.SwitchPreferenceCompat;
|
||||||
|
|
||||||
|
import io.github.sspanak.tt9.preferences.settings.SettingsStore;
|
||||||
|
|
||||||
|
public class ItemStatusIcon {
|
||||||
|
public static final String NAME = "pref_status_icon";
|
||||||
|
|
||||||
|
private SwitchPreferenceCompat item;
|
||||||
|
private SettingsStore settings;
|
||||||
|
|
||||||
|
public ItemStatusIcon(SwitchPreferenceCompat item, SettingsStore settings) {
|
||||||
|
this.item = item;
|
||||||
|
this.settings = settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void populate() {
|
||||||
|
if (item != null) {
|
||||||
|
item.setChecked(settings.isStatusIconEnabled());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -5,6 +5,8 @@ import android.content.res.Configuration;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatDelegate;
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
|
|
||||||
|
import io.github.sspanak.tt9.util.DeviceInfo;
|
||||||
|
|
||||||
public class SettingsUI extends SettingsTyping {
|
public class SettingsUI extends SettingsTyping {
|
||||||
public final static int LAYOUT_STEALTH = 0;
|
public final static int LAYOUT_STEALTH = 0;
|
||||||
public final static int LAYOUT_TRAY = 1;
|
public final static int LAYOUT_TRAY = 1;
|
||||||
|
|
@ -13,7 +15,9 @@ public class SettingsUI extends SettingsTyping {
|
||||||
|
|
||||||
SettingsUI(Context context) { super(context); }
|
SettingsUI(Context context) { super(context); }
|
||||||
|
|
||||||
public boolean isStatusIconEnabled() { return prefs.getBoolean("pref_status_icon", false); }
|
public boolean isStatusIconEnabled() {
|
||||||
|
return prefs.getBoolean("pref_status_icon", DeviceInfo.isQinF21());
|
||||||
|
}
|
||||||
|
|
||||||
public boolean getDarkTheme() {
|
public boolean getDarkTheme() {
|
||||||
int theme = getTheme();
|
int theme = getTheme();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
package io.github.sspanak.tt9.util;
|
||||||
|
|
||||||
|
public class DeviceInfo {
|
||||||
|
public static boolean isQinF21() {
|
||||||
|
return android.os.Build.MANUFACTURER.equals("DuoQin") && android.os.Build.MODEL.contains("F21");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
|
|
||||||
|
|
||||||
<SwitchPreferenceCompat
|
<SwitchPreferenceCompat
|
||||||
app:defaultValue="false"
|
|
||||||
app:key="pref_status_icon"
|
app:key="pref_status_icon"
|
||||||
app:layout="@layout/pref_switch"
|
app:layout="@layout/pref_switch"
|
||||||
app:title="@string/pref_status_icon"
|
app:title="@string/pref_status_icon"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue