diff options
author | Steve Kondik <shade@chemlab.org> | 2013-02-15 14:45:54 -0800 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2013-02-15 14:45:54 -0800 |
commit | ed1816e3a828046439da5cb31a65af4641be9076 (patch) | |
tree | 994e4ed51b3e1630e338b3ec255a8f4dce429953 /src/com/cyanogenmod/trebuchet/AppsCustomizeTabHost.java | |
parent | c43d6eebe95dcabcb4ded1c4da8c6cc21d2514f5 (diff) | |
parent | 002c25eede2a33a5378c16c5bb9165179783e729 (diff) | |
download | packages_apps_trebuchet-ed1816e3a828046439da5cb31a65af4641be9076.zip packages_apps_trebuchet-ed1816e3a828046439da5cb31a65af4641be9076.tar.gz packages_apps_trebuchet-ed1816e3a828046439da5cb31a65af4641be9076.tar.bz2 |
Merge tag 'android-4.2.2_r1' of https://android.googlesource.com/platform/packages/apps/Launcher2 into treb
Android 4.2.2 release 1
Conflicts:
res/layout-land/launcher.xml
res/layout-port/launcher.xml
res/layout-sw720dp/launcher.xml
src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java
src/com/cyanogenmod/trebuchet/AppsCustomizeTabHost.java
src/com/cyanogenmod/trebuchet/CellLayout.java
src/com/cyanogenmod/trebuchet/Launcher.java
src/com/cyanogenmod/trebuchet/PagedView.java
Change-Id: I415138430337bcd21070b815a80de9c0cdd52239
Diffstat (limited to 'src/com/cyanogenmod/trebuchet/AppsCustomizeTabHost.java')
-rw-r--r-- | src/com/cyanogenmod/trebuchet/AppsCustomizeTabHost.java | 159 |
1 files changed, 84 insertions, 75 deletions
diff --git a/src/com/cyanogenmod/trebuchet/AppsCustomizeTabHost.java b/src/com/cyanogenmod/trebuchet/AppsCustomizeTabHost.java index 08d9597..067b98f 100644 --- a/src/com/cyanogenmod/trebuchet/AppsCustomizeTabHost.java +++ b/src/com/cyanogenmod/trebuchet/AppsCustomizeTabHost.java @@ -232,81 +232,87 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona post(new Runnable() { @Override public void run() { - if (mAppsCustomizePane.getMeasuredWidth() <= 0 || - mAppsCustomizePane.getMeasuredHeight() <= 0) { - reloadCurrentPage(); - return; - } - // Take the visible pages and re-parent them temporarily to mAnimatorBuffer - // and then cross fade to the new pages - int[] visiblePageRange = new int[2]; - mAppsCustomizePane.getVisiblePages(visiblePageRange); - if (visiblePageRange[0] == -1 && visiblePageRange[1] == -1) { - // If we can't get the visible page ranges, then just skip the animation - reloadCurrentPage(); - return; - } - ArrayList<View> visiblePages = new ArrayList<View>(); - for (int i = visiblePageRange[0]; i <= visiblePageRange[1]; i++) { - visiblePages.add(mAppsCustomizePane.getPageAt(i)); - } - // We want the pages to be rendered in exactly the same way as they were when - // their parent was mAppsCustomizePane -- so set the scroll on mAnimationBuffer - // to be exactly the same as mAppsCustomizePane, and below, set the left/top - // parameters to be correct for each of the pages - mAnimationBuffer.scrollTo(mAppsCustomizePane.getScrollX(), 0); - - // mAppsCustomizePane renders its children in reverse order, so - // add the pages to mAnimationBuffer in reverse order to match that behavior - for (int i = visiblePages.size() - 1; i >= 0; i--) { - View child = visiblePages.get(i); - if (child instanceof PagedViewCellLayout) { - ((PagedViewCellLayout) child).resetChildrenOnKeyListeners(); - } else if (child instanceof PagedViewGridLayout) { - ((PagedViewGridLayout) child).resetChildrenOnKeyListeners(); + if (mAppsCustomizePane.getMeasuredWidth() <= 0 || + mAppsCustomizePane.getMeasuredHeight() <= 0) { + reloadCurrentPage(); + return; } - PagedViewWidget.setDeletePreviewsWhenDetachedFromWindow(false); - mAppsCustomizePane.removeView(child); - PagedViewWidget.setDeletePreviewsWhenDetachedFromWindow(true); - mAnimationBuffer.setAlpha(1f); - mAnimationBuffer.setVisibility(View.VISIBLE); - LayoutParams p = new FrameLayout.LayoutParams(child.getMeasuredWidth(), - child.getMeasuredHeight()); - p.setMargins(child.getLeft(), child.getTop(), 0, 0); - mAnimationBuffer.addView(child, p); - - // Toggle the new content - onTabChangedStart(); - onTabChangedEnd(type); - - // Animate the transition - ObjectAnimator outAnim = LauncherAnimUtils.ofFloat(mAnimationBuffer, "alpha", 0f); - outAnim.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationEnd(Animator animation) { - mAnimationBuffer.setVisibility(View.GONE); - mAnimationBuffer.removeAllViews(); + // Take the visible pages and re-parent them temporarily to mAnimatorBuffer + // and then cross fade to the new pages + int[] visiblePageRange = new int[2]; + mAppsCustomizePane.getVisiblePages(visiblePageRange); + if (visiblePageRange[0] == -1 && visiblePageRange[1] == -1) { + // If we can't get the visible page ranges, then just skip the animation + reloadCurrentPage(); + return; } - @Override - public void onAnimationCancel(Animator animation) { - mAnimationBuffer.setVisibility(View.GONE); - mAnimationBuffer.removeAllViews(); + ArrayList<View> visiblePages = new ArrayList<View>(); + for (int i = visiblePageRange[0]; i <= visiblePageRange[1]; i++) { + visiblePages.add(mAppsCustomizePane.getPageAt(i)); } - }); - ObjectAnimator inAnim = LauncherAnimUtils.ofFloat(mAppsCustomizePane, "alpha", 1f); - inAnim.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationEnd(Animator animation) { - reloadCurrentPage(); + // We want the pages to be rendered in exactly the same way as they were when + // their parent was mAppsCustomizePane -- so set the scroll on mAnimationBuffer + // to be exactly the same as mAppsCustomizePane, and below, set the left/top + // parameters to be correct for each of the pages + mAnimationBuffer.scrollTo(mAppsCustomizePane.getScrollX(), 0); + + // mAppsCustomizePane renders its children in reverse order, so + // add the pages to mAnimationBuffer in reverse order to match that behavior + for (int i = visiblePages.size() - 1; i >= 0; i--) { + View child = visiblePages.get(i); + if (child instanceof PagedViewCellLayout) { + ((PagedViewCellLayout) child).resetChildrenOnKeyListeners(); + } else if (child instanceof PagedViewGridLayout) { + ((PagedViewGridLayout) child).resetChildrenOnKeyListeners(); + } + PagedViewWidget.setDeletePreviewsWhenDetachedFromWindow(false); + mAppsCustomizePane.removeView(child); + PagedViewWidget.setDeletePreviewsWhenDetachedFromWindow(true); + mAnimationBuffer.setAlpha(1f); + mAnimationBuffer.setVisibility(View.VISIBLE); + LayoutParams p = new FrameLayout.LayoutParams(child.getMeasuredWidth(), + child.getMeasuredHeight()); + p.setMargins(child.getLeft(), child.getTop(), 0, 0); + mAnimationBuffer.addView(child, p); } - }); - AnimatorSet animSet = LauncherAnimUtils.createAnimatorSet(); - animSet.playTogether(outAnim, inAnim); - animSet.setDuration(duration); - animSet.start(); - }} - }); - } + + // Toggle the new content + onTabChangedStart(); + onTabChangedEnd(type); + + // Animate the transition + ObjectAnimator outAnim = LauncherAnimUtils.ofFloat(mAnimationBuffer, "alpha", 0f); + outAnim.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + mAnimationBuffer.setVisibility(View.GONE); + mAnimationBuffer.removeAllViews(); + } + @Override + public void onAnimationCancel(Animator animation) { + mAnimationBuffer.setVisibility(View.GONE); + mAnimationBuffer.removeAllViews(); + } + }); + ObjectAnimator inAnim = LauncherAnimUtils.ofFloat(mAppsCustomizePane, "alpha", 1f); + inAnim.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + reloadCurrentPage(); + } + }); + + final AnimatorSet animSet = LauncherAnimUtils.createAnimatorSet(); + animSet.playTogether(outAnim, inAnim); + animSet.setDuration(duration); + post(new Runnable() { + public void run() { + animSet.start(); + } + }); + } + }); + } } public void setCurrentTabFromContent(AppsCustomizePagedView.ContentType type) { @@ -432,11 +438,9 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona } if (!toWorkspace) { - // Going from Workspace -> All Apps - setVisibilityOfSiblingsWithLowerZOrder(INVISIBLE); - - // Dismiss the workspace cling and show the all apps cling (if not already shown) + // Dismiss the workspace cling l.dismissWorkspaceCling(null); + // Show the all apps cling (if not already shown) mAppsCustomizePane.showAllAppsCling(); // Make sure adjacent pages are loaded (we wait until after the transition to // prevent slowing down the animation) @@ -445,6 +449,11 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona if (!LauncherApplication.isScreenLarge() && mFadeScrollingIndicator) { mAppsCustomizePane.hideScrollingIndicator(false); } + + // Going from Workspace -> All Apps + // NOTE: We should do this at the end since we check visibility state in some of the + // cling initialization/dismiss code above. + setVisibilityOfSiblingsWithLowerZOrder(INVISIBLE); } } |