when items get unique id every time, resetting the model causes new
IDs to be assigned, making the adapter consider old items gone and new
items added. this sounds OK, but the visual effect is that everything
disappears and then reappears, causing flicker.
void reset() {
Logger.debug("new-trans", "Resetting model");
List<Item> list = new ArrayList<>();
void reset() {
Logger.debug("new-trans", "Resetting model");
List<Item> list = new ArrayList<>();
+ Item.resetIdDispenser();
list.add(new TransactionHead(""));
list.add(new TransactionAccount(""));
list.add(new TransactionAccount(""));
list.add(new TransactionHead(""));
list.add(new TransactionAccount(""));
list.add(new TransactionAccount(""));
}
void loadTransactionIntoModel(String profileUUID, int transactionId) {
List<Item> newList = new ArrayList<>();
}
void loadTransactionIntoModel(String profileUUID, int transactionId) {
List<Item> newList = new ArrayList<>();
+ Item.resetIdDispenser();
LedgerTransaction tr;
MobileLedgerProfile profile = Data.getProfile(profileUUID);
if (profile == null)
LedgerTransaction tr;
MobileLedgerProfile profile = Data.getProfile(profileUUID);
if (profile == null)
return new TransactionAccount((TransactionAccount) origin);
throw new RuntimeException("Don't know how to handle " + origin);
}
return new TransactionAccount((TransactionAccount) origin);
throw new RuntimeException("Don't know how to handle " + origin);
}
+ private static void resetIdDispenser() {
+ idDispenser = 0;
+ }
public int getId() {
return id;
}
public int getId() {
return id;
}