Merge "Making workspace->overview transition smoother" into jb-ub-now-jolly-elf

This commit is contained in:
Michael Jurka authored and Android (Google) Code Review committed 2013-11-26 13:35:40 +00:00
commit 04a231bbe4
1 file changed
+24 -22
+24 -22
View File
@@ -31,7 +31,6 @@ import android.appwidget.AppWidgetHostView;
import android.appwidget.AppWidgetProviderInfo; import android.appwidget.AppWidgetProviderInfo;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Resources; import android.content.res.Resources;
import android.content.res.TypedArray; import android.content.res.TypedArray;
@@ -55,10 +54,7 @@ import android.view.Display;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.animation.DecelerateInterpolator; import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator; import android.view.animation.Interpolator;
import android.widget.TextView; import android.widget.TextView;
@@ -2181,6 +2177,7 @@ public class Workspace extends SmoothPagedView
final View searchBar = mLauncher.getQsbBar(); final View searchBar = mLauncher.getQsbBar();
final View overviewPanel = mLauncher.getOverviewPanel(); final View overviewPanel = mLauncher.getOverviewPanel();
final View hotseat = mLauncher.getHotseat(); final View hotseat = mLauncher.getHotseat();
final View pageIndicator = getPageIndicator();
if (animated) { if (animated) {
anim.setDuration(duration); anim.setDuration(duration);
LauncherViewPropertyAnimator scale = new LauncherViewPropertyAnimator(this); LauncherViewPropertyAnimator scale = new LauncherViewPropertyAnimator(this);
@@ -2220,31 +2217,36 @@ public class Workspace extends SmoothPagedView
} }
} }
} }
ObjectAnimator pageIndicatorAlpha = null; Animator pageIndicatorAlpha = null;
if (getPageIndicator() != null) { if (pageIndicator != null) {
pageIndicatorAlpha = ObjectAnimator.ofFloat(getPageIndicator(), "alpha", pageIndicatorAlpha = new LauncherViewPropertyAnimator(pageIndicator)
finalHotseatAndPageIndicatorAlpha); .alpha(finalHotseatAndPageIndicatorAlpha).withLayer();
} else {
// create a dummy animation so we don't need to do null checks later
pageIndicatorAlpha = ValueAnimator.ofFloat(0, 0);
} }
ObjectAnimator hotseatAlpha = ObjectAnimator.ofFloat(hotseat, "alpha", Animator hotseatAlpha = new LauncherViewPropertyAnimator(hotseat)
finalHotseatAndPageIndicatorAlpha); .alpha(finalHotseatAndPageIndicatorAlpha).withLayer();
ObjectAnimator searchBarAlpha = ObjectAnimator.ofFloat(searchBar, Animator searchBarAlpha = new LauncherViewPropertyAnimator(searchBar)
"alpha", finalSearchBarAlpha); .alpha(finalSearchBarAlpha).withLayer();
ObjectAnimator overviewPanelAlpha = ObjectAnimator.ofFloat(overviewPanel, Animator overviewPanelAlpha = new LauncherViewPropertyAnimator(overviewPanel)
"alpha", finalOverviewPanelAlpha); .alpha(finalOverviewPanelAlpha).withLayer();
overviewPanelAlpha.addListener(new AlphaUpdateListener(overviewPanel)); pageIndicatorAlpha.addListener(new AlphaUpdateListener(pageIndicator));
hotseatAlpha.addListener(new AlphaUpdateListener(hotseat)); hotseatAlpha.addListener(new AlphaUpdateListener(hotseat));
searchBarAlpha.addListener(new AlphaUpdateListener(searchBar)); searchBarAlpha.addListener(new AlphaUpdateListener(searchBar));
overviewPanelAlpha.addListener(new AlphaUpdateListener(overviewPanel));
if (workspaceToOverview) { if (workspaceToOverview) {
pageIndicatorAlpha.setInterpolator(new DecelerateInterpolator(2));
hotseatAlpha.setInterpolator(new DecelerateInterpolator(2)); hotseatAlpha.setInterpolator(new DecelerateInterpolator(2));
overviewPanelAlpha.setInterpolator(null);
} else if (overviewToWorkspace) { } else if (overviewToWorkspace) {
pageIndicatorAlpha.setInterpolator(null);
hotseatAlpha.setInterpolator(null);
overviewPanelAlpha.setInterpolator(new DecelerateInterpolator(2)); overviewPanelAlpha.setInterpolator(new DecelerateInterpolator(2));
} }
searchBarAlpha.setInterpolator(null);
if (getPageIndicator() != null) {
pageIndicatorAlpha.addListener(new AlphaUpdateListener(getPageIndicator()));
}
anim.play(overviewPanelAlpha); anim.play(overviewPanelAlpha);
anim.play(hotseatAlpha); anim.play(hotseatAlpha);
@@ -2256,9 +2258,9 @@ public class Workspace extends SmoothPagedView
AlphaUpdateListener.updateVisibility(overviewPanel); AlphaUpdateListener.updateVisibility(overviewPanel);
hotseat.setAlpha(finalHotseatAndPageIndicatorAlpha); hotseat.setAlpha(finalHotseatAndPageIndicatorAlpha);
AlphaUpdateListener.updateVisibility(hotseat); AlphaUpdateListener.updateVisibility(hotseat);
if (getPageIndicator() != null) { if (pageIndicator != null) {
getPageIndicator().setAlpha(finalHotseatAndPageIndicatorAlpha); pageIndicator.setAlpha(finalHotseatAndPageIndicatorAlpha);
AlphaUpdateListener.updateVisibility(getPageIndicator()); AlphaUpdateListener.updateVisibility(pageIndicator);
} }
searchBar.setAlpha(finalSearchBarAlpha); searchBar.setAlpha(finalSearchBarAlpha);
AlphaUpdateListener.updateVisibility(searchBar); AlphaUpdateListener.updateVisibility(searchBar);