Merge "Recreate All Apps when Taskbar is recreated." into tm-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
1f3cc12a76
@@ -116,7 +116,7 @@ public class TaskbarControllers {
|
||||
taskbarEduController.init(this);
|
||||
taskbarPopupController.init(this);
|
||||
taskbarForceVisibleImmersiveController.init(this);
|
||||
taskbarAllAppsController.init(this);
|
||||
taskbarAllAppsController.init(this, sharedState);
|
||||
|
||||
mControllersToLog = new LoggableTaskbarController[] {
|
||||
taskbarDragController, navButtonController, navbarButtonsViewController,
|
||||
@@ -152,6 +152,7 @@ public class TaskbarControllers {
|
||||
taskbarAutohideSuspendController.onDestroy();
|
||||
taskbarPopupController.onDestroy();
|
||||
taskbarForceVisibleImmersiveController.onDestroy();
|
||||
taskbarAllAppsController.onDestroy();
|
||||
|
||||
mControllersToLog = null;
|
||||
}
|
||||
|
||||
@@ -24,4 +24,6 @@ public class TaskbarSharedState {
|
||||
|
||||
public boolean setupUIVisible = false;
|
||||
|
||||
public boolean allAppsVisible = false;
|
||||
|
||||
}
|
||||
|
||||
@@ -166,7 +166,6 @@ class TaskbarAllAppsContext extends BaseTaskbarContext {
|
||||
super.onAttachedToWindow();
|
||||
ViewTreeObserverWrapper.addOnComputeInsetsListener(
|
||||
getViewTreeObserver(), this);
|
||||
mActivity.mAllAppsViewController.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -50,17 +50,21 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarAllApp
|
||||
}
|
||||
|
||||
/** Opens the all apps view. */
|
||||
void show() {
|
||||
void show(boolean animate) {
|
||||
if (mIsOpen || mOpenCloseAnimator.isRunning()) {
|
||||
return;
|
||||
}
|
||||
mIsOpen = true;
|
||||
attachToContainer();
|
||||
|
||||
mOpenCloseAnimator.setValues(
|
||||
PropertyValuesHolder.ofFloat(TRANSLATION_SHIFT, TRANSLATION_SHIFT_OPENED));
|
||||
mOpenCloseAnimator.setInterpolator(AGGRESSIVE_EASE);
|
||||
mOpenCloseAnimator.setDuration(DEFAULT_OPEN_DURATION).start();
|
||||
if (animate) {
|
||||
mOpenCloseAnimator.setValues(
|
||||
PropertyValuesHolder.ofFloat(TRANSLATION_SHIFT, TRANSLATION_SHIFT_OPENED));
|
||||
mOpenCloseAnimator.setInterpolator(AGGRESSIVE_EASE);
|
||||
mOpenCloseAnimator.setDuration(DEFAULT_OPEN_DURATION).start();
|
||||
} else {
|
||||
mTranslationShift = TRANSLATION_SHIFT_OPENED;
|
||||
}
|
||||
}
|
||||
|
||||
/** The apps container inside this view. */
|
||||
|
||||
+2
-2
@@ -53,8 +53,8 @@ final class TaskbarAllAppsViewController {
|
||||
}
|
||||
|
||||
/** Starts the {@link TaskbarAllAppsSlideInView} enter transition. */
|
||||
void show() {
|
||||
mSlideInView.show();
|
||||
void show(boolean animate) {
|
||||
mSlideInView.show(animate);
|
||||
}
|
||||
|
||||
/** Closes the {@link TaskbarAllAppsSlideInView}. */
|
||||
|
||||
Reference in New Issue
Block a user