]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/model/MobileLedgerProfile.java
add functional currency selector when entering new transactions
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / model / MobileLedgerProfile.java
index 7dc4bbfcecc79fabf6e86a6883f9e1041993e442..831dc63f0a04a558b12a15be71bc79e9cac44b9c 100644 (file)
@@ -488,6 +488,23 @@ public final class MobileLedgerProfile {
             db.endTransaction();
         }
     }
+    public List<Currency> getCurrencies() {
+        SQLiteDatabase db = App.getDatabase();
+
+        ArrayList<Currency> result = new ArrayList<>();
+
+        try (Cursor c = db.rawQuery("SELECT c.id, c.name, c.position, c.has_gap FROM currencies c",
+                new String[]{}))
+        {
+            while (c.moveToNext()) {
+                Currency currency = new Currency(c.getInt(0), c.getString(1),
+                        Currency.Position.valueOf(c.getInt(2)), c.getInt(3) == 1);
+                result.add(currency);
+            }
+        }
+
+        return result;
+    }
     public enum FutureDates {
         None(0), OneWeek(7), TwoWeeks(14), OneMonth(30), TwoMonths(60), ThreeMonths(90),
         SixMonths(180), OneYear(365), All(-1);