]> git.ktnx.net Git - mobile-ledger.git/commitdiff
show accounts and amounts in the transaction list
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sat, 15 Dec 2018 19:38:02 +0000 (19:38 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sat, 15 Dec 2018 19:38:02 +0000 (19:38 +0000)
still looks very ugly and needs further work

app/src/main/java/net/ktnx/mobileledger/TransactionListAdapter.java

index f190efcd87ce571c384ff6b831b6eaecdc905336..4b8a87084fbd7eddfa6035ff57e092f235ee9b44 100644 (file)
@@ -47,7 +47,19 @@ class TransactionListAdapter
         Resources rm = ctx.getResources();
 
         holder.tvDescription.setText(String.format("%s\n%s", tr.getDescription(), tr.getDate()));
-//        holder.tableAccounts.setText(acc.getAmountsString());
+        TableLayout tbl = holder.row.findViewById(R.id.transaction_row_acc_amounts);
+        tbl.removeAllViews();
+        for (Iterator<LedgerTransactionItem> it = tr.getItemsIterator(); it.hasNext(); ) {
+            LedgerTransactionItem acc = it.next();
+            TableRow row = new TableRow(holder.row.getContext());
+            TextView child = new TextView(ctx);
+            child.setText(acc.getShortAccountName());
+            row.addView(child);
+            child = new TextView(ctx);
+            child.setText(acc.toString());
+            row.addView(child);
+            tbl.addView(row);
+        }
 
         if (position % 2 == 0) {
             if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) holder.row