am 4ff78b0b: Merge "Fixing place where offset caches weren\'t being invalidated (issue 5608330)" into ics-mr1
* commit '4ff78b0b1231f9cffdaa17d8747bac7f4561372e': Fixing place where offset caches weren't being invalidated (issue 5608330)
This commit is contained in:
commit
e0944ec762
1 file changed
+7
-2
@@ -204,7 +204,7 @@ public abstract class PagedView extends ViewGroup {
|
|||||||
|
|
||||||
TypedArray a = context.obtainStyledAttributes(attrs,
|
TypedArray a = context.obtainStyledAttributes(attrs,
|
||||||
R.styleable.PagedView, defStyle, 0);
|
R.styleable.PagedView, defStyle, 0);
|
||||||
mPageSpacing = a.getDimensionPixelSize(R.styleable.PagedView_pageSpacing, 0);
|
setPageSpacing(a.getDimensionPixelSize(R.styleable.PagedView_pageSpacing, 0));
|
||||||
mPageLayoutPaddingTop = a.getDimensionPixelSize(
|
mPageLayoutPaddingTop = a.getDimensionPixelSize(
|
||||||
R.styleable.PagedView_pageLayoutPaddingTop, 0);
|
R.styleable.PagedView_pageLayoutPaddingTop, 0);
|
||||||
mPageLayoutPaddingBottom = a.getDimensionPixelSize(
|
mPageLayoutPaddingBottom = a.getDimensionPixelSize(
|
||||||
@@ -557,6 +557,11 @@ public abstract class PagedView extends ViewGroup {
|
|||||||
scrollToNewPageWithoutMovingPages(mCurrentPage);
|
scrollToNewPageWithoutMovingPages(mCurrentPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setPageSpacing(int pageSpacing) {
|
||||||
|
mPageSpacing = pageSpacing;
|
||||||
|
invalidateCachedOffsets();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||||
if (!mIsDataReady) {
|
if (!mIsDataReady) {
|
||||||
@@ -574,7 +579,7 @@ public abstract class PagedView extends ViewGroup {
|
|||||||
|
|
||||||
// Calculate the variable page spacing if necessary
|
// Calculate the variable page spacing if necessary
|
||||||
if (mPageSpacing < 0) {
|
if (mPageSpacing < 0) {
|
||||||
mPageSpacing = ((right - left) - getChildAt(0).getMeasuredWidth()) / 2;
|
setPageSpacing(((right - left) - getChildAt(0).getMeasuredWidth()) / 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user