Merge "Clean up device profile change listeners for AllApps." into udc-dev

This commit is contained in:
Brian Isganitis
2023-03-31 16:41:54 +00:00
committed by Android (Google) Code Review
3 changed files with 31 additions and 3 deletions

View File

@@ -76,7 +76,6 @@ public class PredictionRowView<T extends Context & ActivityContext>
mFocusHelper = new SimpleFocusIndicatorHelper(this);
mActivityContext = ActivityContext.lookupContext(context);
mActivityContext.addOnDeviceProfileChangeListener(this);
mNumPredictedAppsPerRow = mActivityContext.getDeviceProfile().numShownAllAppsColumns;
updateVisibility();
}
@@ -84,6 +83,13 @@ public class PredictionRowView<T extends Context & ActivityContext>
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
mActivityContext.addOnDeviceProfileChangeListener(this);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
mActivityContext.removeOnDeviceProfileChangeListener(this);
}
public void setup(FloatingHeaderView parent, FloatingHeaderRow[] rows, boolean tabsHidden) {

View File

@@ -112,12 +112,23 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
DeviceProfile dp = mActivityContext.getDeviceProfile();
setShiftRange(dp.allAppsShiftRange);
mActivityContext.addOnDeviceProfileChangeListener(this);
setContentBackgroundWithParent(
getContext().getDrawable(R.drawable.bg_rounded_corner_bottom_sheet),
mAppsView.getBottomSheetBackground());
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
mActivityContext.addOnDeviceProfileChangeListener(this);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
mActivityContext.removeOnDeviceProfileChangeListener(this);
}
@Override
protected void onScaleProgressChanged() {
super.onScaleProgressChanged();