@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();
//}
}
gridview 多选
最新推荐文章于 2024-02-05 09:43:35 发布