Unifying multiple all-apps implementations

> Using a single layout for the all-apps content
> Removing some unnecessary themes
> Fixing search chashes in SecondaryDisplayLauncher

Bug: 259733681
Test: Existing TAPL tests verify that Launcher/AllApps work properly
Change-Id: Icd5310316499cd421bc039cdbd4d398b813cd477
This commit is contained in:
Sunny Goyal
2022-12-09 12:37:25 -08:00
parent 80872f32da
commit adb364a104
18 changed files with 158 additions and 354 deletions

View File

@@ -30,7 +30,6 @@ import androidx.recyclerview.widget.RecyclerView;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.allapps.BaseAllAppsAdapter.AdapterItem;
import com.android.launcher3.allapps.search.SearchAdapterProvider;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.views.ActivityContext;
@@ -49,12 +48,6 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
// Used to animate Search results out and A-Z apps in, or vice-versa.
private final SearchTransitionController mSearchTransitionController;
protected SearchUiManager mSearchUiManager;
/**
* View that defines the search box. Result is rendered inside the recycler view defined in the
* base class.
*/
private View mSearchContainer;
/** {@code true} when rendered view is in search state instead of the scroll state. */
private boolean mIsSearching;
private boolean mRebindAdaptersAfterSearchAnimation;
@@ -73,6 +66,12 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
mSearchTransitionController = new SearchTransitionController(this);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mSearchUiManager.initializeSearch(this);
}
public SearchUiManager getSearchUiManager() {
return mSearchUiManager;
}
@@ -142,11 +141,6 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
});
}
@Override
protected final SearchAdapterProvider<?> createMainAdapterProvider() {
return mActivityContext.createSearchAdapterProvider(this);
}
@Override
public boolean shouldContainerScroll(MotionEvent ev) {
// IF the MotionEvent is inside the search box, and the container keeps on receiving
@@ -166,14 +160,6 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
animateToSearchState(false, 0);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mSearchContainer = findViewById(R.id.search_container_all_apps);
mSearchUiManager = (SearchUiManager) mSearchContainer;
mSearchUiManager.initializeSearch(this);
}
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
mSearchUiManager.preDispatchKeyEvent(event);
@@ -278,18 +264,6 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
(int) (mSearchContainer.getAlpha() * 255));
}
@Override
public int getHeaderBottom() {
if (FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get()) {
if (mActivityContext.getDeviceProfile().isTablet) {
return super.getHeaderBottom() + mHeader.getClipTop()
+ mBottomSheetBackground.getTop();
}
return super.getHeaderBottom() + mHeader.getClipTop();
}
return super.getHeaderBottom() + mSearchContainer.getBottom();
}
private void layoutBelowSearchContainer(View v, boolean includeTabsMargin) {
if (!(v.getLayoutParams() instanceof RelativeLayout.LayoutParams)) {
return;
@@ -364,4 +338,10 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
? R.dimen.all_apps_header_pill_height
: R.dimen.all_apps_header_top_margin);
}
@Override
public boolean isInAllApps() {
// TODO: Make this abstract
return true;
}
}