am c2281007: Merge "Page content sometimes missing while scrolling." into lmp-dev

* commit 'c2281007f190ab197b23484fd087c30955ffdd6b':
  Page content sometimes missing while scrolling.
This commit is contained in:
Svetoslav
2014-09-13 18:57:44 +00:00
committed by Android Git Automerger
2 changed files with 3 additions and 14 deletions

View File

@@ -345,7 +345,7 @@ public final class PageContentRepository {
Iterator<Map.Entry<Integer, RenderedPage>> iterator =
mRenderedPages.entrySet().iterator();
while (iterator.hasNext()) {
iterator.next().getValue().recycle();
iterator.next();
iterator.remove();
}
}
@@ -425,10 +425,6 @@ public final class PageContentRepository {
return content.getBitmap().getByteCount();
}
public void recycle() {
content.getBitmap().recycle();
}
public void erase() {
content.getBitmap().eraseColor(Color.WHITE);
}
@@ -738,7 +734,6 @@ public final class PageContentRepository {
+ " with different size.");
}
mPageContentCache.removeRenderedPage(mPageIndex);
mRenderedPage.recycle();
mRenderedPage = null;
}
@@ -762,7 +757,6 @@ public final class PageContentRepository {
Log.i(LOG_TAG, "Recycling bitmap for page: " + mPageIndex
+ " with different size.");
}
renderedPage.recycle();
continue;
}

View File

@@ -46,16 +46,12 @@ public class PageContentView extends View
private boolean mContentRequested;
private boolean mNeedsLayout;
public PageContentView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
mNeedsLayout = false;
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
requestPageContentIfNeeded();
}
@@ -91,7 +87,6 @@ public class PageContentView extends View
mEmptyState = emptyState;
mContentRequested = false;
mNeedsLayout = mNeedsLayout || mediaSizeChanged || marginsChanged;
// If there is no provider we want immediately to switch to
// the empty state, so pages with no content appear blank.
@@ -104,7 +99,7 @@ public class PageContentView extends View
private void requestPageContentIfNeeded() {
if (getWidth() > 0 && getHeight() > 0 && !mContentRequested
&& mProvider != null && !mNeedsLayout) {
&& mProvider != null) {
mContentRequested = true;
mProvider.getPageContent(new RenderSpec(getWidth(), getHeight(),
mMediaSize, mMinMargins), this);