Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 610bcf37 authored by Philip P. Moltmann's avatar Philip P. Moltmann Committed by Android (Google) Code Review
Browse files

Merge "The PageAdapter update might be caused by the RecylerView." into nyc-dev

parents 98a41e32 e7f06a87
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
import android.os.Handler;
import android.os.Looper;
import android.os.ParcelFileDescriptor;
import android.print.PageRange;
import android.print.PrintAttributes.MediaSize;
@@ -570,8 +572,15 @@ public final class PageAdapter extends Adapter<ViewHolder> {
            if (DEBUG) {
                Log.i(LOG_TAG, "Requesting pages: " + Arrays.toString(mRequestedPages));
            }

            // This call might come from a recylerview that is currently updating. Hence delay to
            // after the update
            (new Handler(Looper.getMainLooper())).post(new Runnable() {
                @Override public void run() {
                    mCallbacks.onRequestContentUpdate();
                }
            });
        }
    }

    private PageRange[] computeRequestedPages(int pageInDocument) {