Revert "Revert "Speed up All Apps -> Workspace transition""

- also, undo enabling hardware layers for
    scroll indicator, which could have caused
    slowness
- fix bug where scroll indicator was not seen
    after the first visit to all apps
- eliminate a some needless hardware layer redraws
- making items under All Apps invisible when we're
    in All Apps
- making workspace spaces invisible if their alpha is 0
    to prevent more hardware layer rebuilding

This reverts commit 9753d13c7b.

Change-Id: Ib908ae0b456b2d4b8a171991a95f20aea4749da1
This commit is contained in:
Michael Jurka
2012-02-14 22:51:29 -08:00
parent 3a58b88901
commit bed61d22bd
5 changed files with 145 additions and 88 deletions

View File

@@ -347,38 +347,46 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
/* LauncherTransitionable overrides */
@Override
public void onLauncherTransitionStart(Launcher l, Animator animation, boolean toWorkspace) {
public void onLauncherTransitionStart(Launcher l, boolean animated, boolean toWorkspace) {
mInTransition = true;
boolean animated = (animation != null);
mContent.setVisibility(VISIBLE);
if (toWorkspace) {
// Going from All Apps -> Workspace
setVisibilityOfSiblingsWithLowerZOrder(VISIBLE);
} else {
// Going from Workspace -> All Apps
mContent.setVisibility(VISIBLE);
if (!toWorkspace) {
// Make sure the current page is loaded (we start loading the side pages after the
// transition to prevent slowing down the animation)
mAppsCustomizePane.loadAssociatedPages(mAppsCustomizePane.getCurrentPage(), true);
}
if (animated) {
enableAndBuildHardwareLayer();
if (!LauncherApplication.isScreenLarge()) {
mAppsCustomizePane.showScrollingIndicator(true);
}
}
if (!toWorkspace && !LauncherApplication.isScreenLarge()) {
mAppsCustomizePane.showScrollingIndicator(false);
}
if (mResetAfterTransition) {
mAppsCustomizePane.reset();
mResetAfterTransition = false;
}
if (animated) {
enableAndBuildHardwareLayer();
}
}
@Override
public void onLauncherTransitionEnd(Launcher l, Animator animation, boolean toWorkspace) {
public void onLauncherTransitionEnd(Launcher l, boolean animated, boolean toWorkspace) {
mInTransition = false;
if (animation != null) {
if (animated) {
setLayerType(LAYER_TYPE_NONE, null);
}
if (!toWorkspace) {
// Going from Workspace -> All Apps
setVisibilityOfSiblingsWithLowerZOrder(INVISIBLE);
// Dismiss the workspace cling and show the all apps cling (if not already shown)
l.dismissWorkspaceCling(null);
mAppsCustomizePane.showAllAppsCling();
@@ -392,6 +400,26 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
}
}
private void setVisibilityOfSiblingsWithLowerZOrder(int visibility) {
ViewGroup parent = (ViewGroup) getParent();
final int count = parent.getChildCount();
if (!isChildrenDrawingOrderEnabled()) {
for (int i = 0; i < count; i++) {
final View child = parent.getChildAt(i);
if (child == this) {
break;
} else {
if (child.getVisibility() == GONE) {
continue;
}
child.setVisibility(visibility);
}
}
} else {
throw new RuntimeException("Failed; can't get z-order of views");
}
}
public void onWindowVisible() {
if (getVisibility() == VISIBLE) {
mContent.setVisibility(VISIBLE);