Refactor ActivityAllAppsContainerView to depend on ActivityContext.

All of the all apps search support is in this class which is also being
refactored to depend on ActivityContext. At the end of this refactor,
this class can be merged with BaseAllAppsContainerView.

Test: Manual
Bug: 216683257
Change-Id: I8cbf21c8d9ce97cc60e9846cfe8c2a7bcb800a01
This commit is contained in:
Brian Isganitis
2022-03-16 09:58:17 -07:00
parent f477ec2032
commit 5eb66d8abb
3 changed files with 18 additions and 4 deletions
@@ -216,6 +216,7 @@ public abstract class BaseDraggingActivity extends BaseActivity
* Creates and returns {@link SearchAdapterProvider} for build variant specific search result
* views
*/
@Override
public SearchAdapterProvider<?> createSearchAdapterProvider(
ActivityAllAppsContainerView<?> allApps) {
return new DefaultSearchAdapterProvider(this);
@@ -26,12 +26,13 @@ import android.widget.RelativeLayout;
import androidx.core.graphics.ColorUtils;
import androidx.recyclerview.widget.RecyclerView;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.DeviceProfile.DeviceProfileListenable;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.allapps.search.SearchAdapterProvider;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.util.PackageManagerHelper;
import com.android.launcher3.views.AppLauncher;
import java.util.Objects;
@@ -40,8 +41,8 @@ import java.util.Objects;
*
* @param <T> Type of context inflating all apps.
*/
public class ActivityAllAppsContainerView<T extends BaseDraggingActivity> extends
BaseAllAppsContainerView<T> {
public class ActivityAllAppsContainerView<T extends Context & AppLauncher
& DeviceProfileListenable> extends BaseAllAppsContainerView<T> {
protected SearchUiManager mSearchUiManager;
/**
@@ -104,7 +105,7 @@ public class ActivityAllAppsContainerView<T extends BaseDraggingActivity> extend
}
@Override
protected SearchAdapterProvider<?> createMainAdapterProvider() {
protected final SearchAdapterProvider<?> createMainAdapterProvider() {
return mActivityContext.createSearchAdapterProvider(this);
}
@@ -25,7 +25,9 @@ import android.view.View.AccessibilityDelegate;
import androidx.annotation.Nullable;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.allapps.ActivityAllAppsContainerView;
import com.android.launcher3.allapps.BaseAllAppsContainerView;
import com.android.launcher3.allapps.search.SearchAdapterProvider;
import com.android.launcher3.dot.DotInfo;
import com.android.launcher3.dragndrop.DragController;
import com.android.launcher3.folder.FolderIcon;
@@ -190,4 +192,14 @@ public interface ActivityContext {
default StringCache getStringCache() {
return null;
}
/**
* Creates and returns {@link SearchAdapterProvider} for build variant specific search result
* views.
*/
@Nullable
default SearchAdapterProvider<?> createSearchAdapterProvider(
ActivityAllAppsContainerView<?> appsView) {
return null;
}
}