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

+ 6 - 0
app/src/main/java/com/sheep/gamegroup/model/api/ApiService.java

@@ -293,4 +293,10 @@ public interface ApiService {
 
     @GET("app/accepted_task/get_schedule_list")
     Observable<BaseMessage> getCreditCardScheduleList();
+
+    /**
+     * 获取提现金额
+     */
+    @GET("app/withdraw_amount_option")
+    Observable<BaseMessage> getWithdrawAmountOption();
 }

+ 3 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/GridViewEntity.java

@@ -11,6 +11,9 @@ public class GridViewEntity {
         this.value = value;
     }
 
+    public GridViewEntity() {
+    }
+
     private boolean selectState;
     private String value;
 

+ 73 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/WithdrawalList.java

@@ -0,0 +1,73 @@
+package com.sheep.gamegroup.model.entity;
+
+/**
+ * 提现金额
+ * Created by ljy on 2018/4/27.
+ */
+
+public class WithdrawalList {
+    private int amount;// 0,
+            private String created_time;// 0,
+            private int id;// 0,
+            private int status = 1;// 1显示 2不显示
+            private int type;// 0都显示 1第一次提现现实
+            private String update_time;// 0
+
+    private GridViewEntity gridViewEntity;
+
+    public GridViewEntity getGridViewEntity() {
+        return gridViewEntity;
+    }
+
+    public void setGridViewEntity(GridViewEntity gridViewEntity) {
+        this.gridViewEntity = gridViewEntity;
+    }
+
+    public int getAmount() {
+        return amount;
+    }
+
+    public void setAmount(int amount) {
+        this.amount = amount;
+    }
+
+    public String getCreated_time() {
+        return created_time;
+    }
+
+    public void setCreated_time(String created_time) {
+        this.created_time = created_time;
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public int getStatus() {
+        return status;
+    }
+
+    public void setStatus(int status) {
+        this.status = status;
+    }
+
+    public int getType() {
+        return type;
+    }
+
+    public void setType(int type) {
+        this.type = type;
+    }
+
+    public String getUpdate_time() {
+        return update_time;
+    }
+
+    public void setUpdate_time(String update_time) {
+        this.update_time = update_time;
+    }
+}

+ 3 - 0
app/src/main/java/com/sheep/gamegroup/presenter/WithdrawalContract.java

@@ -13,6 +13,7 @@ public interface WithdrawalContract {
 
         void goWithdrawal(JSONObject jsonObject);
         void getCanWithdrawAmount();
+        void getWithdrawAmountOption();
 
     }
 
@@ -21,5 +22,7 @@ public interface WithdrawalContract {
         void updateView(Object o);
         void failBalanceData(BaseMessage o);
         void updateBalanceView(BaseMessage o);
+        void failWithdrawAmountOptionData(BaseMessage o);
+        void updateWithdrawAmountOptionView(BaseMessage o);
     }
 }

+ 18 - 0
app/src/main/java/com/sheep/gamegroup/presenter/WithdrawalPresenter.java

@@ -62,4 +62,22 @@ public class WithdrawalPresenter implements WithdrawalContract.Presenter {
                     }
                 });
     }
+
+    @Override
+    public void getWithdrawAmountOption() {
+        apiService.getWithdrawAmountOption()
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.mContext) {
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
+                        view.failWithdrawAmountOptionData(baseMessage);
+                    }
+
+                    @Override
+                    public void onNext(BaseMessage baseMessage) {
+                        view.updateWithdrawAmountOptionView(baseMessage);
+                    }
+                });
+    }
 }

+ 42 - 4
app/src/main/java/com/sheep/gamegroup/view/activity/WithdrawalAct.java

@@ -11,6 +11,7 @@ import android.widget.GridView;
 import android.widget.TextView;
 
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.kfzs.duanduan.event.BigEvent;
 import com.kfzs.duanduan.event.EventTypes;
@@ -19,6 +20,7 @@ import com.sheep.gamegroup.di.modules.WithdrawalModule;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.GridViewEntity;
 import com.sheep.gamegroup.model.entity.UserEntity;
+import com.sheep.gamegroup.model.entity.WithdrawalList;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.presenter.WithdrawalContract;
 import com.sheep.gamegroup.presenter.WithdrawalPresenter;
@@ -69,6 +71,8 @@ public class WithdrawalAct extends BaseActivity implements WithdrawalContract.Vi
     @Inject
     WithdrawalPresenter presenter;
 
+    private List<WithdrawalList> wlLists = new ArrayList<>();
+
     private WithdrawalAdapter adapter;
     private ArrayList<Object> listData = new ArrayList<>();
     private int select;
@@ -94,7 +98,7 @@ public class WithdrawalAct extends BaseActivity implements WithdrawalContract.Vi
                 .withdrawalModule(new WithdrawalModule(this))
                 .build()
                 .inject(this);
-        adapter = new WithdrawalAdapter(activity, assemblyData());
+        adapter = new WithdrawalAdapter(activity, wlLists);
         withdrawalGreidview.setVerticalSpacing(25);
         withdrawalGreidview.setAdapter(adapter);
         adapter.notifyDataSetChanged();
@@ -102,11 +106,11 @@ public class WithdrawalAct extends BaseActivity implements WithdrawalContract.Vi
             @Override
             public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                 select = position;
-                for(int i=0;i<listData.size();i++){
+                for(int i=0;i<wlLists.size();i++){
                     if(position == i){
-                        ((GridViewEntity)listData.get(i)).setSelectState(true);
+                        wlLists.get(i).getGridViewEntity().setSelectState(true);
                     }else {
-                        ((GridViewEntity)listData.get(i)).setSelectState(false);
+                        wlLists.get(i).getGridViewEntity().setSelectState(false);
 
                     }
                     adapter.notifyDataSetChanged();
@@ -115,6 +119,7 @@ public class WithdrawalAct extends BaseActivity implements WithdrawalContract.Vi
         });
         showProgress();
         presenter.getCanWithdrawAmount();
+        presenter.getWithdrawAmountOption();
     }
 
     @Override
@@ -237,6 +242,39 @@ public class WithdrawalAct extends BaseActivity implements WithdrawalContract.Vi
         withdrawal_click_bindname_tv.setText(Html.fromHtml(sr));
     }
 
+    @Override
+    public void failWithdrawAmountOptionData(BaseMessage o) {
+        G.showToast(o.getMsg()+"");
+    }
+
+    @Override
+    public void updateWithdrawAmountOptionView(BaseMessage o) {
+        try{
+            List<WithdrawalList> withdrawalLists = JSONArray.parseArray(JSONArray.toJSONString(o.getData()), WithdrawalList.class);
+            wlLists.clear();
+            for(int i=0;i< withdrawalLists.size(); i++){
+                WithdrawalList withdrawalList = withdrawalLists.get(i);
+                if(withdrawalList.getType() != 2){
+                    GridViewEntity gridViewEntity = new GridViewEntity();
+                    if(i == 0){
+                        gridViewEntity.setSelectState(true);
+                    }else {
+                        gridViewEntity.setSelectState(false);
+                    }
+                    gridViewEntity.setValue(withdrawalList.getAmount()+"");
+                    withdrawalList.setGridViewEntity(gridViewEntity);
+
+                    wlLists.add(withdrawalList);
+                }
+
+            }
+
+            adapter.notifyDataSetChanged();
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
+
     @Subscribe
     public void onEventMainThread(BigEvent event){
         switch (event.getEventTypes()){

+ 5 - 4
app/src/main/java/com/sheep/gamegroup/view/adapter/WithdrawalAdapter.java

@@ -9,6 +9,7 @@ import android.widget.BaseAdapter;
 import android.widget.TextView;
 
 import com.sheep.gamegroup.model.entity.GridViewEntity;
+import com.sheep.gamegroup.model.entity.WithdrawalList;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.utils.G;
 
@@ -21,9 +22,9 @@ import java.util.List;
 
 public class WithdrawalAdapter extends BaseAdapter {
     private Context context;
-    private List<Object> listData;
+    private List<WithdrawalList> listData;
 
-    public WithdrawalAdapter(Context context, List<Object> listData) {
+    public WithdrawalAdapter(Context context, List<WithdrawalList> listData) {
         this.context = context;
         this.listData = listData;
     }
@@ -34,7 +35,7 @@ public class WithdrawalAdapter extends BaseAdapter {
     }
 
     @Override
-    public Object getItem(int position) {
+    public WithdrawalList getItem(int position) {
         return listData.get(position);
     }
 
@@ -62,7 +63,7 @@ public class WithdrawalAdapter extends BaseAdapter {
         }else {
             holder = (ViewHolder) convertView.getTag();
         }
-        GridViewEntity priceShow = (GridViewEntity) getItem(position);
+        GridViewEntity priceShow = getItem(position).getGridViewEntity();
         if (priceShow.isSelectState()){
             convertView.setBackground(context.getResources().getDrawable(R.drawable.sp_bg_gradient_rectangle_blue));
         }else{