|
|
@@ -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()){
|