diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2019-05-30 14:23:30 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2019-05-31 11:00:35 -0700 |
commit | 03d32ddb2358f1cbd3886dd41b69b4cc5ce21d75 (patch) | |
tree | d0022701a8b41eab0f449e072e31e00786fc59bb /quickstep/recents_ui_overrides/src | |
parent | f36e5e002a3e01505fe58a3ab4c07d73b4b0c268 (diff) | |
download | android_packages_apps_Trebuchet-03d32ddb2358f1cbd3886dd41b69b4cc5ce21d75.tar.gz android_packages_apps_Trebuchet-03d32ddb2358f1cbd3886dd41b69b4cc5ce21d75.tar.bz2 android_packages_apps_Trebuchet-03d32ddb2358f1cbd3886dd41b69b4cc5ce21d75.zip |
Fixing overview scrim not initialized properly when launcher starts
State UI depends on visible content, which can change due to predicitons.
Reapplying the state whenever then happens ensures that we are in correct
start UI
Change-Id: I9f195a92b747fda8a5b217dc960f230d7a695255
Diffstat (limited to 'quickstep/recents_ui_overrides/src')
2 files changed, 7 insertions, 23 deletions
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java index 4a486f8e5..cb5cbddd4 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java @@ -164,13 +164,6 @@ public class PredictionRowView extends LinearLayout implements mParent = parent; } - private void setPredictionsEnabled(boolean predictionsEnabled) { - if (predictionsEnabled != mPredictionsEnabled) { - mPredictionsEnabled = predictionsEnabled; - updateVisibility(); - } - } - private void updateVisibility() { setVisibility(mPredictionsEnabled ? VISIBLE : GONE); } @@ -220,8 +213,7 @@ public class PredictionRowView extends LinearLayout implements * If the number of predicted apps is the same as the previous list of predicted apps, * we can optimize by swapping them in place. */ - public void setPredictedApps(boolean predictionsEnabled, List<ComponentKeyMapper> apps) { - setPredictionsEnabled(predictionsEnabled); + public void setPredictedApps(List<ComponentKeyMapper> apps) { mPredictedAppComponents.clear(); mPredictedAppComponents.addAll(apps); @@ -237,11 +229,6 @@ public class PredictionRowView extends LinearLayout implements } private void applyPredictionApps() { - if (!mPredictionsEnabled) { - mParent.onHeightUpdated(); - return; - } - if (getChildCount() != mNumPredictedAppsPerRow) { while (getChildCount() > mNumPredictedAppsPerRow) { removeViewAt(0); @@ -282,8 +269,11 @@ public class PredictionRowView extends LinearLayout implements } } - if (predictionCount == 0) { - setPredictionsEnabled(false); + boolean predictionsEnabled = predictionCount > 0; + if (predictionsEnabled != mPredictionsEnabled) { + mPredictionsEnabled = predictionsEnabled; + mLauncher.reapplyUi(); + updateVisibility(); } mParent.onHeightUpdated(); } diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java index 64cb4b465..085bbc4a5 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java @@ -177,16 +177,10 @@ public class PredictionUiStateManager implements OnGlobalLayoutListener, ItemInf } private void applyState(PredictionState state) { - boolean wasEnabled = mCurrentState.isEnabled; mCurrentState = state; if (mAppsView != null) { mAppsView.getFloatingHeaderView().findFixedRowByType(PredictionRowView.class) - .setPredictedApps(mCurrentState.isEnabled, mCurrentState.apps); - - if (wasEnabled != mCurrentState.isEnabled) { - // Reapply state as the State UI might have changed. - Launcher.getLauncher(mAppsView.getContext()).getStateManager().reapplyState(true); - } + .setPredictedApps(mCurrentState.apps); } } |