diff options
author | Svetoslav <svetoslavganov@google.com> | 2014-09-17 18:52:18 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-09-17 18:52:19 +0000 |
commit | a732950ade045cba94a7437c8d7efa17ea438953 (patch) | |
tree | a219558c3326074114d29d883bf8a7b358179173 /packages | |
parent | 36e793c73beb376c6c97275717a9ca4f848c9b51 (diff) | |
parent | 7fd5ada98aa9e035682531d9fe25633fdd24a058 (diff) | |
download | frameworks_base-a732950ade045cba94a7437c8d7efa17ea438953.zip frameworks_base-a732950ade045cba94a7437c8d7efa17ea438953.tar.gz frameworks_base-a732950ade045cba94a7437c8d7efa17ea438953.tar.bz2 |
Merge "Page content sometimes disappears when scrolling a long doc in print preview." into lmp-dev
Diffstat (limited to 'packages')
5 files changed, 10 insertions, 12 deletions
diff --git a/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java b/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java index 14c41da..0bec217 100644 --- a/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java +++ b/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java @@ -526,7 +526,7 @@ public final class PageContentRepository { callback.run(); } } - }.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR, (Void[]) null); + }.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR); } public void close(final Runnable callback) { @@ -552,7 +552,7 @@ public final class PageContentRepository { callback.run(); } } - }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void[]) null); + }.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR); } public void destroy() { @@ -571,7 +571,7 @@ public final class PageContentRepository { mPageContentCache.invalidate(); mPageContentCache.clear(); } - }.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR, (Void[]) null); + }.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR); } public void startPreload(int firstShownPage, int lastShownPage, RenderSpec renderSpec) { @@ -687,7 +687,7 @@ public final class PageContentRepository { // Oh well, we will have work to do... renderTask = new RenderPageTask(pageIndex, renderSpec, callback); mPageToRenderTaskMap.put(pageIndex, renderTask); - renderTask.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR, (Void[]) null); + renderTask.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR); } public void cancelRendering(int pageIndex) { diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java b/packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java index 369c453..84bbc27 100644 --- a/packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java +++ b/packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java @@ -275,7 +275,6 @@ public final class PageAdapter extends Adapter implements public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View page = mLayoutInflater.inflate(R.layout.preview_page, parent, false); ViewHolder holder = new MyViewHolder(page); - holder.setIsRecyclable(true); return holder; } diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java index 389988a..d169319 100644 --- a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java +++ b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java @@ -953,7 +953,7 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat // When the update is done we update the print preview. mProgressMessageController.post(); return true; - } else { + } else if (!willUpdate) { // Update preview. updatePrintPreviewController(false); } diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintPreviewController.java b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintPreviewController.java index b999866..0d45352 100644 --- a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintPreviewController.java +++ b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintPreviewController.java @@ -77,6 +77,7 @@ class PrintPreviewController implements MutexFileProvider.OnReleaseRequestCallba mRecyclerView = (RecyclerView) activity.findViewById(R.id.preview_content); mRecyclerView.setLayoutManager(mLayoutManger); mRecyclerView.setAdapter(mPageAdapter); + mRecyclerView.setItemViewCacheSize(0); mPreloadController = new PreloadController(mRecyclerView); mRecyclerView.setOnScrollListener(mPreloadController); @@ -348,8 +349,7 @@ class PrintPreviewController implements MutexFileProvider.OnReleaseRequestCallba public void startPreloadContent() { PageAdapter pageAdapter = (PageAdapter) mRecyclerView.getAdapter(); - - if (pageAdapter.isOpened()) { + if (pageAdapter != null && pageAdapter.isOpened()) { PageRange shownPages = computeShownPages(); if (shownPages != null) { pageAdapter.startPreloadContent(shownPages); @@ -359,8 +359,7 @@ class PrintPreviewController implements MutexFileProvider.OnReleaseRequestCallba public void stopPreloadContent() { PageAdapter pageAdapter = (PageAdapter) mRecyclerView.getAdapter(); - - if (pageAdapter.isOpened()) { + if (pageAdapter != null && pageAdapter.isOpened()) { pageAdapter.stopPreloadContent(); } } diff --git a/packages/PrintSpooler/src/com/android/printspooler/widget/PageContentView.java b/packages/PrintSpooler/src/com/android/printspooler/widget/PageContentView.java index 1000117..b792789 100644 --- a/packages/PrintSpooler/src/com/android/printspooler/widget/PageContentView.java +++ b/packages/PrintSpooler/src/com/android/printspooler/widget/PageContentView.java @@ -52,12 +52,12 @@ public class PageContentView extends View @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { + mContentRequested = false; requestPageContentIfNeeded(); } @Override public void onPageContentAvailable(BitmapDrawable content) { - assert (getBackground() != content); setBackground(content); } @@ -70,7 +70,7 @@ public class PageContentView extends View final boolean providerChanged = (mProvider == null) ? provider != null : !mProvider.equals(provider); final boolean loadingDrawableChanged = (mEmptyState == null) - ? mEmptyState != null : !mEmptyState.equals(emptyState); + ? emptyState != null : !mEmptyState.equals(emptyState); final boolean mediaSizeChanged = (mMediaSize == null) ? mediaSize != null : !mMediaSize.equals(mediaSize); final boolean marginsChanged = (mMinMargins == null) |