Refresh UI after import

This commit is contained in:
M66B 2015-11-08 13:05:55 +01:00
parent 46a03df01f
commit e3b2d8bd48
2 changed files with 10 additions and 1 deletions

View File

@ -352,7 +352,8 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
} else if ("whitelist_wifi".equals(name) ||
"whitelist_other".equals(name) ||
"whitelist_roaming".equals(name) ||
"manage_system".equals(name))
"manage_system".equals(name) ||
"imported".equals(name))
updateApplicationList();
else if ("dark_theme".equals(name))

View File

@ -253,12 +253,17 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
Map<String, ?> settings = prefs.getAll();
for (String key : settings.keySet()) {
Object value = settings.get(key);
if ("imported".equals(key))
continue;
if (value instanceof Boolean) {
serializer.startTag(null, "setting");
serializer.attribute(null, "key", key);
serializer.attribute(null, "type", "boolean");
serializer.attribute(null, "value", value.toString());
serializer.endTag(null, "setting");
} else
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.unused, getSharedPreferences("unused", 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) {