private final AtomicInteger busyCounter = new AtomicInteger(0);
private final MutableLiveData<Boolean> busyFlag = new InertMutableLiveData<>(false);
private final Observer<Profile> profileObserver = profile -> {
- showCurrency.postValue(profile.getShowCommodityByDefault());
- showComments.postValue(profile.getShowCommentsByDefault());
+ if (profile != null) {
+ showCurrency.postValue(profile.getShowCommodityByDefault());
+ showComments.postValue(profile.getShowCommentsByDefault());
+ }
};
private final MutableLiveData<FocusInfo> focusInfo = new MutableLiveData<>();
private boolean observingDataProfile;
public NewTransactionModel() {
- reset();
}
public LiveData<Boolean> getShowCurrency() {
return showCurrency;
noteFocusChanged(fi.position - 1, fi.element);
setItems(newList);
}
- void noteFocusChanged(int position, FocusedElement element) {
+ void noteFocusChanged(int position, @Nullable FocusedElement element) {
FocusInfo present = focusInfo.getValue();
if (present == null || present.position != position || present.element != element)
focusInfo.setValue(new FocusInfo(position, element));
public static class FocusInfo {
int position;
FocusedElement element;
- public FocusInfo(int position, FocusedElement element) {
+ public FocusInfo(int position, @Nullable FocusedElement element) {
this.position = position;
this.element = element;
}