Refactor all apps to depend on activity context.

The current AllAppsContainerView has been split into a base class and a
subclass for activities. The base class allows using all apps with an
activity context. A-Z and work profile tabs are supported, but search
and the hotseat still require an Activity.

Test: Manual. All apps should work the same.
Bug: 204696617
Change-Id: I3b146714bc11b3b3555d97623aab5d78ac836482
This commit is contained in:
Brian Isganitis
2022-01-14 23:15:47 -05:00
parent 46728f6481
commit 1664c9f418
26 changed files with 534 additions and 387 deletions

View File

@@ -21,13 +21,13 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH
import android.content.Context;
import android.util.AttributeSet;
import com.android.launcher3.Launcher;
import com.android.launcher3.PagedView;
import com.android.launcher3.views.ActivityContext;
import com.android.launcher3.workprofile.PersonalWorkPagedView;
/**
* A {@link PagedView} for showing different views for the personal and work profile respectively
* in the {@link AllAppsContainerView}.
* A {@link PagedView} for showing different views for the personal and work profile respectively
* in the {@link BaseAllAppsContainerView}.
*/
public class AllAppsPagedView extends PersonalWorkPagedView {
@@ -47,7 +47,7 @@ public class AllAppsPagedView extends PersonalWorkPagedView {
protected boolean snapToPageWithVelocity(int whichPage, int velocity) {
boolean resp = super.snapToPageWithVelocity(whichPage, velocity);
if (resp && whichPage != mCurrentPage) {
Launcher.getLauncher(getContext()).getStatsLogManager().logger()
ActivityContext.lookupContext(getContext()).getStatsLogManager().logger()
.log(mCurrentPage < whichPage
? LAUNCHER_ALLAPPS_SWIPE_TO_WORK_TAB
: LAUNCHER_ALLAPPS_SWIPE_TO_PERSONAL_TAB);