File tree Expand file tree Collapse file tree
app/src/main/java/org/gnucash/android/ui/report Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -229,7 +229,9 @@ private BarData getData() {
229229 if (!accountToColorMap .containsKey (account .getUID ())) {
230230 Integer color ;
231231 if (mUseAccountColor ) {
232- color = account .getColor ();
232+ color = (account .getColor () != Account .DEFAULT_COLOR )
233+ ? account .getColor ()
234+ : COLORS [accountToColorMap .size () % COLORS .length ];
233235 } else {
234236 color = COLORS [accountToColorMap .size () % COLORS .length ];
235237 }
Original file line number Diff line number Diff line change 4242import org .gnucash .android .R ;
4343import org .gnucash .android .app .GnuCashApplication ;
4444import org .gnucash .android .db .AccountsDbAdapter ;
45- import org .gnucash .android .db .TransactionsDbAdapter ;
4645import org .gnucash .android .model .Account ;
4746import org .gnucash .android .model .AccountType ;
4847
@@ -197,9 +196,15 @@ private PieData getData() {
197196 mReportStartTime , mReportEndTime ).asDouble ();
198197 if (balance > 0 ) {
199198 dataSet .addEntry (new Entry ((float ) balance , dataSet .getEntryCount ()));
200- colors .add (mUseAccountColor
201- ? account .getColor ()
202- : ReportsActivity .COLORS [(dataSet .getEntryCount () - 1 ) % ReportsActivity .COLORS .length ]);
199+ int color ;
200+ if (mUseAccountColor ) {
201+ color = (account .getColor () != Account .DEFAULT_COLOR )
202+ ? account .getColor ()
203+ : ReportsActivity .COLORS [(dataSet .getEntryCount () - 1 ) % ReportsActivity .COLORS .length ];
204+ } else {
205+ color = ReportsActivity .COLORS [(dataSet .getEntryCount () - 1 ) % ReportsActivity .COLORS .length ];
206+ }
207+ colors .add (color );
203208 labels .add (account .getName ());
204209 }
205210 }
Original file line number Diff line number Diff line change @@ -199,7 +199,9 @@ private PieData getData() {
199199 Collections .singletonList (account .getUID ()), start , end ).asDouble ();
200200 if (balance > 0 ) {
201201 dataSet .addEntry (new Entry ((float ) balance , dataSet .getEntryCount ()));
202- colors .add (account .getColor ());
202+ colors .add (account .getColor () != Account .DEFAULT_COLOR
203+ ? account .getColor ()
204+ : ReportsActivity .COLORS [(dataSet .getEntryCount () - 1 ) % ReportsActivity .COLORS .length ]);
203205 labels .add (account .getName ());
204206 }
205207 }
You can’t perform that action at this time.
0 commit comments