Merge "Fixing overview scrim not initialized properly when launcher starts" into ub-launcher3-qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
061c43eb4f
+6
-16
@@ -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();
|
||||
}
|
||||
|
||||
+1
-7
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user