Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d43d7c37 authored by Brian Isganitis's avatar Brian Isganitis
Browse files

Clean up device profile change listeners for AllApps.

Test: https://b.corp.google.com/issues/260177372#comment1
Bug: 260177372
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:d17261029af89ef03b860686d1d3c6651e7c8e13)
Merged-In: Ic7417980e8280bf2fcb110e5de74ea2ae59d9b74
Change-Id: Ic7417980e8280bf2fcb110e5de74ea2ae59d9b74
parent 90259a6d
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -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) {
+10 −0
Original line number Diff line number Diff line
@@ -99,10 +99,20 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla

        DeviceProfile dp = mActivityContext.getDeviceProfile();
        setShiftRange(dp.allAppsShiftRange);
    }

    @Override
    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        mActivityContext.addOnDeviceProfileChangeListener(this);
    }

    @Override
    protected void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        mActivityContext.removeOnDeviceProfileChangeListener(this);
    }

    @Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {
        super.onLayout(changed, l, t, r, b);
+12 −1
Original line number Diff line number Diff line
@@ -191,7 +191,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.
@@ -262,6 +261,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;
    }