Android: Reinstate code with previous album-switch bug

This commit is contained in:
Amit Davidi 2017-03-01 22:25:56 +02:00
parent de5be5e3ad
commit b4cbdd4b1a
1 changed files with 5 additions and 9 deletions

View File

@ -308,15 +308,11 @@ public class GalleryAdapter extends RecyclerView.Adapter<GalleryAdapter.AbsViewH
@Override
public void run() {
if (!view.isComputingLayout()) {
// TODO revisit this sequence
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) {
notifyItemRangeInserted(0, postCount);
} else {
view.swapAdapter(GalleryAdapter.this, true);
view.getLayoutManager().requestLayout();
}
} else {
view.postDelayed(new Runnable() {