Clean up default preferences setter
This commit is contained in:
parent
c553312fd5
commit
a1335aecfb
@ -29,9 +29,8 @@ public class SettingsFragment extends PreferenceFragment implements SharedPrefer
|
|||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
// Load the preferences from an XML resource
|
|
||||||
addPreferencesFromResource(R.xml.uisettings);
|
addPreferencesFromResource(R.xml.uisettings);
|
||||||
|
PreferenceManager.setDefaultValues(getActivity(), R.xml.uisettings, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -21,27 +21,28 @@ public class SplashActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
||||||
SharedPreferences defaultPrefs = PreferenceManager.getDefaultSharedPreferences(getApplication());
|
|
||||||
|
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
SharedPreferences defaultPrefs = PreferenceManager.getDefaultSharedPreferences(getApplication());
|
||||||
if (defaultPrefs.getString("theme","").equals("Dark")) {
|
if (defaultPrefs.getString("theme","").equals("Dark")) {
|
||||||
setTheme(R.style.AppTheme_dh);
|
setTheme(R.style.AppTheme_dh);
|
||||||
}
|
}
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
|
|
||||||
//setups go here
|
//setups go here
|
||||||
|
|
||||||
// Set up default preferences,make sure we add "extra" blacklist entries.
|
// Set up default preferences,make sure we add "extra" blacklist entries.
|
||||||
PreferenceManager.setDefaultValues(this, R.xml.defaultpref, false);
|
|
||||||
|
|
||||||
|
|
||||||
if (!defaultPrefs.contains("auto_blacklist")) {
|
if (!defaultPrefs.contains("auto_blacklist")) {
|
||||||
Logger.dh("AutoRootFragment: Setting default preferences for application");
|
Logger.dh("SplashActivity: Setting default preferences for application");
|
||||||
SharedPreferences.Editor editor = defaultPrefs.edit();
|
SharedPreferences.Editor editor = defaultPrefs.edit();
|
||||||
Set<String> set = new HashSet<>();
|
Set<String> set = new HashSet<>();
|
||||||
set.add("com.google.android.apps.walletnfcrel");
|
set.add("com.google.android.apps.walletnfcrel");
|
||||||
set.add("com.google.android.gms");
|
set.add("com.google.android.gms");
|
||||||
set.add("com.google.commerce.tapandpay");
|
set.add("com.google.commerce.tapandpay");
|
||||||
editor.putStringSet("auto_blacklist", set);
|
editor.putStringSet("auto_blacklist", set);
|
||||||
|
editor.putBoolean("autoRootEnable",false);
|
||||||
|
editor.putBoolean("root",Utils.rootEnabled());
|
||||||
editor.apply();
|
editor.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<Preference
|
|
||||||
android:key="theme"
|
|
||||||
android:defaultValue="Default"
|
|
||||||
/>
|
|
||||||
<Preference
|
|
||||||
android:key="auto_blacklist"
|
|
||||||
android:defaultValue="com.google.android.apps.walletnfcrel"
|
|
||||||
/>
|
|
||||||
<Preference
|
|
||||||
android:key="auto_whitelist"
|
|
||||||
android:defaultValue="com.keramidas.TitaniumBackupPro"
|
|
||||||
/>
|
|
||||||
</PreferenceScreen>
|
|
@ -8,6 +8,7 @@
|
|||||||
android:key="theme"
|
android:key="theme"
|
||||||
android:title="Theme"
|
android:title="Theme"
|
||||||
android:summary="Select a theme"
|
android:summary="Select a theme"
|
||||||
|
android:defaultValue="Default"
|
||||||
android:entries="@array/themes"
|
android:entries="@array/themes"
|
||||||
android:entryValues="@array/themes"/>
|
android:entryValues="@array/themes"/>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
@ -16,6 +17,7 @@
|
|||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="enable_quicktile"
|
android:key="enable_quicktile"
|
||||||
|
android:defaultValue="false"
|
||||||
android:title="@string/settings_enable_quicktile_title"
|
android:title="@string/settings_enable_quicktile_title"
|
||||||
android:summary="@string/settings_enable_quicktile_summary" />
|
android:summary="@string/settings_enable_quicktile_summary" />
|
||||||
|
|
||||||
@ -24,6 +26,7 @@
|
|||||||
android:title="@string/settings_root_category">
|
android:title="@string/settings_root_category">
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="keep_root_off"
|
android:key="keep_root_off"
|
||||||
|
android:defaultValue="false"
|
||||||
android:title="@string/settings_keep_root_off_title"
|
android:title="@string/settings_keep_root_off_title"
|
||||||
android:summary="@string/settings_keep_root_off_summary" />
|
android:summary="@string/settings_keep_root_off_summary" />
|
||||||
|
|
||||||
@ -39,6 +42,7 @@
|
|||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="developer_logging"
|
android:key="developer_logging"
|
||||||
|
android:defaultValue="false"
|
||||||
android:title="@string/settings_developer_logging_title"
|
android:title="@string/settings_developer_logging_title"
|
||||||
android:summary="@string/settings_developer_logging_summary" />
|
android:summary="@string/settings_developer_logging_summary" />
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user