1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2025-01-02 13:24:09 +00:00

Fix, refactoring

This commit is contained in:
M66B 2015-12-14 16:09:18 +01:00
parent 533c1428ef
commit e1bb6536df
2 changed files with 9 additions and 9 deletions

View file

@ -102,14 +102,6 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
PreferenceScreen screen = getPreferenceScreen(); PreferenceScreen screen = getPreferenceScreen();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
// Stats
EditTextPreference pref_stats_base = (EditTextPreference) screen.findPreference("stats_base");
EditTextPreference pref_stats_frequency = (EditTextPreference) screen.findPreference("stats_frequency");
EditTextPreference pref_stats_samples = (EditTextPreference) screen.findPreference("stats_samples");
pref_stats_base.setTitle(getString(R.string.setting_stats_base, prefs.getString("stats_base", "5")));
pref_stats_frequency.setTitle(getString(R.string.setting_stats_frequency, prefs.getString("stats_frequency", "1000")));
pref_stats_samples.setTitle(getString(R.string.setting_stats_samples, prefs.getString("stats_samples", "90")));
// Wi-Fi home // Wi-Fi home
MultiSelectListPreference pref_wifi_homes = (MultiSelectListPreference) screen.findPreference("wifi_homes"); MultiSelectListPreference pref_wifi_homes = (MultiSelectListPreference) screen.findPreference("wifi_homes");
Set<String> ssid = prefs.getStringSet("wifi_homes", new HashSet<String>()); Set<String> ssid = prefs.getStringSet("wifi_homes", new HashSet<String>());
@ -131,6 +123,14 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
Preference pref_auto_enable = screen.findPreference("auto_enable"); Preference pref_auto_enable = screen.findPreference("auto_enable");
pref_auto_enable.setTitle(getString(R.string.setting_auto, prefs.getString("auto_enable", "0"))); pref_auto_enable.setTitle(getString(R.string.setting_auto, prefs.getString("auto_enable", "0")));
// Handle stats
EditTextPreference pref_stats_base = (EditTextPreference) screen.findPreference("stats_base");
EditTextPreference pref_stats_frequency = (EditTextPreference) screen.findPreference("stats_frequency");
EditTextPreference pref_stats_samples = (EditTextPreference) screen.findPreference("stats_samples");
pref_stats_base.setTitle(getString(R.string.setting_stats_base, prefs.getString("stats_base", "5")));
pref_stats_frequency.setTitle(getString(R.string.setting_stats_frequency, prefs.getString("stats_frequency", "1000")));
pref_stats_samples.setTitle(getString(R.string.setting_stats_samples, prefs.getString("stats_samples", "90")));
// Handle export // Handle export
Preference pref_export = screen.findPreference("export"); Preference pref_export = screen.findPreference("export");
pref_export.setEnabled(getIntentCreateDocument().resolveActivity(getPackageManager()) != null); pref_export.setEnabled(getIntentCreateDocument().resolveActivity(getPackageManager()) != null);

View file

@ -72,7 +72,7 @@
android:title="@string/setting_national_roaming" /> android:title="@string/setting_national_roaming" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory <PreferenceCategory
android:key="category_options" android:key="category_stats"
android:title="@string/setting_stats_category"> android:title="@string/setting_stats_category">
<SwitchPreference <SwitchPreference
android:defaultValue="false" android:defaultValue="false"