|
@@ -75,7 +75,8 @@ public class DialogPayGame {
|
|
|
private MyGridview myGridview;
|
|
private MyGridview myGridview;
|
|
|
private List<WithdrawalList> wlLists = new ArrayList<>();
|
|
private List<WithdrawalList> wlLists = new ArrayList<>();
|
|
|
private WithdrawalAdapter adapter;
|
|
private WithdrawalAdapter adapter;
|
|
|
- private int select;
|
|
|
|
|
|
|
+ private int select = -1;//默认不选中
|
|
|
|
|
+ private int lastSelect = -1;
|
|
|
private String amount;
|
|
private String amount;
|
|
|
|
|
|
|
|
private GamePayList gameVoucherAndRatio;
|
|
private GamePayList gameVoucherAndRatio;
|
|
@@ -399,16 +400,16 @@ public class DialogPayGame {
|
|
|
myGridview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
myGridview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
|
@Override
|
|
@Override
|
|
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
|
- select = position;
|
|
|
|
|
- for(int i=0;i<wlLists.size();i++){
|
|
|
|
|
- if(position == i){
|
|
|
|
|
- wlLists.get(i).getGridViewEntity().setSelectState(true);
|
|
|
|
|
- }else {
|
|
|
|
|
- wlLists.get(i).getGridViewEntity().setSelectState(false);
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- adapter.notifyDataSetChanged();
|
|
|
|
|
|
|
+ wlLists.get(position).getGridViewEntity().setSelectState(true);
|
|
|
|
|
+ if(ListUtil.hasIndex(wlLists, select) && select != position){
|
|
|
|
|
+ wlLists.get(select).getGridViewEntity().setSelectState(false);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(ListUtil.hasIndex(wlLists, lastSelect) && lastSelect != position){
|
|
|
|
|
+ wlLists.get(lastSelect).getGridViewEntity().setSelectState(false);
|
|
|
|
|
+ lastSelect = -1;
|
|
|
}
|
|
}
|
|
|
|
|
+ select = position;
|
|
|
|
|
+ adapter.notifyDataSetChanged();
|
|
|
makePriceShow(wlLists.get(position).getGridViewEntity().getValue());
|
|
makePriceShow(wlLists.get(position).getGridViewEntity().getValue());
|
|
|
money_et.setText("");
|
|
money_et.setText("");
|
|
|
}
|
|
}
|
|
@@ -422,15 +423,18 @@ public class DialogPayGame {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
|
- if (!TextUtils.isEmpty(s) && s.length() > 0 && CommonUtil.getInstance().clickTime(500)) {
|
|
|
|
|
- cleanClick();
|
|
|
|
|
- makePriceShow(s.toString());
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void afterTextChanged(Editable s) {
|
|
public void afterTextChanged(Editable s) {
|
|
|
-
|
|
|
|
|
|
|
+ if (!TextUtils.isEmpty(s)) {//输入有金额,清除上面选中的金额,并重新一份计价
|
|
|
|
|
+ cleanClick();
|
|
|
|
|
+ makePriceShow(s.toString());
|
|
|
|
|
+ } else if(ListUtil.hasIndex(wlLists, lastSelect)) {//没有输入金额,默认选中之前的金额
|
|
|
|
|
+ wlLists.get(lastSelect).getGridViewEntity().setSelectState(true);
|
|
|
|
|
+ adapter.notifyDataSetChanged();
|
|
|
|
|
+ select = lastSelect;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
@@ -459,7 +463,7 @@ public class DialogPayGame {
|
|
|
private void makePriceShow(String price){
|
|
private void makePriceShow(String price){
|
|
|
if(ListUtil.isEmpty(list) || gameVoucherAndRatio == null || TextUtils.isEmpty(price))
|
|
if(ListUtil.isEmpty(list) || gameVoucherAndRatio == null || TextUtils.isEmpty(price))
|
|
|
return;
|
|
return;
|
|
|
- double showPrice = gameVoucherAndRatio.getGift_ratio() * Integer.valueOf(price) /100;
|
|
|
|
|
|
|
+ double showPrice = gameVoucherAndRatio.getGift_ratio() * Long.valueOf(price) /100;
|
|
|
double priceDouble = NumberFormatUtils.decimal(showPrice > gameVoucherAndRatio.getVoucher() ? gameVoucherAndRatio.getVoucher() + gameVoucherAndRatio.getUser_balance(): showPrice + gameVoucherAndRatio.getUser_balance(), 2);
|
|
double priceDouble = NumberFormatUtils.decimal(showPrice > gameVoucherAndRatio.getVoucher() ? gameVoucherAndRatio.getVoucher() + gameVoucherAndRatio.getUser_balance(): showPrice + gameVoucherAndRatio.getUser_balance(), 2);
|
|
|
String p = "绵羊币 (可用"+ priceDouble +") 指非定向货币+定向货币";
|
|
String p = "绵羊币 (可用"+ priceDouble +") 指非定向货币+定向货币";
|
|
|
TextView textView = pay_listview.getChildAt(0).findViewById(R.id.pay_game_dialog_item_tv);
|
|
TextView textView = pay_listview.getChildAt(0).findViewById(R.id.pay_game_dialog_item_tv);
|
|
@@ -472,14 +476,10 @@ public class DialogPayGame {
|
|
|
* 清除gridview 选中
|
|
* 清除gridview 选中
|
|
|
*/
|
|
*/
|
|
|
private void cleanClick(){
|
|
private void cleanClick(){
|
|
|
- new Handler().postDelayed(new Runnable() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void run() {
|
|
|
|
|
- for(int i=0;i<wlLists.size();i++){
|
|
|
|
|
- wlLists.get(i).getGridViewEntity().setSelectState(false);
|
|
|
|
|
- }
|
|
|
|
|
- adapter.notifyDataSetChanged();
|
|
|
|
|
- }
|
|
|
|
|
- },10);
|
|
|
|
|
|
|
+ if(ListUtil.hasIndex(wlLists, select)) {
|
|
|
|
|
+ wlLists.get(select).getGridViewEntity().setSelectState(false);
|
|
|
|
|
+ adapter.notifyDataSetChanged();
|
|
|
|
|
+ lastSelect = select;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|