Adding check before setting alpha of side pages in a PagedView to prevent constant invalidations.
Change-Id: I4fbb66a851d6cbcd916212e86ed8ba85a9226b02
This commit is contained in:
1 parent
b2c838c2eb
commit
6935ffd450
1 file changed
+3
-1
@@ -271,7 +271,9 @@ public abstract class PagedView extends ViewGroup {
|
||||
dimAlpha = (float) (distanceFromScreenCenter - halfChildWidth) / halfChildWidth;
|
||||
dimAlpha = (dimAlpha * dimAlpha);
|
||||
}
|
||||
layout.setDimmedBitmapAlpha(Math.max(0.0f, Math.min(1.0f, dimAlpha)));
|
||||
dimAlpha = Math.max(0.0f, Math.min(1.0f, dimAlpha));
|
||||
if (Float.compare(dimAlpha, layout.getDimmedBitmapAlpha()) != 0)
|
||||
layout.setDimmedBitmapAlpha(dimAlpha);
|
||||
}
|
||||
}
|
||||
super.dispatchDraw(canvas);
|
||||
|
||||
Reference in new issue
Block a user