summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaj Yengisetty <rajesh@cyngn.com>2014-07-08 20:39:13 (GMT)
committerRaj Yengisetty <rajesh@cyngn.com>2014-07-08 21:35:11 (GMT)
commit31cc95a06e7a8bbbf7e9978d03adbba219f8bd2d (patch)
tree3b12f047399341850738828af9ffb3b841a28580
parent37bab8f1d631ffbe491f1d8858b159d65f3a9afc (diff)
downloadandroid_packages_apps_Trebuchet-31cc95a06e7a8bbbf7e9978d03adbba219f8bd2d.zip
android_packages_apps_Trebuchet-31cc95a06e7a8bbbf7e9978d03adbba219f8bd2d.tar.gz
android_packages_apps_Trebuchet-31cc95a06e7a8bbbf7e9978d03adbba219f8bd2d.tar.bz2
Smooth out slide in/out animation for the overview panel
Change-Id: I742d2248b7cf70767f9e776d88db6fc1aaa767ce
-rw-r--r--res/anim/drop_down.xml13
-rw-r--r--src/com/android/launcher3/Workspace.java59
2 files changed, 45 insertions, 27 deletions
diff --git a/res/anim/drop_down.xml b/res/anim/drop_down.xml
deleted file mode 100644
index 49059a0..0000000
--- a/res/anim/drop_down.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:interpolator="@android:interpolator/accelerate_decelerate">
- <scale
- android:fromXScale="1.0"
- android:toXScale="1.0"
- android:fromYScale="2.5"
- android:toYScale="1.0"
- android:pivotX="50%"
- android:pivotY="50%"
- android:duration="300"
- android:fillBefore="false" />
-</set>
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 3464790..15187e9 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -56,6 +56,7 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityManager;
+import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.DecelerateInterpolator;
@@ -2321,14 +2322,14 @@ public class Workspace extends SmoothPagedView
float finalBackgroundAlpha = (stateIsSpringLoaded || stateIsOverview) ? 1.0f : 0f;
float finalBackgroundAlphaMultiplier = (stateIsSpringLoaded || stateIsOverview || mShowOutlines) ? 1.0f : 0f;
float finalHotseatAndPageIndicatorAlpha = (stateIsOverview || stateIsSmall) ? 0f : 1f;
- float finalOverviewPanelAlpha = stateIsOverview ? 1f : 0f;
+ final float finalOverviewPanelAlpha = stateIsOverview ? 1f : 0f;
float finalSearchBarAlpha = !stateIsNormal ? 0f : 1f;
float finalWorkspaceTranslationY = stateIsOverview ? getOverviewModeTranslationY() : 0;
boolean workspaceToAllApps = (oldStateIsNormal && stateIsSmall);
boolean allAppsToWorkspace = (oldStateIsSmall && stateIsNormal);
- boolean workspaceToOverview = (oldStateIsNormal && stateIsOverview);
- boolean overviewToWorkspace = (oldStateIsOverview && stateIsNormal);
+ final boolean workspaceToOverview = (oldStateIsNormal && stateIsOverview);
+ final boolean overviewToWorkspace = (oldStateIsOverview && stateIsNormal);
mNewScale = 1.0f;
@@ -2486,26 +2487,56 @@ public class Workspace extends SmoothPagedView
.alpha(finalSearchBarAlpha).withLayer();
if (mShowSearchBar) searchBarAlpha.addListener(new AlphaUpdateListener(searchBar));
- Animator overviewPanelAlpha = new LauncherViewPropertyAnimator(overviewPanel)
- .alpha(finalOverviewPanelAlpha).withLayer();
- overviewPanelAlpha.addListener(new AlphaUpdateListener(overviewPanel));
-
if (workspaceToOverview) {
pageIndicatorAlpha.setInterpolator(new DecelerateInterpolator(2));
hotseatAlpha.setInterpolator(new DecelerateInterpolator(2));
- overviewPanelAlpha.setInterpolator(null);
} else if (overviewToWorkspace) {
pageIndicatorAlpha.setInterpolator(null);
hotseatAlpha.setInterpolator(null);
- overviewPanelAlpha.setInterpolator(new DecelerateInterpolator(2));
}
searchBarAlpha.setInterpolator(null);
- overviewPanel.setAlpha(finalOverviewPanelAlpha);
- AlphaUpdateListener.updateVisibility(overviewPanel);
- Animation animation = AnimationUtils.loadAnimation(mLauncher, R.anim.drop_down);
- overviewPanel.startAnimation(animation);
- anim.play(hotseatAlpha);
+ float mOverviewPanelSlideScale = 1.0f;
+
+ if (overviewToWorkspace) {
+ overviewPanel.setScaleY(1.0f);
+ mOverviewPanelSlideScale = 2.0f;
+ } else if (workspaceToOverview) {
+ overviewPanel.setScaleY(2.0f);
+ mOverviewPanelSlideScale = 1.0f;
+ }
+ LauncherViewPropertyAnimator overviewPanelScale = new LauncherViewPropertyAnimator(overviewPanel);
+ overviewPanelScale.scaleY(mOverviewPanelSlideScale)
+ .alpha(finalOverviewPanelAlpha)
+ .setInterpolator(new AccelerateDecelerateInterpolator());
+ overviewPanelScale.addListener(new AnimatorListener() {
+ @Override
+ public void onAnimationStart(Animator animation) {
+ if (workspaceToOverview) {
+ overviewPanel.setAlpha(finalOverviewPanelAlpha);
+ AlphaUpdateListener.updateVisibility(overviewPanel);
+ }
+
+ }
+
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ if (overviewToWorkspace) {
+ overviewPanel.setAlpha(finalOverviewPanelAlpha);
+ AlphaUpdateListener.updateVisibility(overviewPanel);
+ }
+ }
+
+ @Override
+ public void onAnimationCancel(Animator animation) {
+ overviewPanel.setAlpha(finalOverviewPanelAlpha);
+ AlphaUpdateListener.updateVisibility(overviewPanel);
+ }
+ @Override
+ public void onAnimationRepeat(Animator animation) {}
+ });
+ anim.play(overviewPanelScale);
+
if (mShowSearchBar) anim.play(searchBarAlpha);
anim.play(pageIndicatorAlpha);
anim.setStartDelay(delay);