]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/transaction_list/TransactionRowHolder.java
more pronounced day/month delimiters in the transaction list
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / transaction_list / TransactionRowHolder.java
index 85d36911a6e772421b0fff015039cc281493cd02..876430f5de06e4c1b4b25a9061a5f9d74abfe94b 100644 (file)
@@ -50,7 +50,8 @@ class TransactionRowHolder extends TransactionRowHolderBase {
         super(binding.getRoot());
         b = binding;
     }
-    public void bind(@NonNull LedgerTransaction tr, @Nullable String boldAccountName) {
+    public void bind(@NonNull TransactionListItem item, @Nullable String boldAccountName) {
+        LedgerTransaction tr = item.getTransaction();
         b.transactionRowDescription.setText(tr.getDescription());
         String trComment = Misc.emptyIsNull(tr.getComment());
         if (trComment == null)
@@ -60,6 +61,16 @@ class TransactionRowHolder extends TransactionRowHolderBase {
             b.transactionComment.setVisibility(View.VISIBLE);
         }
 
+        if (Misc.emptyIsNull(item.getRunningTotal()) != null) {
+            b.transactionRunningTotal.setText(item.getRunningTotal());
+            b.transactionRunningTotal.setVisibility(View.VISIBLE);
+            b.transactionRunningTotalDivider.setVisibility(View.VISIBLE);
+        }
+        else {
+            b.transactionRunningTotal.setVisibility(View.GONE);
+            b.transactionRunningTotalDivider.setVisibility(View.GONE);
+        }
+
         int rowIndex = 0;
         Context ctx = b.getRoot()
                        .getContext();
@@ -80,11 +91,12 @@ class TransactionRowHolder extends TransactionRowHolderBase {
             if ((boldAccountName != null) && acc.getAccountName()
                                                 .startsWith(boldAccountName))
             {
-                accName.setTextColor(Colors.secondary);
-                accAmount.setTextColor(Colors.secondary);
+                accName.setTextColor(Colors.primary);
+                accAmount.setTextColor(Colors.primary);
 
-                SpannableString ss = new SpannableString(acc.getAccountName());
-                ss.setSpan(new StyleSpan(Typeface.BOLD), 0, boldAccountName.length(),
+                SpannableString ss = new SpannableString(Misc.addWrapHints(acc.getAccountName()));
+                ss.setSpan(new StyleSpan(Typeface.BOLD), 0, Misc.addWrapHints(boldAccountName)
+                                                                .length(),
                         Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
                 accName.setText(ss);
             }
@@ -93,7 +105,7 @@ class TransactionRowHolder extends TransactionRowHolderBase {
                                                    .getDefaultColor();
                 accName.setTextColor(textColor);
                 accAmount.setTextColor(textColor);
-                accName.setText(acc.getAccountName());
+                accName.setText(Misc.addWrapHints(acc.getAccountName()));
             }
 
             String comment = acc.getComment();