[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
This commit is contained in:
Holly Sun
2024-04-25 14:37:12 -07:00
parent a3009176a9
commit d7b532afcb

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();