Prevent NPE inside AllAppsTransitionController

Bug: 181911438
Test: manual

Change-Id: Ia2cfe43512c0336232fc6787eb955d476280e3b8
This commit is contained in:
Hyunyoung Song 2021-03-03 08:39:34 -08:00
parent a6554759aa
commit f0988f1fb1
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) {
mProgress = progress;
mScrimView.setProgress(progress);
float shiftCurrent = progress * mShiftRange;
mAppsView.setTranslationY(shiftCurrent);
if (FeatureFlags.ENABLE_DEVICE_SEARCH.get() && mSearchImeEnabled) {
if (mInsetController == null) {
setupInsetTransitionController();
}
mInsetController.setProgress(progress);
}
}
@ -240,13 +243,17 @@ public class AllAppsTransitionController implements StateHandler<LauncherState>,
mAppsView = appsView;
mScrimView = scrimView;
if (FeatureFlags.ENABLE_DEVICE_SEARCH.get() && BuildCompat.isAtLeastR()) {
mInsetController = new AllAppsInsetTransitionController(mShiftRange, mAppsView);
mLauncher.getSystemUiController().updateUiState(UI_STATE_ALLAPPS,
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
setupInsetTransitionController();
}
}
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.
*/