Translate the taskbar icons to match nav handle shape.
- We need to reset icon alignment whenever icon layout bound
changes. This fixes the issue where we build an icon
alignment animator before any of the views are laid out.
- Separated animation logic between.
createTransientAnimToIsStashed and createAnimToIsStashed
* The values still require a bit more tuning but this gets us
a lot closer to spec for many of the motion polish.
Bug: 267806083
Bug: 246634367
Bug: 246635237
Test: manual
Change-Id: Id122134b22ef4e418ce632e4a8137239dc8bb313
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index edbce10..b109e8a 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -104,6 +104,10 @@
private final PointF mTranslationForReorderPreview = new PointF(0, 0);
private float mTranslationXForTaskbarAlignmentAnimation = 0f;
+ private float mTranslationYForTaskbarAlignmentAnimation = 0f;
+
+ private float mTranslationXForTaskbarRevealAnimation = 0f;
+ private float mTranslationYForTaskbarRevealAnimation = 0f;
private final PointF mTranslationForMoveFromCenterAnimation = new PointF(0, 0);
@@ -952,11 +956,17 @@
}
private void updateTranslation() {
- super.setTranslationX(mTranslationForReorderBounce.x + mTranslationForReorderPreview.x
+ super.setTranslationX(mTranslationForReorderBounce.x
+ + mTranslationForReorderPreview.x
+ mTranslationForMoveFromCenterAnimation.x
- + mTranslationXForTaskbarAlignmentAnimation);
- super.setTranslationY(mTranslationForReorderBounce.y + mTranslationForReorderPreview.y
- + mTranslationForMoveFromCenterAnimation.y);
+ + mTranslationXForTaskbarAlignmentAnimation
+ + mTranslationXForTaskbarRevealAnimation
+ );
+ super.setTranslationY(mTranslationForReorderBounce.y
+ + mTranslationForReorderPreview.y
+ + mTranslationForMoveFromCenterAnimation.y
+ + mTranslationYForTaskbarAlignmentAnimation
+ + mTranslationYForTaskbarRevealAnimation);
}
public void setReorderBounceOffset(float x, float y) {
@@ -1012,6 +1022,51 @@
return mTranslationXForTaskbarAlignmentAnimation;
}
+ /**
+ * Sets translationX for taskbar to launcher alignment animation
+ */
+ public void setTranslationYForTaskbarAlignmentAnimation(float translationY) {
+ mTranslationYForTaskbarAlignmentAnimation = translationY;
+ updateTranslation();
+ }
+
+ /**
+ * Returns translationY value for taskbar to launcher alignment animation
+ */
+ public float getTranslationYForTaskbarAlignmentAnimation() {
+ return mTranslationYForTaskbarAlignmentAnimation;
+ }
+
+ /**
+ * Sets translationX value for taskbar reveal animation
+ */
+ public void setTranslationXForTaskbarRevealAnimation(float translationX) {
+ mTranslationXForTaskbarRevealAnimation = translationX;
+ updateTranslation();
+ }
+
+ /**
+ * Returns translation values for taskbar reveal animation
+ */
+ public float getTranslationXForTaskbarRevealAnimation() {
+ return mTranslationXForTaskbarRevealAnimation;
+ }
+
+ /**
+ * Sets translationY value for taskbar reveal animation
+ */
+ public void setTranslationYForTaskbarRevealAnimation(float translationY) {
+ mTranslationYForTaskbarRevealAnimation = translationY;
+ updateTranslation();
+ }
+
+ /**
+ * Returns translationY values for taskbar reveal animation
+ */
+ public float getTranslationYForTaskbarRevealAnimation() {
+ return mTranslationYForTaskbarRevealAnimation;
+ }
+
public View getView() {
return this;
}
diff --git a/src/com/android/launcher3/folder/FolderIcon.java b/src/com/android/launcher3/folder/FolderIcon.java
index e69f781..ee1a060 100644
--- a/src/com/android/launcher3/folder/FolderIcon.java
+++ b/src/com/android/launcher3/folder/FolderIcon.java
@@ -135,6 +135,9 @@
private final PointF mTranslationForMoveFromCenterAnimation = new PointF(0, 0);
private float mTranslationXForTaskbarAlignmentAnimation = 0f;
+ private float mTranslationYForTaskbarAlignmentAnimation = 0f;
+ private float mTranslationXForTaskbarRevealAnimation = 0f;
+ private float mTranslationYForTaskbarRevealAnimation = 0f;
private final PointF mTranslationForReorderBounce = new PointF(0, 0);
private final PointF mTranslationForReorderPreview = new PointF(0, 0);
@@ -416,7 +419,7 @@
() -> {
mPreviewItemManager.hidePreviewItem(finalIndex, false);
mFolder.showItem(item);
- },
+ },
DragLayer.ANIMATION_END_DISAPPEAR, null);
mFolder.hideItem(item);
@@ -768,11 +771,15 @@
}
private void updateTranslation() {
- super.setTranslationX(mTranslationForReorderBounce.x + mTranslationForReorderPreview.x
+ super.setTranslationX(mTranslationForReorderBounce.x
+ + mTranslationForReorderPreview.x
+ mTranslationForMoveFromCenterAnimation.x
- + mTranslationXForTaskbarAlignmentAnimation);
+ + mTranslationXForTaskbarAlignmentAnimation
+ + mTranslationXForTaskbarRevealAnimation);
super.setTranslationY(mTranslationForReorderBounce.y + mTranslationForReorderPreview.y
- + mTranslationForMoveFromCenterAnimation.y);
+ + mTranslationForMoveFromCenterAnimation.y
+ + mTranslationYForTaskbarAlignmentAnimation
+ + mTranslationYForTaskbarRevealAnimation);
}
public void setReorderBounceOffset(float x, float y) {
@@ -787,7 +794,7 @@
/**
* Sets translationX value for taskbar to launcher alignment animation
*/
- public void setTranslationForTaskbarAlignmentAnimation(float translationX) {
+ public void setTranslationXForTaskbarAlignmentAnimation(float translationX) {
mTranslationXForTaskbarAlignmentAnimation = translationX;
updateTranslation();
}
@@ -800,6 +807,51 @@
}
/**
+ * Sets translationY value for taskbar to launcher alignment animation
+ */
+ public void setTranslationYForTaskbarAlignmentAnimation(float translationY) {
+ mTranslationYForTaskbarAlignmentAnimation = translationY;
+ updateTranslation();
+ }
+
+ /**
+ * Returns translation values for taskbar to launcher alignment animation
+ */
+ public float getTranslationYForTaskbarAlignmentAnimation() {
+ return mTranslationYForTaskbarAlignmentAnimation;
+ }
+
+ /**
+ * Sets translationX value for taskbar reveal animation
+ */
+ public void setTranslationXForTaskbarRevealAnimation(float translationX) {
+ mTranslationXForTaskbarRevealAnimation = translationX;
+ updateTranslation();
+ }
+
+ /**
+ * Returns translation values for taskbar reveal animation
+ */
+ public float getTranslationXForTaskbarRevealAnimation() {
+ return mTranslationXForTaskbarRevealAnimation;
+ }
+
+ /**
+ * Sets translationY value for taskbar reveal animation
+ */
+ public void setTranslationYForTaskbarRevealAnimation(float translationY) {
+ mTranslationYForTaskbarRevealAnimation = translationY;
+ updateTranslation();
+ }
+
+ /**
+ * Returns translationY values for taskbar reveal animation
+ */
+ public float getTranslationYForTaskbarRevealAnimation() {
+ return mTranslationYForTaskbarRevealAnimation;
+ }
+
+ /**
* Sets translation values for move from center animation
*/
public void setTranslationForMoveFromCenterAnimation(float x, float y) {