mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 01:16:49 +00:00
Recreate All Apps when Taskbar is recreated.
Test: Manual Fix: 222039500 Fix: 222037737 Fix: 222034811 Change-Id: I53aa3ae77d03ae2a1d500d906ad2ed90efda6f4a
This commit is contained in:
@@ -38,6 +38,7 @@ import com.android.launcher3.model.data.AppInfo;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.taskbar.TaskbarActivityContext;
|
||||
import com.android.launcher3.taskbar.TaskbarControllers;
|
||||
import com.android.launcher3.taskbar.TaskbarSharedState;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@@ -62,6 +63,7 @@ public final class TaskbarAllAppsController implements OnDeviceProfileChangeList
|
||||
private final LayoutParams mLayoutParams;
|
||||
|
||||
private TaskbarControllers mControllers;
|
||||
private TaskbarSharedState mSharedState;
|
||||
/** Window context for all apps if it is open. */
|
||||
private @Nullable TaskbarAllAppsContext mAllAppsContext;
|
||||
|
||||
@@ -77,9 +79,19 @@ public final class TaskbarAllAppsController implements OnDeviceProfileChangeList
|
||||
}
|
||||
|
||||
/** Initialize the controller. */
|
||||
public void init(TaskbarControllers controllers) {
|
||||
if (FeatureFlags.ENABLE_ALL_APPS_IN_TASKBAR.get()) {
|
||||
mControllers = controllers;
|
||||
public void init(TaskbarControllers controllers, TaskbarSharedState sharedState) {
|
||||
if (!FeatureFlags.ENABLE_ALL_APPS_IN_TASKBAR.get()) {
|
||||
return;
|
||||
}
|
||||
mControllers = controllers;
|
||||
mSharedState = sharedState;
|
||||
|
||||
/*
|
||||
* Recreate All Apps if it was open in the previous Taskbar instance (e.g. the configuration
|
||||
* changed).
|
||||
*/
|
||||
if (mSharedState.allAppsVisible) {
|
||||
show(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,10 +124,15 @@ public final class TaskbarAllAppsController implements OnDeviceProfileChangeList
|
||||
|
||||
/** Opens the {@link TaskbarAllAppsContainerView} in a new window. */
|
||||
public void show() {
|
||||
show(true);
|
||||
}
|
||||
|
||||
private void show(boolean animate) {
|
||||
if (mProxyView.isOpen()) {
|
||||
return;
|
||||
}
|
||||
mProxyView.show();
|
||||
mSharedState.allAppsVisible = true;
|
||||
|
||||
mAllAppsContext = new TaskbarAllAppsContext(mTaskbarContext,
|
||||
this,
|
||||
@@ -129,6 +146,7 @@ public final class TaskbarAllAppsController implements OnDeviceProfileChangeList
|
||||
mAllAppsContext.getAppsView().getFloatingHeaderView()
|
||||
.findFixedRowByType(PredictionRowView.class)
|
||||
.setPredictedApps(mPredictedApps);
|
||||
mAllAppsContext.getAllAppsViewController().show(animate);
|
||||
}
|
||||
|
||||
/** Closes the {@link TaskbarAllAppsContainerView}. */
|
||||
@@ -148,6 +166,12 @@ public final class TaskbarAllAppsController implements OnDeviceProfileChangeList
|
||||
return;
|
||||
}
|
||||
mProxyView.close(false);
|
||||
mSharedState.allAppsVisible = false;
|
||||
onDestroy();
|
||||
}
|
||||
|
||||
/** Destroys the controller and any All Apps window if present. */
|
||||
public void onDestroy() {
|
||||
mTaskbarContext.removeOnDeviceProfileChangeListener(this);
|
||||
Optional.ofNullable(mAllAppsContext)
|
||||
.map(c -> c.getSystemService(WindowManager.class))
|
||||
|
||||
Reference in New Issue
Block a user