mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-05 18:36:49 +00:00
Small optimizations for the All Apps transition
- don't set properties in animations if they don't change - don't recalculate visible pages on every frame - don't require scroll indicator to be an ImageView Change-Id: I099b29e677da2d0e401f677d47cdb8b5df51224e
This commit is contained in:
@@ -181,7 +181,7 @@ public abstract class PagedView extends ViewGroup {
|
||||
|
||||
// Scrolling indicator
|
||||
private ValueAnimator mScrollIndicatorAnimator;
|
||||
private ImageView mScrollIndicator;
|
||||
private View mScrollIndicator;
|
||||
private int mScrollIndicatorPaddingLeft;
|
||||
private int mScrollIndicatorPaddingRight;
|
||||
private boolean mHasScrollIndicator = true;
|
||||
@@ -726,19 +726,18 @@ public abstract class PagedView extends ViewGroup {
|
||||
protected void getVisiblePages(int[] range) {
|
||||
final int pageCount = getChildCount();
|
||||
if (pageCount > 0) {
|
||||
final int pageWidth = getScaledMeasuredWidth(getPageAt(0));
|
||||
final int screenWidth = getMeasuredWidth();
|
||||
int x = getScaledRelativeChildOffset(0) + pageWidth;
|
||||
int x = (int) getPageAt(0).getRight();
|
||||
int leftScreen = 0;
|
||||
int rightScreen = 0;
|
||||
while (x <= mScrollX && leftScreen < pageCount - 1) {
|
||||
leftScreen++;
|
||||
x += getScaledMeasuredWidth(getPageAt(leftScreen)) + mPageSpacing;
|
||||
x = getPageAt(leftScreen).getRight();
|
||||
}
|
||||
rightScreen = leftScreen;
|
||||
while (x < mScrollX + screenWidth && rightScreen < pageCount - 1) {
|
||||
rightScreen++;
|
||||
x += getScaledMeasuredWidth(getPageAt(rightScreen)) + mPageSpacing;
|
||||
x = (int) getPageAt(rightScreen).getRight();
|
||||
}
|
||||
range[0] = leftScreen;
|
||||
range[1] = rightScreen;
|
||||
@@ -1756,12 +1755,12 @@ public abstract class PagedView extends ViewGroup {
|
||||
}
|
||||
}
|
||||
|
||||
protected ImageView getScrollingIndicator() {
|
||||
protected View getScrollingIndicator() {
|
||||
// We use mHasScrollIndicator to prevent future lookups if there is no sibling indicator
|
||||
// found
|
||||
if (mHasScrollIndicator && mScrollIndicator == null) {
|
||||
ViewGroup parent = (ViewGroup) getParent();
|
||||
mScrollIndicator = (ImageView) (parent.findViewById(R.id.paged_view_indicator));
|
||||
mScrollIndicator = (View) (parent.findViewById(R.id.paged_view_indicator));
|
||||
mHasScrollIndicator = mScrollIndicator != null;
|
||||
if (mHasScrollIndicator) {
|
||||
mScrollIndicator.setVisibility(View.VISIBLE);
|
||||
|
||||
Reference in New Issue
Block a user