Add animation for all visible pages on home screen.

When an app is opened from the home screen there's a
slight animation that was only playing on the current
page and not on all the visible pages.

Test: manual
Bug: 174464691
Change-Id: Ia32cbf6d6277882a0c33063e78acdf1ccc4a5acc
This commit is contained in:
Andras Kloczl
2021-04-27 11:19:26 +02:00
parent 3b1df8d735
commit da0e0e3c1c

View File

@@ -100,7 +100,9 @@ import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.
import com.android.systemui.shared.system.WindowManagerWrapper;
import com.android.wm.shell.startingsurface.IStartingWindowListener;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
/**
* Manages the opening and closing app transitions from Launcher
@@ -457,32 +459,29 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
alpha.setInterpolator(LINEAR);
launcherAnimator.play(alpha);
List<View> viewsToAnimate = new ArrayList<>();
Workspace workspace = mLauncher.getWorkspace();
View currentPage = ((CellLayout) workspace.getChildAt(workspace.getCurrentPage()))
.getShortcutsAndWidgets();
View hotseat = mLauncher.getHotseat();
View qsb = mLauncher.findViewById(R.id.search_container_all_apps);
workspace.getVisiblePages().forEach(
view -> viewsToAnimate.add(((CellLayout) view).getShortcutsAndWidgets()));
currentPage.setLayerType(View.LAYER_TYPE_HARDWARE, null);
hotseat.setLayerType(View.LAYER_TYPE_HARDWARE, null);
qsb.setLayerType(View.LAYER_TYPE_HARDWARE, null);
viewsToAnimate.add(mLauncher.getHotseat());
// Add QSB
viewsToAnimate.add(mLauncher.findViewById(R.id.search_container_all_apps));
launcherAnimator.play(ObjectAnimator.ofFloat(currentPage, View.TRANSLATION_Y, trans));
launcherAnimator.play(ObjectAnimator.ofFloat(hotseat, View.TRANSLATION_Y, trans));
launcherAnimator.play(ObjectAnimator.ofFloat(qsb, View.TRANSLATION_Y, trans));
viewsToAnimate.forEach(view -> {
view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
launcherAnimator.play(ObjectAnimator.ofFloat(view, View.TRANSLATION_Y, trans));
});
// Pause page indicator animations as they lead to layer trashing.
mLauncher.getWorkspace().getPageIndicator().pauseAnimations();
endListener = () -> {
currentPage.setTranslationY(0);
hotseat.setTranslationY(0);
qsb.setTranslationY(0);
currentPage.setLayerType(View.LAYER_TYPE_NONE, null);
hotseat.setLayerType(View.LAYER_TYPE_NONE, null);
qsb.setLayerType(View.LAYER_TYPE_NONE, null);
viewsToAnimate.forEach(view -> {
view.setTranslationY(0);
view.setLayerType(View.LAYER_TYPE_NONE, null);
});
mDragLayerAlpha.setValue(1f);
mLauncher.getWorkspace().getPageIndicator().skipAnimationsToEnd();
};