new MutableLiveData<>(Collections.emptyList());
private Long mPatternId;
private String mDefaultPatternName;
+ private boolean itemsLoaded = false;
public String getDefaultPatternName() {
return mDefaultPatternName;
items.setValue(newList);
}
public LiveData<List<TemplateDetailsItem>> getItems(Long patternId) {
+ if (itemsLoaded && Objects.equals(patternId, this.mPatternId))
+ return items;
+
if (patternId != null && patternId <= 0)
throw new IllegalArgumentException("Pattern ID " + patternId + " is invalid");
if (mPatternId == null) {
resetItems();
+ itemsLoaded = true;
return items;
}
Logger.debug("patterns-db", "Loaded pattern item " + i);
}
items.postValue(l);
+ itemsLoaded = true;
dbList.removeObserver(this);
}