Fixed removing settings

Fixes #187
This commit is contained in:
M66B 2015-12-01 20:19:26 +01:00
parent f9b178bdee
commit 5f08cd557d
2 changed files with 22 additions and 9 deletions

View File

@ -34,6 +34,7 @@ import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceCategory;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
import android.preference.SwitchPreference;
@ -173,10 +174,14 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
updateTechnicalInfo();
if (!Util.hasTelephony(this)) {
screen.removePreference(screen.findPreference("whitelist_other"));
screen.removePreference(screen.findPreference("screen_other"));
screen.removePreference(screen.findPreference("whitelist_roaming"));
screen.removePreference(screen.findPreference("use_metered"));
PreferenceCategory defaults = (PreferenceCategory)screen.findPreference("defaults");
defaults.removePreference(screen.findPreference("whitelist_other"));
defaults.removePreference(screen.findPreference("screen_other"));
defaults.removePreference(screen.findPreference("whitelist_roaming"));
PreferenceCategory options = (PreferenceCategory)screen.findPreference("options");
options.removePreference(screen.findPreference("use_metered"));
options.removePreference(screen.findPreference("national_roaming"));
}
}
@ -277,7 +282,7 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
pref_technical.setSummary(sb.toString());
}
public static String getNetworkGeneration(int networkType) {
private static String getNetworkGeneration(int networkType) {
switch (networkType) {
case TelephonyManager.NETWORK_TYPE_1xRTT:
case TelephonyManager.NETWORK_TYPE_CDMA:

View File

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="@string/setting_defaults">
<PreferenceCategory
android:key="defaults"
android:title="@string/setting_defaults">
<SwitchPreference
android:defaultValue="true"
android:key="whitelist_wifi"
@ -22,7 +24,9 @@
android:key="whitelist_roaming"
android:title="@string/setting_whitelist_roaming" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/setting_options">
<PreferenceCategory
android:key="options"
android:title="@string/setting_options">
<SwitchPreference
android:defaultValue="false"
android:key="manage_system"
@ -43,7 +47,9 @@
android:summary="@string/summary_national_roaming"
android:title="@string/setting_national_roaming" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/setting_backup">
<PreferenceCategory
android:key="backup"
android:title="@string/setting_backup">
<Preference
android:key="export"
android:title="@string/setting_export" />
@ -51,7 +57,9 @@
android:key="import"
android:title="@string/setting_import" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/setting_technical">
<PreferenceCategory
android:key="technical"
android:title="@string/setting_technical">
<Preference android:key="technical" />
</PreferenceCategory>
</PreferenceScreen>