Xieshengqi 6 vuotta sitten
vanhempi
commit
b8b819217e

+ 10 - 4
app/src/main/java/com/kuxuan/moneynote/ui/adapter/ReportAdapter.java

@@ -71,14 +71,14 @@ public class ReportAdapter extends BaseQuickAdapter<ReportJson, ReportViewHolder
71 71
                 case 2:
72 72
                     item.setOutmoney((long) Float.parseFloat(typeDataJson.getAccount()));
73 73
                     data = JavaFormatUtils.getData(item.getOutmoney() / item.getAllMoney() * 100);
74
-                    helper.money_text.setText(typeDataJson.getAccount()+ "");
74
+                    helper.money_text.setText(changeFloatData(Double.parseDouble(typeDataJson.getAccount()))+ "");
75 75
                     helper.progressBar.setProgress((int) (item.getOutmoney() * 100 / item.getAllMoney()));
76 76
                     break;
77 77
                 case 1:
78 78
                     item.setInmoney((long) Float.parseFloat(typeDataJson.getAccount()));
79 79
                     data = JavaFormatUtils.getData(item.getInmoney() / item.getAllMoney() * 100);
80 80
 //                    JavaFormatUtils.formatFloatNumber(Float.parseFloat(typeDataJson.getAccount())
81
-                    helper.money_text.setText(typeDataJson.getAccount() + "");
81
+                    helper.money_text.setText(changeFloatData(Double.parseDouble(typeDataJson.getAccount()))+ "");
82 82
                     helper.progressBar.setProgress((int) (item.getInmoney() * 100 / item.getAllMoney()));
83 83
                     break;
84 84
             }
@@ -94,13 +94,13 @@ public class ReportAdapter extends BaseQuickAdapter<ReportJson, ReportViewHolder
94 94
                     item.setOutmoney((long) Float.parseFloat(typeDataJson.getAccount()));
95 95
                     float f = item.getOutmoney() / item.getAllMoney();
96 96
                     data = JavaFormatUtils.getData(f * 100);
97
-                    helper.money_text.setText(typeDataJson.getAccount() + "");
97
+                    helper.money_text.setText(changeFloatData(Double.parseDouble(typeDataJson.getAccount())) + "");
98 98
                     helper.progressBar.setProgress((int) (item.getOutmoney() * 100 / item.getAllMoney()));
99 99
                     break;
100 100
                 case 1:
101 101
                     item.setInmoney((long)Float.parseFloat(typeDataJson.getAccount()));
102 102
                     data = JavaFormatUtils.getData(item.getInmoney() / item.getAllMoney() * 100);
103
-                    helper.money_text.setText(typeDataJson.getAccount()+ "");
103
+                    helper.money_text.setText(changeFloatData(Double.parseDouble(typeDataJson.getAccount()))+ "");
104 104
                     helper.progressBar.setProgress((int) (item.getInmoney() * 100 / item.getAllMoney()));
105 105
                     break;
106 106
             }
@@ -122,4 +122,10 @@ public class ReportAdapter extends BaseQuickAdapter<ReportJson, ReportViewHolder
122 122
             helper.line_View.setVisibility(View.VISIBLE);
123 123
         }
124 124
     }
125
+
126
+
127
+    private String changeFloatData(double account){
128
+        java.text.DecimalFormat df = new java.text.DecimalFormat("########.00");
129
+        return df.format(account);
130
+    }
125 131
 }

+ 2 - 1
app/src/main/java/com/kuxuan/moneynote/ui/fragments/details/DetialDBOpertor.java

@@ -149,7 +149,8 @@ public class DetialDBOpertor {
149 149
             typeDataJson.setType(list.get(i).getType());
150 150
             typeDataJson.setDetail_icon(list.get(i).getImage_path());
151 151
             typeDataJson.setSmall_icon(list.get(i).getImage_path());
152
-            typeDataJson.setAccount(list.get(i).getAccount() + "");
152
+            java.text.DecimalFormat df = new java.text.DecimalFormat("########.00");
153
+            typeDataJson.setAccount( df.format(list.get(i).getAccount()) + "");
153 154
             typeDataJson.setName(list.get(i).getName());
154 155
             datas.add(typeDataJson);
155 156
         }