From: Damyan Ivanov Date: Thu, 28 Mar 2019 15:44:14 +0000 (+0200) Subject: add flag to accounts indicating whether their commodity list is expanded X-Git-Tag: v0.9~60 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=99c9595cb7bff9a8af5bc5370bda873286bde29b;p=mobile-ledger.git add flag to accounts indicating whether their commodity list is expanded there may e too many commodities to keep them visible at all times --- diff --git a/app/src/main/java/net/ktnx/mobileledger/model/LedgerAccount.java b/app/src/main/java/net/ktnx/mobileledger/model/LedgerAccount.java index b0593f99..081b7bc9 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/LedgerAccount.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/LedgerAccount.java @@ -36,6 +36,7 @@ public class LedgerAccount { private boolean expanded; private List amounts; private boolean hasSubAccounts; + private boolean amountsExpanded; public LedgerAccount(String name) { this.setName(name); @@ -175,4 +176,7 @@ public class LedgerAccount { public void removeAmounts() { if (amounts != null) amounts.clear(); } + public boolean amountsExpanded() { return amountsExpanded; } + public void setAmountsExpanded(boolean flag) { amountsExpanded = flag; } + public void toggleAmountsExpanded() { amountsExpanded = !amountsExpanded; } } diff --git a/app/src/main/java/net/ktnx/mobileledger/utils/MLDB.java b/app/src/main/java/net/ktnx/mobileledger/utils/MLDB.java index 61694a67..4568846f 100644 --- a/app/src/main/java/net/ktnx/mobileledger/utils/MLDB.java +++ b/app/src/main/java/net/ktnx/mobileledger/utils/MLDB.java @@ -212,7 +212,7 @@ public final class MLDB { class MobileLedgerDatabase extends SQLiteOpenHelper implements AutoCloseable { private static final String DB_NAME = "MoLe.db"; - private static final int LATEST_REVISION = 20; + private static final int LATEST_REVISION = 21; private static final String CREATE_DB_SQL = "create_db"; private final Application mContext; diff --git a/app/src/main/res/raw/create_db.sql b/app/src/main/res/raw/create_db.sql index 7095b178..fd2e43e1 100644 --- a/app/src/main/res/raw/create_db.sql +++ b/app/src/main/res/raw/create_db.sql @@ -1,4 +1,4 @@ -create table accounts(profile varchar not null, name varchar not null, name_upper varchar not null, hidden boolean not null default 0, keep boolean not null default 0, level integer not null, parent_name varchar, expanded default 1); +create table accounts(profile varchar not null, name varchar not null, name_upper varchar not null, hidden boolean not null default 0, keep boolean not null default 0, level integer not null, parent_name varchar, expanded default 1, amounts_expanded boolean default 0); create unique index un_accounts on accounts(profile, name); create table options(profile varchar not null, name varchar not null, value varchar); create unique index un_options on options(profile,name); diff --git a/app/src/main/res/raw/sql_21.sql b/app/src/main/res/raw/sql_21.sql new file mode 100644 index 00000000..19d37d8a --- /dev/null +++ b/app/src/main/res/raw/sql_21.sql @@ -0,0 +1 @@ +alter table accounts add amounts_expanded boolean default 0; \ No newline at end of file