+ loadTransactionIntoModel(profileUUID, transactionId);
+ }
+ }
+ private void loadTransactionIntoModel(String profileUUID, int transactionId) {
+ LedgerTransaction tr;
+ MobileLedgerProfile profile = Data.getProfile(profileUUID);
+ if (profile == null)
+ throw new RuntimeException(String.format(
+ "Unable to find profile %s, which is supposed to contain transaction %d",
+ profileUUID, transactionId));
+
+ tr = profile.loadTransaction(transactionId);
+ ArrayList<LedgerTransactionAccount> accounts = tr.getAccounts();
+ NewTransactionModel.Item firstNegative = null;
+ NewTransactionModel.Item firstPositive = null;
+ int singleNegativeIndex = -1;
+ int singlePositiveIndex = -1;
+ int negativeCount = 0;
+ for (int i = 0; i < accounts.size(); i++) {
+ LedgerTransactionAccount acc = accounts.get(i);
+ NewTransactionModel.Item item;
+ if (model.getAccountCount() < i + 1) {
+ model.addAccount(acc);
+ notifyItemInserted(i + 1);
+ }
+ item = model.getItem(i + 1);
+
+ item.getAccount()
+ .setAccountName(acc.getAccountName());
+ if (acc.isAmountSet()) {