summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2016-09-20 23:15:13 (GMT)
committerTony Wickham <twickham@google.com>2016-09-22 19:50:58 (GMT)
commitb318c0e396b049c134a098a3e589a0550e58c5b4 (patch)
tree9059f2875e08f86ce56597f178bc935f55407bb5
parent41253866876bc3cbb7d52cd0f28063cea7aca59d (diff)
downloadandroid_packages_apps_Trebuchet-b318c0e396b049c134a098a3e589a0550e58c5b4.zip
android_packages_apps_Trebuchet-b318c0e396b049c134a098a3e589a0550e58c5b4.tar.gz
android_packages_apps_Trebuchet-b318c0e396b049c134a098a3e589a0550e58c5b4.tar.bz2
Fade deep shorcuts in and out.
Animate open: - Stagger-fade shortcuts as they open - Become fully opaque before fully open, at which point the arrow animates in (scale). This way there is no overlap of a translucent shortcut over an opaque arrow. Animate close: - Stagger-fade shortcuts as they close - Delay fade until arrow animation is finished, to ensure there is no overlapping of translucent and opaque. This is much less visually jarring when quickly dragging and dropping apps with shortcuts. Bug: 31533078 Change-Id: I8673ee64e92414c718233ea89b70362187e53696
-rw-r--r--res/values/config.xml1
-rw-r--r--src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java32
2 files changed, 23 insertions, 10 deletions
diff --git a/res/values/config.xml b/res/values/config.xml
index 2347f66..a942f02 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -93,6 +93,7 @@
<!-- Deep shortcuts -->
<integer name="config_deepShortcutOpenDuration">220</integer>
+ <integer name="config_deepShortcutArrowOpenDuration">80</integer>
<integer name="config_deepShortcutOpenStagger">40</integer>
<integer name="config_deepShortcutCloseDuration">150</integer>
<integer name="config_deepShortcutCloseStagger">20</integer>
diff --git a/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java b/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java
index 7657ed6..daab747 100644
--- a/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java
+++ b/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java
@@ -54,6 +54,7 @@ import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherModel;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.LauncherViewPropertyAnimator;
+import com.android.launcher3.LogAccelerateInterpolator;
import com.android.launcher3.R;
import com.android.launcher3.ShortcutInfo;
import com.android.launcher3.Utilities;
@@ -228,6 +229,9 @@ public class DeepShortcutsContainer extends LinearLayout implements View.OnLongC
final long duration = getResources().getInteger(
R.integer.config_deepShortcutOpenDuration);
+ final long arrowScaleDuration = getResources().getInteger(
+ R.integer.config_deepShortcutArrowOpenDuration);
+ final long arrowScaleDelay = duration - arrowScaleDuration;
final long stagger = getResources().getInteger(
R.integer.config_deepShortcutOpenStagger);
@@ -236,6 +240,7 @@ public class DeepShortcutsContainer extends LinearLayout implements View.OnLongC
for (int i = 0; i < shortcutCount; i++) {
final DeepShortcutView deepShortcutView = getShortcutAt(i);
deepShortcutView.setVisibility(INVISIBLE);
+ deepShortcutView.setAlpha(0);
Animator anim = deepShortcutView.createOpenAnimation(mIsAboveIcon, mIsLeftAligned);
anim.addListener(new AnimatorListenerAdapter() {
@@ -249,6 +254,12 @@ public class DeepShortcutsContainer extends LinearLayout implements View.OnLongC
anim.setStartDelay(stagger * animationIndex);
anim.setInterpolator(interpolator);
shortcutAnims.play(anim);
+
+ Animator fadeAnim = new LauncherViewPropertyAnimator(deepShortcutView).alpha(1);
+ fadeAnim.setInterpolator(new LogAccelerateInterpolator(100, 0));
+ // We want the shortcut to be fully opaque before the arrow starts animating.
+ fadeAnim.setDuration(arrowScaleDelay);
+ shortcutAnims.play(fadeAnim);
}
shortcutAnims.addListener(new AnimatorListenerAdapter() {
@Override
@@ -264,8 +275,6 @@ public class DeepShortcutsContainer extends LinearLayout implements View.OnLongC
// Animate the arrow
mArrow.setScaleX(0);
mArrow.setScaleY(0);
- final long arrowScaleDelay = duration / 6;
- final long arrowScaleDuration = duration - arrowScaleDelay;
Animator arrowScale = new LauncherViewPropertyAnimator(mArrow).scaleX(1).scaleY(1);
arrowScale.setStartDelay(arrowScaleDelay);
arrowScale.setDuration(arrowScaleDuration);
@@ -611,12 +620,12 @@ public class DeepShortcutsContainer extends LinearLayout implements View.OnLongC
}
final long duration = getResources().getInteger(
R.integer.config_deepShortcutCloseDuration);
+ final long arrowScaleDuration = getResources().getInteger(
+ R.integer.config_deepShortcutArrowOpenDuration);
final long stagger = getResources().getInteger(
R.integer.config_deepShortcutCloseStagger);
- long arrowDelay = (numOpenShortcuts - 1) * stagger + (duration * 4 / 6);
int firstOpenShortcutIndex = mIsAboveIcon ? shortcutCount - numOpenShortcuts : 0;
- int shortcutWithArrowIndex = mIsAboveIcon ? (numOpenShortcuts - 1) : 0;
for (int i = firstOpenShortcutIndex; i < firstOpenShortcutIndex + numOpenShortcuts; i++) {
final DeepShortcutView view = getShortcutAt(i);
Animator anim;
@@ -625,6 +634,13 @@ public class DeepShortcutsContainer extends LinearLayout implements View.OnLongC
int animationIndex = mIsAboveIcon ? i - firstOpenShortcutIndex
: numOpenShortcuts - i - 1;
anim.setStartDelay(stagger * animationIndex);
+
+ Animator fadeAnim = new LauncherViewPropertyAnimator(view).alpha(0);
+ // Don't start fading until the arrow is gone.
+ fadeAnim.setStartDelay(stagger * animationIndex + arrowScaleDuration);
+ fadeAnim.setDuration(duration - arrowScaleDuration);
+ fadeAnim.setInterpolator(new LogAccelerateInterpolator(100, 0));
+ shortcutAnims.play(fadeAnim);
} else {
// The view is being dragged. Animate it such that it collapses with the drag view
anim = view.collapseToIcon();
@@ -643,10 +659,6 @@ public class DeepShortcutsContainer extends LinearLayout implements View.OnLongC
.translationY(mIconShift.y);
anim2.setDuration(DragView.VIEW_ZOOM_DURATION);
shortcutAnims.play(anim2);
-
- if (i == shortcutWithArrowIndex) {
- arrowDelay = 0;
- }
}
anim.addListener(new AnimatorListenerAdapter() {
@Override
@@ -657,8 +669,8 @@ public class DeepShortcutsContainer extends LinearLayout implements View.OnLongC
shortcutAnims.play(anim);
}
Animator arrowAnim = new LauncherViewPropertyAnimator(mArrow)
- .scaleX(0).scaleY(0).setDuration(duration / 6);
- arrowAnim.setStartDelay(arrowDelay);
+ .scaleX(0).scaleY(0).setDuration(arrowScaleDuration);
+ arrowAnim.setStartDelay(0);
shortcutAnims.play(arrowAnim);
shortcutAnims.addListener(new AnimatorListenerAdapter() {