diff options
author | Svetoslav <svetoslavganov@google.com> | 2014-09-16 09:13:04 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-09-16 09:13:04 +0000 |
commit | 8f06311db699c46cfa7ef3e29f54e45942a9234b (patch) | |
tree | 7bfd4fecca4da269ea96873797dafe5520b86d14 /packages | |
parent | c695e6c289ef9389d3aef2080246b2c9b97ec242 (diff) | |
parent | f0073bb800af6c799ad94b04703d6349aa6d83a0 (diff) | |
download | frameworks_base-8f06311db699c46cfa7ef3e29f54e45942a9234b.zip frameworks_base-8f06311db699c46cfa7ef3e29f54e45942a9234b.tar.gz frameworks_base-8f06311db699c46cfa7ef3e29f54e45942a9234b.tar.bz2 |
am 8e0c2e8d: am 88025747: am 42f75e9f: Merge "Missing or wrong pages in preview when scorlling large docs." into lmp-dev
* commit '8e0c2e8de282664c367cfbd2f36efc0d443481fe':
Missing or wrong pages in preview when scorlling large docs.
Diffstat (limited to 'packages')
-rw-r--r-- | packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java | 14 | ||||
-rw-r--r-- | packages/PrintSpooler/src/com/android/printspooler/ui/PrintPreviewController.java | 6 |
2 files changed, 12 insertions, 8 deletions
diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java b/packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java index 13eb73f..369c453 100644 --- a/packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java +++ b/packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java @@ -57,7 +57,7 @@ public final class PageAdapter extends Adapter implements private static final int MAX_PREVIEW_PAGES_BATCH = 50; - private static final boolean DEBUG = true; + private static final boolean DEBUG = false; private static final PageRange[] ALL_PAGES_ARRAY = new PageRange[] { PageRange.ALL_PAGES @@ -175,13 +175,19 @@ public final class PageAdapter extends Adapter implements return mPageContentRepository.getFilePageCount(); } - public void open(ParcelFileDescriptor source, Runnable callback) { + public void open(ParcelFileDescriptor source, final Runnable callback) { throwIfNotClosed(); mState = STATE_OPENED; if (DEBUG) { Log.i(LOG_TAG, "STATE_OPENED"); } - mPageContentRepository.open(source, callback); + mPageContentRepository.open(source, new Runnable() { + @Override + public void run() { + notifyDataSetChanged(); + callback.run(); + } + }); } public void update(PageRange[] writtenPages, PageRange[] selectedPages, @@ -728,8 +734,8 @@ public final class PageAdapter extends Adapter implements if (provider != null) { page.init(null, null, null, null); mPageContentRepository.releasePageContentProvider(provider); - mBoundPagesInAdapter.remove(pageIndexInAdapter); } + mBoundPagesInAdapter.remove(pageIndexInAdapter); page.setTag(null); } diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintPreviewController.java b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintPreviewController.java index 5d858ca..b999866 100644 --- a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintPreviewController.java +++ b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintPreviewController.java @@ -25,11 +25,9 @@ import android.print.PrintAttributes.MediaSize; import android.print.PrintAttributes.Margins; import android.print.PrintDocumentInfo; import android.support.v7.widget.GridLayoutManager; -import android.support.v7.widget.OrientationHelper; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView.ViewHolder; import android.support.v7.widget.RecyclerView.LayoutManager; -import android.support.v7.widget.StaggeredGridLayoutManager; import android.view.View; import com.android.internal.os.SomeArgs; import com.android.printspooler.R; @@ -132,7 +130,7 @@ class PrintPreviewController implements MutexFileProvider.OnReleaseRequestCallba public void onContentUpdated(boolean documentChanged, int documentPageCount, PageRange[] writtenPages, PageRange[] selectedPages, MediaSize mediaSize, Margins minMargins) { - boolean contentChanged = false; + boolean contentChanged = false; if (documentChanged) { contentChanged = true; @@ -153,7 +151,7 @@ class PrintPreviewController implements MutexFileProvider.OnReleaseRequestCallba // The content changed. In this case we have to invalidate // all rendered pages and reopen the file... - if (contentChanged && writtenPages != null) { + if ((contentChanged || !mPageAdapter.isOpened()) && writtenPages != null) { Message operation = mHandler.obtainMessage(MyHandler.MSG_OPEN); mHandler.enqueueOperation(operation); } |