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
@@ -192,7 +192,6 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
onAppsUpdated);
}
mAllAppsStore.addUpdateListener(onAppsUpdated);
mActivityContext.addOnDeviceProfileChangeListener(this);
// This is a focus listener that proxies focus from a view into the list view. This is to
// work around the search box from getting first focus and showing the cursor.
@@ -263,6 +262,18 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
mSearchUiManager.initializeSearch(this);
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
mActivityContext.addOnDeviceProfileChangeListener(this);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
mActivityContext.removeOnDeviceProfileChangeListener(this);
}
public SearchUiManager getSearchUiManager() {
return mSearchUiManager;
}