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

@@ -41,6 +41,7 @@ import com.android.systemui.plugins.AllAppsRow.OnHeightUpdatedListener;
import com.android.systemui.plugins.PluginListener;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class FloatingHeaderView extends LinearLayout implements
@@ -72,7 +73,8 @@ public class FloatingHeaderView extends LinearLayout implements
moved(current);
applyVerticalMove();
if (headerCollapsed != mHeaderCollapsed) {
AllAppsContainerView parent = (AllAppsContainerView) getParent();
BaseAllAppsContainerView<?> parent =
(BaseAllAppsContainerView<?>) getParent();
parent.invalidateHeader();
}
}
@@ -195,7 +197,7 @@ public class FloatingHeaderView extends LinearLayout implements
updateExpectedHeight();
if (mMaxTranslation != oldMaxHeight) {
AllAppsContainerView parent = (AllAppsContainerView) getParent();
BaseAllAppsContainerView<?> parent = (BaseAllAppsContainerView<?>) getParent();
if (parent != null) {
parent.setupHeader();
}
@@ -224,7 +226,8 @@ public class FloatingHeaderView extends LinearLayout implements
return super.getFocusedChild();
}
public void setup(AllAppsContainerView.AdapterHolder[] mAH, boolean tabsHidden) {
<T extends Context & ActivityContext> void setup(
List<BaseAllAppsContainerView<T>.AdapterHolder> mAH, boolean tabsHidden) {
for (FloatingHeaderRow row : mAllRows) {
row.setup(this, mAllRows, tabsHidden);
}
@@ -232,8 +235,10 @@ public class FloatingHeaderView extends LinearLayout implements
mTabsHidden = tabsHidden;
mTabLayout.setVisibility(tabsHidden ? View.GONE : View.VISIBLE);
mMainRV = setupRV(mMainRV, mAH[AllAppsContainerView.AdapterHolder.MAIN].recyclerView);
mWorkRV = setupRV(mWorkRV, mAH[AllAppsContainerView.AdapterHolder.WORK].recyclerView);
mMainRV = setupRV(mMainRV,
mAH.get(BaseAllAppsContainerView.AdapterHolder.MAIN).mRecyclerView);
mWorkRV = setupRV(mWorkRV,
mAH.get(BaseAllAppsContainerView.AdapterHolder.WORK).mRecyclerView);
mParent = (ViewGroup) mMainRV.getParent();
setMainActive(mMainRVActive || mWorkRV == null);
reset(false);