mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 16:26:47 +00:00
Add unfold animation to launcher icons and widgets
Adds unfold animation to launcher which translates icons and widgets from the center to the sides on foldable devices. Bug: 193794541 Test: manual Change-Id: I9d6e018a0451d342f02dddea47bc180781c31d43
This commit is contained in:
@@ -49,6 +49,8 @@ public abstract class NavigableAppWidgetHostView extends AppWidgetHostView
|
||||
*/
|
||||
private final PointF mTranslationForCentering = new PointF(0, 0);
|
||||
|
||||
private final PointF mTranslationForMoveFromCenterAnimation = new PointF(0, 0);
|
||||
|
||||
private final PointF mTranslationForReorderBounce = new PointF(0, 0);
|
||||
private final PointF mTranslationForReorderPreview = new PointF(0, 0);
|
||||
private float mScaleForReorderBounce = 1f;
|
||||
@@ -167,9 +169,9 @@ public abstract class NavigableAppWidgetHostView extends AppWidgetHostView
|
||||
|
||||
private void updateTranslation() {
|
||||
super.setTranslationX(mTranslationForReorderBounce.x + mTranslationForReorderPreview.x
|
||||
+ mTranslationForCentering.x);
|
||||
+ mTranslationForCentering.x + mTranslationForMoveFromCenterAnimation.x);
|
||||
super.setTranslationY(mTranslationForReorderBounce.y + mTranslationForReorderPreview.y
|
||||
+ mTranslationForCentering.y);
|
||||
+ mTranslationForCentering.y + mTranslationForMoveFromCenterAnimation.y);
|
||||
}
|
||||
|
||||
public void setTranslationForCentering(float x, float y) {
|
||||
@@ -177,6 +179,11 @@ public abstract class NavigableAppWidgetHostView extends AppWidgetHostView
|
||||
updateTranslation();
|
||||
}
|
||||
|
||||
public void setTranslationForMoveFromCenterAnimation(float x, float y) {
|
||||
mTranslationForMoveFromCenterAnimation.set(x, y);
|
||||
updateTranslation();
|
||||
}
|
||||
|
||||
public void setReorderBounceOffset(float x, float y) {
|
||||
mTranslationForReorderBounce.set(x, y);
|
||||
updateTranslation();
|
||||
|
||||
Reference in New Issue
Block a user