summaryrefslogtreecommitdiffstats
path: root/quickstep
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2019-01-09 16:00:31 -0800
committerSunny Goyal <sunnygoyal@google.com>2019-01-09 16:19:09 -0800
commit276fb35bd9591568ac0c252a6495b4cc8b81fdf6 (patch)
treeca6f1416acb3770d44a440006f304ad14e65a050 /quickstep
parent238f324ebff31ecb7151a7a94955c857ca8e33de (diff)
downloadandroid_packages_apps_Trebuchet-276fb35bd9591568ac0c252a6495b4cc8b81fdf6.tar.gz
android_packages_apps_Trebuchet-276fb35bd9591568ac0c252a6495b4cc8b81fdf6.tar.bz2
android_packages_apps_Trebuchet-276fb35bd9591568ac0c252a6495b4cc8b81fdf6.zip
Avoiding new view creation and additional layout during app launch
Change-Id: Ia9589b70bcdc64a2174b52aabaa1ab392800a081
Diffstat (limited to 'quickstep')
-rw-r--r--quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java23
1 files changed, 15 insertions, 8 deletions
diff --git a/quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java b/quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java
index 46886c963..cb5152a5c 100644
--- a/quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java
+++ b/quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java
@@ -443,7 +443,16 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag
private void playIconAnimators(AnimatorSet appOpenAnimator, View v, Rect windowTargetBounds,
boolean toggleVisibility) {
final boolean isBubbleTextView = v instanceof BubbleTextView;
- mFloatingView = new View(mLauncher);
+ if (mFloatingView == null) {
+ mFloatingView = new View(mLauncher);
+ } else {
+ mFloatingView.setTranslationX(0);
+ mFloatingView.setTranslationY(0);
+ mFloatingView.setScaleX(1);
+ mFloatingView.setScaleY(1);
+ mFloatingView.setAlpha(1);
+ mFloatingView.setBackground(null);
+ }
if (isBubbleTextView && v.getTag() instanceof ItemInfoWithIcon ) {
// Create a copy of the app icon
mFloatingView.setBackground(DrawableFactory.INSTANCE.get(mLauncher)
@@ -481,19 +490,17 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag
: viewLocationLeft;
LayoutParams lp = new LayoutParams(rect.width(), rect.height());
lp.ignoreInsets = true;
- lp.setMarginStart(viewLocationStart);
+ lp.leftMargin = viewLocationStart;
lp.topMargin = viewLocationTop;
mFloatingView.setLayoutParams(lp);
// Set the properties here already to make sure they'are available when running the first
// animation frame.
- mFloatingView.setLeft(viewLocationLeft);
- mFloatingView.setTop(viewLocationTop);
- mFloatingView.setRight(viewLocationLeft + rect.width());
- mFloatingView.setBottom(viewLocationTop + rect.height());
+ mFloatingView.layout(viewLocationLeft, viewLocationTop,
+ viewLocationLeft + rect.width(), viewLocationTop + rect.height());
// Swap the two views in place.
- ((ViewGroup) mDragLayer.getParent()).addView(mFloatingView);
+ ((ViewGroup) mDragLayer.getParent()).getOverlay().add(mFloatingView);
if (toggleVisibility) {
v.setVisibility(View.INVISIBLE);
}
@@ -562,7 +569,7 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag
((BubbleTextView) v).setStayPressed(false);
}
v.setVisibility(View.VISIBLE);
- ((ViewGroup) mDragLayer.getParent()).removeView(mFloatingView);
+ ((ViewGroup) mDragLayer.getParent()).getOverlay().remove(mFloatingView);
}
});
}