@@ -60,21 +60,26 @@ public void update(IRecordReport report, String currency, List<String> ratesNeed
6060 report .getPeriod ().getFirstDay (), report .getPeriod ().getLastDay ()));
6161
6262 viewHolder .tvTotalIncome .setTextColor (report .getTotalIncome () >= 0 ? green : red );
63- viewHolder .tvTotalIncome .setText (format (report .getTotalIncome (), report .getCurrency ()));
63+ viewHolder .tvTotalIncome .setText (formatIncome (report .getTotalIncome (), report .getCurrency ()));
6464
65- viewHolder .tvTotalExpense .setTextColor (report .getTotalExpense () >= 0 ? green : red );
66- viewHolder .tvTotalExpense .setText (format (report .getTotalExpense (), report .getCurrency ()));
65+ viewHolder .tvTotalExpense .setTextColor (report .getTotalExpense () > 0 ? green : red );
66+ viewHolder .tvTotalExpense .setText (formatExpense (report .getTotalExpense (), report .getCurrency ()));
6767
6868 viewHolder .tvTotal .setTextColor (report .getTotal () >= 0 ? green : red );
69- viewHolder .tvTotal .setText (format (report .getTotal (), report .getCurrency ()));
69+ viewHolder .tvTotal .setText (formatIncome (report .getTotal (), report .getCurrency ()));
7070 }
7171 }
7272
73- private String format (double amount , String currency ) {
73+ private String formatIncome (double amount , String currency ) {
7474 return (amount >= 0 ? "+ " : "- " ) + String .format (Locale .getDefault (), "%.0f" , Math .abs (amount ))
7575 + " " + currency ;
7676 }
7777
78+ private String formatExpense (double amount , String currency ) {
79+ return (amount > 0 ? "+ " : "- " ) + String .format (Locale .getDefault (), "%.0f" , Math .abs (amount ))
80+ + " " + currency ;
81+ }
82+
7883 public static class ViewHolder {
7984 @ Bind (R .id .tv_period )
8085 TextView tvPeriod ;
0 commit comments