From d7b532afcb1b52156371dd162b2599ae9b9fbb61 Mon Sep 17 00:00:00 2001 From: Holly Sun Date: Thu, 25 Apr 2024 14:37:12 -0700 Subject: [PATCH] [reset] Clean up ActivityAllAppsContainerView#reset. Digged into the history of this part, some code is duplicated and thus removed. See https://docs.google.com/document/d/1mp1HwLhkLE_o0o_InhntFz3oIGsg94b9XucAal0IgOE/edit?tab=t.0#bookmark=id.130cyqeojzrk ag/24198780 introduced the `MAIN_EXECUTOR.getHandler().post` part, which is still needed for logging purpose. Bug: 328505782 Test: manual Flag: NA Change-Id: Ie7622c497b803f722fd734d30c4c3d9692d152c6 --- .../launcher3/allapps/ActivityAllAppsContainerView.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java index 2f623e2637..079264103d 100644 --- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java @@ -18,6 +18,7 @@ package com.android.launcher3.allapps; import static com.android.launcher3.Flags.enableExpandingPauseWorkButton; import static com.android.launcher3.allapps.ActivityAllAppsContainerView.AdapterHolder.MAIN; import static com.android.launcher3.allapps.ActivityAllAppsContainerView.AdapterHolder.SEARCH; +import static com.android.launcher3.allapps.ActivityAllAppsContainerView.AdapterHolder.WORK; import static com.android.launcher3.allapps.BaseAllAppsAdapter.VIEW_TYPE_PRIVATE_SPACE_HEADER; import static com.android.launcher3.allapps.BaseAllAppsAdapter.VIEW_TYPE_WORK_DISABLED_CARD; import static com.android.launcher3.allapps.BaseAllAppsAdapter.VIEW_TYPE_WORK_EDU_CARD; @@ -470,8 +471,9 @@ public class ActivityAllAppsContainerView * @param exitSearch Whether to force exit the search state and return to A-Z apps list. */ public void reset(boolean animate, boolean exitSearch) { + // Scroll Main and Work RV to top. Search RV is done in `resetSearch`. for (int i = 0; i < mAH.size(); i++) { - if (mAH.get(i).mRecyclerView != null) { + if (i != SEARCH && mAH.get(i).mRecyclerView != null) { mAH.get(i).mRecyclerView.scrollToTop(); } } @@ -485,10 +487,8 @@ public class ActivityAllAppsContainerView // Reset the base recycler view after transitioning home. updateHeaderScroll(0); if (exitSearch) { - // Reset the search bar after transitioning home. + // Reset the search bar and search RV after transitioning home. MAIN_EXECUTOR.getHandler().post(mSearchUiManager::resetSearch); - // Animate to A-Z with 0 time to reset the animation with proper state management. - animateToSearchState(false, 0); } if (isSearching()) { mWorkManager.reset();