Skip to content

Commit

Permalink
bugfix: fix the crash in QDAnimationListViewFragment when click the d…
Browse files Browse the repository at this point in the history
…elete button #27
  • Loading branch information
cgspine committed Sep 4, 2017
1 parent 4d14a92 commit f87d0bf
Showing 1 changed file with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Toast;

import com.qmuiteam.qmui.util.QMUIViewHelper;
import com.qmuiteam.qmui.widget.QMUIAnimationListView;
Expand Down Expand Up @@ -63,14 +64,6 @@ public void manipulate(MyAdapter adapter) {
mData.add(position + 1, "item add" + (current + 1));
mData.add(position + 2, "item add" + (current + 2));
mData.add(position + 3, "item add" + (current + 3));
mData.add(position + 4, "item add" + (current + 4));
mData.add(position + 5, "item add" + (current + 5));
mData.add(position + 6, "item add" + (current + 6));
mData.add(position + 7, "item add" + (current + 7));
mData.add(position + 8, "item add" + (current + 8));
mData.add(position + 9, "item add" + (current + 9));
mData.add(position + 10, "item add" + (current + 10));
mData.add(position + 11, "item add" + (current + 11));
}
});

Expand All @@ -83,8 +76,13 @@ public void onClick(View v) {
@Override
public void manipulate(MyAdapter adapter) {
int position = mListView.getFirstVisiblePosition();
mData.remove(position + 1);
mData.remove(position + 3);
if(mData.size() > position + 4){
mData.remove(position + 1);
mData.remove(position + 3);
}else{
Toast.makeText(getContext(), "item 已经很少了,不如先添加几个?", Toast.LENGTH_SHORT).show();
}

}
});
}
Expand Down

0 comments on commit f87d0bf

Please sign in to comment.