when the data in the model is changed (e.g. in a reset operation) the
new data needs to be sent to the UI without this causing data sync back
to the model
dateObserver = date -> {
if (syncingData) return;
- tvDate.setText(item.getFormattedDate());
+ syncingData = true;
+ try {
+ tvDate.setText(item.getFormattedDate());
+ }
+ finally {
+ syncingData = false;
+ }
};
descriptionObserver = description -> {
if (syncingData) return;
- tvDescription.setText(description);
+ syncingData = true;
+ try {
+ tvDescription.setText(description);
+ }
+ finally {
+ syncingData = false;
+ }
};
hintObserver = hint -> {
if (syncingData) return;
- tvAmount.setHint(hint);
+ syncingData = true;
+ try {
+ tvAmount.setHint(hint);
+ }
+ finally {
+ syncingData = false;
+ }
};
focusedAccountObserver = index -> {
if ((index != null) && index.equals(getAdapterPosition())) {