Polishing the AllApps transition

-> separating HW layers during animation to be siblings
   instead of parent-child (was destroying parent layer
   on each frame)
-> Unifying material transition with pre-L, everything
   is the same, just missing the reveal.

Change-Id: I8f7d5e658c2d9298bea83ce8199cb35e6fc0d44e
This commit is contained in:
Adam Cohen
2014-07-21 17:44:06 -07:00
parent 6075170b83
commit 9bfdb76aaf
7 changed files with 189 additions and 273 deletions
@@ -213,6 +213,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
int mWidgetLoadingId = -1;
PendingAddWidgetInfo mCreateWidgetInfo = null;
private boolean mDraggingWidget = false;
boolean mPageBackgroundsVisible;
private Toast mWidgetInstructionToast;
@@ -1003,12 +1004,26 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
int heightSpec = MeasureSpec.makeMeasureSpec(mContentHeight, MeasureSpec.AT_MOST);
layout.setMinimumWidth(getPageContentWidth());
layout.measure(widthSpec, heightSpec);
layout.setPadding(mAllAppsPadding.left, mAllAppsPadding.top, mAllAppsPadding.right,
mAllAppsPadding.bottom);
setVisibilityOnChildren(layout, View.VISIBLE);
Resources res = getContext().getResources();
layout.setBackground(res.getDrawable(R.drawable.quantum_panel));
Drawable bg = res.getDrawable(R.drawable.quantum_panel);
if (bg != null) {
layout.setBackground(bg);
bg.setVisible(mPageBackgroundsVisible, false);
}
setVisibilityOnChildren(layout, View.VISIBLE);
}
public void setPageBackgroundsVisible(boolean visible) {
mPageBackgroundsVisible = visible;
int childCount = getChildCount();
for (int i = 0; i < childCount; ++i) {
Drawable bg = getChildAt(i).getBackground();
if (bg != null) {
bg.setVisible(visible, false);
}
}
}
public void syncAppsPageItems(int page, boolean immediate) {
@@ -1438,24 +1453,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
v.setRotationY(0f);
}
}
// TODO: clean this up
alpha = 1;
translationX = 0;
scale = 1;
v.setTranslationX(translationX);
v.setScaleX(scale);
v.setScaleY(scale);
v.setAlpha(alpha);
// If the view has 0 alpha, we set it to be invisible so as to prevent
// it from accepting touches
if (alpha == 0) {
v.setVisibility(INVISIBLE);
} else if (v.getVisibility() != VISIBLE) {
v.setVisibility(VISIBLE);
}
}
}