Merge "[reset] Clean up ActivityAllAppsContainerView#reset." into main

This commit is contained in:
Holly Jiuyu Sun
2024-05-03 00:49:26 +00:00
committed by Android (Google) Code Review

View File

@@ -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<T extends Context & ActivityContext>
* @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<T extends Context & ActivityContext>
// 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();