]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java
fu: single transaction list
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / async / RetrieveTransactionsTask.java
index 13941806240b07f42173e545dc3243b583b25270..8902d455a91bb02f591408a0dd5358118e8d0153 100644 (file)
@@ -26,7 +26,7 @@ import android.util.Log;
 import net.ktnx.mobileledger.R;
 import net.ktnx.mobileledger.TransactionListActivity;
 import net.ktnx.mobileledger.model.LedgerTransaction;
-import net.ktnx.mobileledger.model.LedgerTransactionItem;
+import net.ktnx.mobileledger.model.LedgerTransactionAccount;
 import net.ktnx.mobileledger.utils.MLDB;
 import net.ktnx.mobileledger.utils.NetworkUtil;
 
@@ -50,7 +50,7 @@ public class RetrieveTransactionsTask extends
     private static final Pattern transactionDescriptionPattern =
             Pattern.compile("<tr class=\"posting\" title=\"(\\S+)\\s(.+)");
     private static final Pattern transactionDetailsPattern =
-            Pattern.compile("^\\s+" + "(\\S[\\S\\s]+\\S)\\s\\s+([-+]?\\d[\\d,.]*)");
+            Pattern.compile("^\\s+" + "(\\S[\\S\\s]+\\S)\\s\\s+([-+]?\\d[\\d,.]*)(?:\\s+(\\S+)$)?");
     private static final Pattern endPattern = Pattern.compile("\\bid=\"addmodal\"");
     protected WeakReference<TransactionListActivity> contextRef;
     protected int error;
@@ -214,9 +214,11 @@ public class RetrieveTransactionsTask extends
                                         if (m.find()) {
                                             String acc_name = m.group(1);
                                             String amount = m.group(2);
+                                            String currency = m.group(3);
                                             amount = amount.replace(',', '.');
-                                            transaction.add_item(new LedgerTransactionItem(acc_name,
-                                                    Float.valueOf(amount)));
+                                            transaction.addAccount(
+                                                    new LedgerTransactionAccount(acc_name,
+                                                            Float.valueOf(amount), currency));
                                             L(String.format("%s = %s", acc_name, amount));
                                         }
                                         else throw new IllegalStateException(