]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/model/LedgerAccount.java
overly long commodity lists fade to white and expand/collapse on click
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / model / LedgerAccount.java
index 081b7bc94f35fe9d2d23a4d58a42da43d7ff7532..0e2ae2503539cca05c00a48f5fc3039d5e73dab9 100644 (file)
@@ -119,7 +119,7 @@ public class LedgerAccount {
     public void addAmount(float amount) {
         this.addAmount(amount, null);
     }
-
+    public int getAmountCount() { return amounts.size(); }
     public String getAmountsString() {
         if ((amounts == null) || amounts.isEmpty()) return "";
 
@@ -132,7 +132,21 @@ public class LedgerAccount {
 
         return builder.toString();
     }
+    public String getAmountsString(int limit) {
+        if ((amounts == null) || amounts.isEmpty()) return "";
 
+        int included = 0;
+        StringBuilder builder = new StringBuilder();
+        for (LedgerAmount amount : amounts) {
+            String amt = amount.toString();
+            if (builder.length() > 0) builder.append('\n');
+            builder.append(amt);
+            included++;
+            if (included == limit) break;
+        }
+
+        return builder.toString();
+    }
     public int getLevel() {
         return level;
     }