Fix settings import
This commit is contained in:
parent
912c88cc43
commit
8aa6fb1eb2
1 changed files with 14 additions and 2 deletions
|
@ -140,14 +140,20 @@ public class SettingsHelper {
|
||||||
boolean shouldReplace = false;
|
boolean shouldReplace = false;
|
||||||
|
|
||||||
SettingsItem(@NonNull SettingsItemType type) {
|
SettingsItem(@NonNull SettingsItemType type) {
|
||||||
|
init();
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsItem(@NonNull SettingsItemType type, @NonNull JSONObject json) throws JSONException {
|
SettingsItem(@NonNull SettingsItemType type, @NonNull JSONObject json) throws JSONException {
|
||||||
|
init();
|
||||||
this.type = type;
|
this.type = type;
|
||||||
readFromJson(json);
|
readFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void init() {
|
||||||
|
// override
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public SettingsItemType getType() {
|
public SettingsItemType getType() {
|
||||||
return type;
|
return type;
|
||||||
|
@ -349,10 +355,16 @@ public class SettingsHelper {
|
||||||
|
|
||||||
public abstract static class CollectionSettingsItem<T> extends SettingsItem {
|
public abstract static class CollectionSettingsItem<T> extends SettingsItem {
|
||||||
|
|
||||||
protected List<T> items = new ArrayList<>();
|
protected List<T> items;
|
||||||
protected List<T> duplicateItems = new ArrayList<>();
|
protected List<T> duplicateItems;
|
||||||
protected List<T> existingItems;
|
protected List<T> existingItems;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void init() {
|
||||||
|
items = new ArrayList<>();
|
||||||
|
duplicateItems = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
CollectionSettingsItem(@NonNull SettingsItemType type, @NonNull List<T> items) {
|
CollectionSettingsItem(@NonNull SettingsItemType type, @NonNull List<T> items) {
|
||||||
super(type);
|
super(type);
|
||||||
this.items = items;
|
this.items = items;
|
||||||
|
|
Loading…
Reference in a new issue