This repository was archived by the owner on Jun 27, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +9
-6
lines changed
app/src/main/java/com/blogspot/e_kanivets/moneytracker Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 1010import com .blogspot .e_kanivets .moneytracker .controller .AccountController ;
1111import com .blogspot .e_kanivets .moneytracker .controller .ExchangeRateController ;
1212import com .blogspot .e_kanivets .moneytracker .DbHelper ;
13+ import com .blogspot .e_kanivets .moneytracker .entity .Account ;
1314import com .blogspot .e_kanivets .moneytracker .model .Period ;
1415import com .blogspot .e_kanivets .moneytracker .entity .Record ;
1516import com .blogspot .e_kanivets .moneytracker .repo .AccountRepo ;
@@ -54,8 +55,8 @@ protected boolean initData() {
5455 ExchangeRateController rateController = new ExchangeRateController (new ExchangeRateRepo (dbHelper ));
5556
5657 String currency = DbHelper .DEFAULT_ACCOUNT_CURRENCY ;
57- if ( accountController .readAll (). size () > 0 )
58- currency = accountController . readAll (). get ( 0 ) .getCurrency ();
58+ Account defaultAccount = accountController .readDefaultAccount ();
59+ if ( defaultAccount != null ) currency = defaultAccount .getCurrency ();
5960
6061 ReportMaker reportMaker = new ReportMaker (rateController );
6162 report = reportMaker .getReport (currency , period , recordList );
Original file line number Diff line number Diff line change 1818import com .blogspot .e_kanivets .moneytracker .controller .CategoryController ;
1919import com .blogspot .e_kanivets .moneytracker .controller .ExchangeRateController ;
2020import com .blogspot .e_kanivets .moneytracker .controller .RecordController ;
21+ import com .blogspot .e_kanivets .moneytracker .entity .Account ;
2122import com .blogspot .e_kanivets .moneytracker .entity .Category ;
2223import com .blogspot .e_kanivets .moneytracker .entity .Record ;
2324import com .blogspot .e_kanivets .moneytracker .model .Period ;
@@ -186,8 +187,8 @@ private void update() {
186187 listView .setAdapter (new RecordAdapter (MainActivity .this , recordList ));
187188
188189 String currency = DbHelper .DEFAULT_ACCOUNT_CURRENCY ;
189- if ( accountController .readAll (). size () > 0 )
190- currency = accountController . readAll (). get ( 0 ) .getCurrency ();
190+ Account defaultAccount = accountController .readDefaultAccount ();
191+ if ( defaultAccount != null ) currency = defaultAccount .getCurrency ();
191192
192193 ReportMaker reportMaker = new ReportMaker (rateController );
193194 IReport report = reportMaker .getReport (currency , period , recordList );
Original file line number Diff line number Diff line change 1212import com .blogspot .e_kanivets .moneytracker .R ;
1313import com .blogspot .e_kanivets .moneytracker .controller .AccountController ;
1414import com .blogspot .e_kanivets .moneytracker .controller .ExchangeRateController ;
15+ import com .blogspot .e_kanivets .moneytracker .entity .Account ;
1516import com .blogspot .e_kanivets .moneytracker .repo .AccountRepo ;
1617import com .blogspot .e_kanivets .moneytracker .repo .ExchangeRateRepo ;
1718import com .blogspot .e_kanivets .moneytracker .report .ReportMaker ;
@@ -67,8 +68,8 @@ public View create() {
6768 android .R .layout .simple_list_item_1 , currencyList ));
6869
6970 String currency = DbHelper .DEFAULT_ACCOUNT_CURRENCY ;
70- if ( accountController .readAll (). size () > 0 )
71- currency = accountController . readAll (). get ( 0 ) .getCurrency ();
71+ Account defaultAccount = accountController .readDefaultAccount ();
72+ if ( defaultAccount != null ) currency = defaultAccount .getCurrency ();
7273
7374 for (int i = 0 ; i < currencyList .size (); i ++) {
7475 String item = currencyList .get (i );
You can’t perform that action at this time.
0 commit comments