mirror of https://github.com/M66B/NetGuard.git
Refresh UI after import
This commit is contained in:
parent
46a03df01f
commit
e3b2d8bd48
|
@ -352,7 +352,8 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
||||||
} else if ("whitelist_wifi".equals(name) ||
|
} else if ("whitelist_wifi".equals(name) ||
|
||||||
"whitelist_other".equals(name) ||
|
"whitelist_other".equals(name) ||
|
||||||
"whitelist_roaming".equals(name) ||
|
"whitelist_roaming".equals(name) ||
|
||||||
"manage_system".equals(name))
|
"manage_system".equals(name) ||
|
||||||
|
"imported".equals(name))
|
||||||
updateApplicationList();
|
updateApplicationList();
|
||||||
|
|
||||||
else if ("dark_theme".equals(name))
|
else if ("dark_theme".equals(name))
|
||||||
|
|
|
@ -253,12 +253,17 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
|
||||||
Map<String, ?> settings = prefs.getAll();
|
Map<String, ?> settings = prefs.getAll();
|
||||||
for (String key : settings.keySet()) {
|
for (String key : settings.keySet()) {
|
||||||
Object value = settings.get(key);
|
Object value = settings.get(key);
|
||||||
|
|
||||||
|
if ("imported".equals(key))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (value instanceof Boolean) {
|
if (value instanceof Boolean) {
|
||||||
serializer.startTag(null, "setting");
|
serializer.startTag(null, "setting");
|
||||||
serializer.attribute(null, "key", key);
|
serializer.attribute(null, "key", key);
|
||||||
serializer.attribute(null, "type", "boolean");
|
serializer.attribute(null, "type", "boolean");
|
||||||
serializer.attribute(null, "value", value.toString());
|
serializer.attribute(null, "value", value.toString());
|
||||||
serializer.endTag(null, "setting");
|
serializer.endTag(null, "setting");
|
||||||
|
|
||||||
} else
|
} else
|
||||||
Log.e(TAG, "Unknown key=" + key);
|
Log.e(TAG, "Unknown key=" + key);
|
||||||
}
|
}
|
||||||
|
@ -279,6 +284,9 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
|
||||||
xmlImport(handler.mobile, getSharedPreferences("other", Context.MODE_PRIVATE));
|
xmlImport(handler.mobile, getSharedPreferences("other", Context.MODE_PRIVATE));
|
||||||
xmlImport(handler.unused, getSharedPreferences("unused", Context.MODE_PRIVATE));
|
xmlImport(handler.unused, getSharedPreferences("unused", Context.MODE_PRIVATE));
|
||||||
xmlImport(handler.roaming, getSharedPreferences("roaming", Context.MODE_PRIVATE));
|
xmlImport(handler.roaming, getSharedPreferences("roaming", Context.MODE_PRIVATE));
|
||||||
|
|
||||||
|
// Refresh UI
|
||||||
|
prefs.edit().putBoolean("imported", true).apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void xmlImport(Map<String, Object> settings, SharedPreferences prefs) {
|
private void xmlImport(Map<String, Object> settings, SharedPreferences prefs) {
|
||||||
|
|
Loading…
Reference in New Issue