Merge "Prevent NPE inside AllAppsTransitionController" into sc-dev

This commit is contained in:
TreeHugger Robot 2021-03-08 20:21:31 +00:00 committed by Android (Google) Code Review
commit d60299e19f
1 changed files with 12 additions and 5 deletions

View File

@ -144,11 +144,14 @@ public class AllAppsTransitionController implements StateHandler<LauncherState>,
*/ */
public void setProgress(float progress) { public void setProgress(float progress) {
mProgress = progress; mProgress = progress;
mScrimView.setProgress(progress); mScrimView.setProgress(progress);
float shiftCurrent = progress * mShiftRange; float shiftCurrent = progress * mShiftRange;
mAppsView.setTranslationY(shiftCurrent); mAppsView.setTranslationY(shiftCurrent);
if (FeatureFlags.ENABLE_DEVICE_SEARCH.get() && mSearchImeEnabled) { if (FeatureFlags.ENABLE_DEVICE_SEARCH.get() && mSearchImeEnabled) {
if (mInsetController == null) {
setupInsetTransitionController();
}
mInsetController.setProgress(progress); mInsetController.setProgress(progress);
} }
} }
@ -240,13 +243,17 @@ public class AllAppsTransitionController implements StateHandler<LauncherState>,
mAppsView = appsView; mAppsView = appsView;
mScrimView = scrimView; mScrimView = scrimView;
if (FeatureFlags.ENABLE_DEVICE_SEARCH.get() && BuildCompat.isAtLeastR()) { if (FeatureFlags.ENABLE_DEVICE_SEARCH.get() && BuildCompat.isAtLeastR()) {
mInsetController = new AllAppsInsetTransitionController(mShiftRange, mAppsView); setupInsetTransitionController();
mLauncher.getSystemUiController().updateUiState(UI_STATE_ALLAPPS,
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
} }
} }
private void setupInsetTransitionController() {
mInsetController = new AllAppsInsetTransitionController(mShiftRange, mAppsView);
mLauncher.getSystemUiController().updateUiState(UI_STATE_ALLAPPS,
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
}
/** /**
* Updates the total scroll range but does not update the UI. * Updates the total scroll range but does not update the UI.
*/ */