liujiangyao лет назад: 8
Родитель
Сommit
2856c7a3c3

+ 11 - 0
app/src/main/java/com/kfzs/duanduan/utils/dlg/FormatAny.java

@@ -153,5 +153,16 @@ public class FormatAny {
         return new SimpleDateFormat(FORMAT_TIME_DEFAULT).format(date);
         return new SimpleDateFormat(FORMAT_TIME_DEFAULT).format(date);
     }
     }
 
 
+    /**
+     * 数字格式化
+     */
+    public String formatString(String value){
+        try{
+            return new DecimalFormat("#.##").format(value);
+        }catch (Exception e){
+            e.printStackTrace();
+            return "0";
+        }
+    }
 
 
 }
 }

+ 7 - 3
app/src/main/java/com/sheep/gamegroup/view/activity/WithdrawalAct.java

@@ -13,6 +13,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.kfzs.duanduan.event.BigEvent;
 import com.kfzs.duanduan.event.BigEvent;
 import com.kfzs.duanduan.event.EventTypes;
 import com.kfzs.duanduan.event.EventTypes;
+import com.kfzs.duanduan.utils.dlg.FormatAny;
 import com.sheep.gamegroup.di.components.DaggerWithdrawalComponent;
 import com.sheep.gamegroup.di.components.DaggerWithdrawalComponent;
 import com.sheep.gamegroup.di.modules.WithdrawalModule;
 import com.sheep.gamegroup.di.modules.WithdrawalModule;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.BaseMessage;
@@ -135,8 +136,7 @@ public class WithdrawalAct extends BaseActivity implements WithdrawalContract.Vi
             e.printStackTrace();
             e.printStackTrace();
         }
         }
 
 
-        String sr = "可提现金额<font color='#ff2d4b'><small>" + balanceAmount + "</small></font>元";
-        withdrawal_click_bindname_tv.setText(Html.fromHtml(sr));
+        setBalanceAmount();
     }
     }
 
 
 
 
@@ -227,8 +227,12 @@ public class WithdrawalAct extends BaseActivity implements WithdrawalContract.Vi
         hideProgress();
         hideProgress();
         String balanceA =  o.getData() +"";
         String balanceA =  o.getData() +"";
         balanceAmount = TextUtils.isEmpty(balanceA)?"0":balanceA;
         balanceAmount = TextUtils.isEmpty(balanceA)?"0":balanceA;
+        setBalanceAmount();
+    }
+
+    private void setBalanceAmount(){
 
 
-        String sr = "可提现金额 <font color='#ff2d4b'><big>" + balanceAmount + "</big></font> 元";
+        String sr = "可提现金额 <font color='#ff2d4b'><big>" + FormatAny.getInstance().formatString(balanceAmount) + "</big></font> 元";
         withdrawal_click_bindname_tv.setText(Html.fromHtml(sr));
         withdrawal_click_bindname_tv.setText(Html.fromHtml(sr));
     }
     }