Skip to content

Commit

Permalink
Use account color in the bar chart
Browse files Browse the repository at this point in the history
  • Loading branch information
aint committed May 25, 2015
1 parent ecfeeef commit a4072c7
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public class BarChartActivity extends PassLockActivity implements OnChartValueSe

private Currency mCurrency;

private boolean mUseAccountColor = true;
private boolean mTotalPercentageMode = true;
private boolean mChartDataPresent = true;

Expand All @@ -104,6 +105,9 @@ protected void onCreate(Bundle savedInstanceState) {

selectedValueTextView = (TextView) findViewById(R.id.selected_chart_slice);

mUseAccountColor = PreferenceManager.getDefaultSharedPreferences(getApplicationContext())
.getBoolean(getString(R.string.key_use_account_color), false);

mCurrency = Currency.getInstance(PreferenceManager.getDefaultSharedPreferences(this)
.getString(getString(R.string.key_report_currency), Money.DEFAULT_CURRENCY_CODE));

Expand Down Expand Up @@ -147,9 +151,14 @@ private BarData getData(AccountType accountType) {
Collections.singletonList(account.getUID()), start, end).asDouble();
if (balance != 0) {
if (!accountToColorMap.containsKey(account.getUID())) {
Integer color = (account.getColorHexCode() != null)
? Color.parseColor(account.getColorHexCode())
: COLORS[accountToColorMap.size() % COLORS.length];
Integer color;
if (mUseAccountColor) {
color = (account.getColorHexCode() != null)
? Color.parseColor(account.getColorHexCode())
: COLORS[accountToColorMap.size() % COLORS.length];
} else {
color = COLORS[accountToColorMap.size() % COLORS.length];
}
accountToColorMap.put(account.getUID(), color);
}

Expand All @@ -162,7 +171,7 @@ private BarData getData(AccountType accountType) {
}

String stackLabels = labels.subList(labels.size() - stack.size(), labels.size()).toString();
values.add(new BarEntry(floatListToArray(stack), i, stackLabels));
values.add(new BarEntry(floatListToArray(stack), i, stackLabels));

xValues.add(tmpDate.toString(X_AXIS_PATTERN));

Expand Down Expand Up @@ -276,7 +285,6 @@ private void displayChart() {
selectedValueTextView.setText("");

if (mChartDataPresent) {
mChart.getAxisLeft().resetAxisMaxValue();
mChart.animateY(ANIMATION_DURATION);
} else {
mChart.clearAnimation();
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ No user-identifiable information will be collected as part of this process!</str
<string name="header_report_settings">Reports</string>
<string name="label_report_currency">Select currency</string>
<string name="title_use_account_color">Account color in reports</string>
<string name="summary_use_account_color">Use account color in the pie chart</string>
<string name="summary_use_account_color">Use account color in the bar/pie chart</string>
<string name="label_confirm_passcode">Please confirm your passcode</string>
<string name="label_new_passcode">Enter your new passcode</string>
<string name="label_old_passcode">Enter your old passcode</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-el/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ No user-identifiable information will be collected as part of this process!
<string name="header_report_settings">Reports</string>
<string name="label_report_currency">Select currency</string>
<string name="title_use_account_color">Account color in reports</string>
<string name="summary_use_account_color">Use account color in the pie chart</string>
<string name="summary_use_account_color">Use account color in the bar/pie chart</string>
<string name="label_confirm_passcode">Please confirm your passcode</string>
<string name="label_new_passcode">Enter your new passcode</string>
<string name="label_old_passcode">Enter your old passcode</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-es-rMX/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ No user-identifiable information will be collected as part of this process!
<string name="header_report_settings">Reports</string>
<string name="label_report_currency">Select currency</string>
<string name="title_use_account_color">Account color in reports</string>
<string name="summary_use_account_color">Use account color in the pie chart</string>
<string name="summary_use_account_color">Use account color in the bar/pie chart</string>
<string name="label_confirm_passcode">Please confirm your passcode</string>
<string name="label_new_passcode">Enter your new passcode</string>
<string name="label_old_passcode">Enter your old passcode</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ Este proceso solo recoge informaci&#243;n que no permite identificar al usuario<
<string name="header_report_settings">Reports</string>
<string name="label_report_currency">Select currency</string>
<string name="title_use_account_color">Account color in reports</string>
<string name="summary_use_account_color">Use account color in the pie chart</string>
<string name="summary_use_account_color">Use account color in the bar/pie chart</string>
<string name="label_confirm_passcode">Confirme su contrase&#241;a</string>
<string name="label_new_passcode">Enter your new passcode</string>
<string name="label_old_passcode">Enter your old passcode</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ Aucune information permettant d\'identifier l\'utilisateur ne sera recueillis da
<string name="header_report_settings">Rapports</string>
<string name="label_report_currency">Sélectionnez la monnaie</string>
<string name="title_use_account_color">Couleur du compte dans les rapports</string>
<string name="summary_use_account_color">utiliser la couleur du compte dans le diagramme circulaire</string>
<string name="summary_use_account_color">utiliser la couleur du compte dans le diagramme bandes/circulaire</string>
<string name="label_confirm_passcode">Veuillez confirmer vorte code</string>
<string name="label_new_passcode">Entrez votre nouveau code</string>
<string name="label_old_passcode">Entrez votre ancien mot de passe</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-hu/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ No user-identifiable information will be collected as part of this process!
<string name="header_report_settings">Reports</string>
<string name="label_report_currency">Select currency</string>
<string name="title_use_account_color">Account color in reports</string>
<string name="summary_use_account_color">Use account color in the pie chart</string>
<string name="summary_use_account_color">Use account color in the bar/pie chart</string>
<string name="label_confirm_passcode">Please confirm your passcode</string>
<string name="label_new_passcode">Enter your new passcode</string>
<string name="label_old_passcode">Enter your old passcode</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ No user-identifiable information will be collected as part of this process!
<string name="header_report_settings">Reports</string>
<string name="label_report_currency">Select currency</string>
<string name="title_use_account_color">Account color in reports</string>
<string name="summary_use_account_color">Use account color in the pie chart</string>
<string name="summary_use_account_color">Use account color in the bar/pie chart</string>
<string name="label_confirm_passcode">Please confirm your passcode</string>
<string name="label_new_passcode">Enter your new passcode</string>
<string name="label_old_passcode">Enter your old passcode</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-nl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ No user-identifiable information will be collected as part of this process!
<string name="header_report_settings">Reports</string>
<string name="label_report_currency">Select currency</string>
<string name="title_use_account_color">Account color in reports</string>
<string name="summary_use_account_color">Use account color in the pie chart</string>
<string name="summary_use_account_color">Use account color in the bar/pie chart</string>
<string name="label_confirm_passcode">Please confirm your passcode</string>
<string name="label_new_passcode">Enter your new passcode</string>
<string name="label_old_passcode">Enter your old passcode</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-pt-rBR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ Nenhuma informação de identificação do usuário será coletada neste proces
<string name="header_report_settings">Relatórios</string>
<string name="label_report_currency">Selecionar moeda</string>
<string name="title_use_account_color">Cor de contas nos relatórios</string>
<string name="summary_use_account_color">Utilizar cor de contas no gráfico de pizza</string>
<string name="summary_use_account_color">Utilizar cor de contas no gráfico de barras/pizza</string>
<string name="nav_menu_scheduled_backups">Backups agendados</string>
<string name="title_scheduled_exports">Exportações agendadas</string>
<string name="label_no_scheduled_exports_to_display">Sem exportações agendadas para mostrar</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ No user-identifiable information will be collected as part of this process!
<string name="header_report_settings">Reports</string>
<string name="label_report_currency">Select currency</string>
<string name="title_use_account_color">Account color in reports</string>
<string name="summary_use_account_color">Use account color in the pie chart</string>
<string name="summary_use_account_color">Use account color in the bar/pie chart</string>
<string name="label_confirm_passcode">请再输入一次</string>
<string name="label_new_passcode">Enter your new passcode</string>
<string name="label_old_passcode">Enter your old passcode</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@
<string name="title_report_prefs">Report Preferences</string>
<string name="label_report_currency">Select currency</string>
<string name="title_use_account_color">Account color in reports</string>
<string name="summary_use_account_color">Use account color in the pie chart</string>
<string name="summary_use_account_color">Use account color in the bar/pie chart</string>
<string name="header_report_settings">Reports</string>
<string name="menu_order_by_size">Order by size</string>
<string name="menu_toggle_legend">Toggle legend</string>
Expand Down

0 comments on commit a4072c7

Please sign in to comment.