Android: Fixed potential bug in gallery refreshing

This commit is contained in:
Amit Davidi 2017-02-27 19:24:31 +02:00
parent 1beda5244c
commit b9ab865cee
1 changed files with 5 additions and 5 deletions

View File

@ -57,7 +57,7 @@ public class GalleryAdapter extends RecyclerView.Adapter<GalleryAdapter.AbsViewH
@Override
public void onClick(View v) {
if (this.isSupported) {
view.onTapImage(ImageHolder.this.image.uri);
view.onTapImage(this.image.uri);
v.setSelected(!v.isSelected());
}
}
@ -244,15 +244,15 @@ public class GalleryAdapter extends RecyclerView.Adapter<GalleryAdapter.AbsViewH
@Override
public void run() {
if (!view.isComputingLayout()) {
if (Math.min(preCount, postCount) > 0) {
notifyItemRangeChanged(0, Math.min(preCount, postCount));
}
if (postCount > preCount) {
notifyItemRangeInserted(preCount, postCount - preCount);
} else if (postCount < preCount) {
notifyItemRangeRemoved(postCount, preCount - postCount);
}
if (preCount > 0) {
notifyItemRangeChanged(0, Math.min(preCount, postCount));
}
} else {
view.postDelayed(new Runnable() {
@Override