am e0944ec7: am 4ff78b0b: Merge "Fixing place where offset caches weren\'t being invalidated (issue 5608330)" into ics-mr1

* commit 'e0944ec762ec42c8da56d5bffde28ecbc9e76b82':
  Fixing place where offset caches weren't being invalidated (issue 5608330)
This commit is contained in:
Adam Cohen
2011-11-15 13:07:18 -08:00
committed by Android Git Automerger
+7 -2
View File
@@ -204,7 +204,7 @@ public abstract class PagedView extends ViewGroup {
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.PagedView, defStyle, 0);
mPageSpacing = a.getDimensionPixelSize(R.styleable.PagedView_pageSpacing, 0);
setPageSpacing(a.getDimensionPixelSize(R.styleable.PagedView_pageSpacing, 0));
mPageLayoutPaddingTop = a.getDimensionPixelSize(
R.styleable.PagedView_pageLayoutPaddingTop, 0);
mPageLayoutPaddingBottom = a.getDimensionPixelSize(
@@ -557,6 +557,11 @@ public abstract class PagedView extends ViewGroup {
scrollToNewPageWithoutMovingPages(mCurrentPage);
}
public void setPageSpacing(int pageSpacing) {
mPageSpacing = pageSpacing;
invalidateCachedOffsets();
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
if (!mIsDataReady) {
@@ -574,7 +579,7 @@ public abstract class PagedView extends ViewGroup {
// Calculate the variable page spacing if necessary
if (mPageSpacing < 0) {
mPageSpacing = ((right - left) - getChildAt(0).getMeasuredWidth()) / 2;
setPageSpacing(((right - left) - getChildAt(0).getMeasuredWidth()) / 2);
}
}