mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 01:16:49 +00:00
Close taskbar all apps when task stack changes.
Test: Manual Fix: 223898952 Change-Id: I4c5e41227f0ee199cc08931f4532d769f376a617
This commit is contained in:
@@ -39,6 +39,8 @@ 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 com.android.systemui.shared.system.TaskStackChangeListener;
|
||||
import com.android.systemui.shared.system.TaskStackChangeListeners;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@@ -62,6 +64,13 @@ public final class TaskbarAllAppsController implements OnDeviceProfileChangeList
|
||||
private final TaskbarAllAppsProxyView mProxyView;
|
||||
private final LayoutParams mLayoutParams;
|
||||
|
||||
private final TaskStackChangeListener mTaskStackListener = new TaskStackChangeListener() {
|
||||
@Override
|
||||
public void onTaskStackChanged() {
|
||||
mProxyView.close(false);
|
||||
}
|
||||
};
|
||||
|
||||
private TaskbarControllers mControllers;
|
||||
private TaskbarSharedState mSharedState;
|
||||
/** Window context for all apps if it is open. */
|
||||
@@ -139,6 +148,7 @@ public final class TaskbarAllAppsController implements OnDeviceProfileChangeList
|
||||
mControllers.taskbarStashController);
|
||||
mAllAppsContext.getDragController().init(mControllers);
|
||||
mTaskbarContext.addOnDeviceProfileChangeListener(this);
|
||||
TaskStackChangeListeners.getInstance().registerTaskStackListener(mTaskStackListener);
|
||||
Optional.ofNullable(mAllAppsContext.getSystemService(WindowManager.class))
|
||||
.ifPresent(m -> m.addView(mAllAppsContext.getDragLayer(), mLayoutParams));
|
||||
|
||||
@@ -172,6 +182,7 @@ public final class TaskbarAllAppsController implements OnDeviceProfileChangeList
|
||||
|
||||
/** Destroys the controller and any All Apps window if present. */
|
||||
public void onDestroy() {
|
||||
TaskStackChangeListeners.getInstance().unregisterTaskStackListener(mTaskStackListener);
|
||||
mTaskbarContext.removeOnDeviceProfileChangeListener(this);
|
||||
Optional.ofNullable(mAllAppsContext)
|
||||
.map(c -> c.getSystemService(WindowManager.class))
|
||||
|
||||
Reference in New Issue
Block a user