gridview 多选

  @Override
        public void remove(final int index,final int from,final int firstlocatonindex) {
            //if ((mLocaltioncity_list.size() + mAddedcity_list.size()) > 1) {
   item = mAddedcity_list.get(index);
   mAddedcity_list.remove(index);
   mAddedcity_adapter.notifyDataSetChanged();
  
   if(-1!=mLocationCityIndex)
   {
   mLocationCityIndex--;
   Log.d("yulin1130===========", "mLocationCityIndex"+ mLocationCityIndex);
   mPresStorage.saveLocationCityIndex(mLocationCityIndex);
   }
   
   /*if (index != mLocationCityIndex) {
    isLocationIndex=true;
   }*/
   /*if (firstlocatonindex < mLocationCityIndex) {
    Log.d("yulin1130===========", "firstlocatonindex < mLocationCityIndex");
    mLocationCityIndex --;
   } else if(firstlocatonindex > mLocationCityIndex) {
    Log.d("yulin1130===========", "firstlocatonindex > mLocationCityIndex");
    mLocationCityIndex ++;
   }*/
   
  
                AlertDialog.Builder builder = new AlertDialog.Builder(ManageCityActivity.this);
                builder.setIcon(R.drawable.ic_city_dialog)
                        .setTitle(getString(R.string.manageact_deletecity))
                        .setMessage(getString(R.string.manageact_deletecity_ok))
                        .setPositiveButton(getString(R.string.button_ok),
                                new DialogInterface.OnClickListener() {
                                    @Override
                                    public void onClick(DialogInterface dialog, int which) {
                   if (null != item) {
                   mAddedcity_list.add(index, item);
                   /*if(-1 == mLocationCityIndex) {
                  mLocationCityIndex = 0;
                  } else*/
                    if(firstlocatonindex >  from){
                   mLocationCityIndex++;
                   mPresStorage.saveLocationCityIndex(mLocationCityIndex);
                   }else if(firstlocatonindex == from){
                     mLocationCityIndex = 0;
                      mPresStorage.saveLocationCityIndex(mLocationCityIndex);
                   }
             
                   drop();
                   delePreferenceCity(index);
                   mAddedcity_adapter.notifyDataSetChanged();
                   item=null;
             }
                                    }
                                })
                        .setNegativeButton(getString(R.string.button_cancel),
                                new DialogInterface.OnClickListener() {
                                    @Override
                                    public void onClick(DialogInterface dialog, int which) {
                  if (null != item) {
                  mAddedcity_list.add(from, item);
                /* if(-1 == mLocationCityIndex) {
                 mLocationCityIndex = from;
                 } else*/
                 if(firstlocatonindex >  from){
                  mLocationCityIndex++;
                  mPresStorage.saveLocationCityIndex(mLocationCityIndex);
                  }else if(firstlocatonindex == from){
                     mLocationCityIndex = from;
                     mPresStorage.saveLocationCityIndex(mLocationCityIndex);
                  }
                 mPresStorage.saveLocationCityIndex(mLocationCityIndex);
                 drop();
                 mAddedcity_adapter.notifyDataSetChanged();
                 item=null;
            }
         
                                    }
                                });
                AlertDialog dialog = builder.create();
                dialog.show();
            //} else {
               // Toast.makeText(ManageCityActivity.this, getString(R.string.managetoast_notdelete),
                       // Toast.LENGTH_LONG).show();
            //}
        }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值