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

Commit 8acbc2c2 authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Use context from root view to inflate children"

parents 54eec29b 0bf56663
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -458,10 +458,10 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
        lp.windowAnimations = 0;
        lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC;

        LayoutInflater layoutInflater = LayoutInflater.from(mContext);
        NavigationBarFrame frame = (NavigationBarFrame) layoutInflater.inflate(
        NavigationBarFrame frame = (NavigationBarFrame) LayoutInflater.from(mContext).inflate(
                R.layout.navigation_bar_window, null);
        View barView = layoutInflater.inflate(R.layout.navigation_bar, frame);
        View barView = LayoutInflater.from(frame.getContext()).inflate(
                R.layout.navigation_bar, frame);
        barView.addOnAttachStateChangeListener(this);

        if (DEBUG) Log.v(TAG, "addNavigationBar: about to add " + barView);
+10 −23
Original line number Diff line number Diff line
@@ -329,8 +329,7 @@ public class NavigationBarView extends FrameLayout implements

        mOverviewProxyService = Dependency.get(OverviewProxyService.class);
        mFloatingRotationButton = new FloatingRotationButton(context);
        // TODO(165014649): Temporarily disable onboarding
        // mRecentsOnboarding = new RecentsOnboarding(context, mOverviewProxyService);
        mRecentsOnboarding = new RecentsOnboarding(context, mOverviewProxyService);
        mRotationButtonController = new RotationButtonController(mLightContext,
                mLightIconColor, mDarkIconColor,
                isGesturalMode ? mFloatingRotationButton : rotateSuggestionButton,
@@ -886,9 +885,7 @@ public class NavigationBarView extends FrameLayout implements
        mNavBarMode = mode;
        mBarTransitions.onNavigationModeChanged(mNavBarMode);
        mEdgeBackGestureHandler.onNavigationModeChanged(mNavBarMode);
        if (mRecentsOnboarding != null) {
        mRecentsOnboarding.onNavigationModeChanged(mNavBarMode);
        }

        if (isGesturalMode(mNavBarMode)) {
            mRegionSamplingHelper.start(mSamplingBounds);
@@ -904,10 +901,8 @@ public class NavigationBarView extends FrameLayout implements
    }

    void hideRecentsOnboarding() {
        if (mRecentsOnboarding != null) {
        mRecentsOnboarding.hide(true);
    }
    }

    @Override
    public void onFinishInflate() {
@@ -954,10 +949,8 @@ public class NavigationBarView extends FrameLayout implements
        super.onLayout(changed, left, top, right, bottom);

        notifyActiveTouchRegions();
        if (mRecentsOnboarding != null) {
        mRecentsOnboarding.setNavBarHeight(getMeasuredHeight());
    }
    }

    /**
     * Notifies the overview service of the active touch regions.
@@ -1118,9 +1111,7 @@ public class NavigationBarView extends FrameLayout implements
        boolean uiCarModeChanged = updateCarMode();
        updateIcons(mTmpLastConfiguration);
        updateRecentsIcon();
        if (mRecentsOnboarding != null) {
        mRecentsOnboarding.onConfigurationChanged(mConfiguration);
        }
        if (uiCarModeChanged || mTmpLastConfiguration.densityDpi != mConfiguration.densityDpi
                || mTmpLastConfiguration.getLayoutDirection() != mConfiguration.getLayoutDirection()) {
            // If car mode or density changes, we need to reset the icons.
@@ -1210,14 +1201,12 @@ public class NavigationBarView extends FrameLayout implements
    }

    private void setUpSwipeUpOnboarding(boolean connectedToOverviewProxy) {
        if (mRecentsOnboarding != null) {
        if (connectedToOverviewProxy) {
            mRecentsOnboarding.onConnectedToLauncher();
        } else {
            mRecentsOnboarding.onDisconnectedFromLauncher();
        }
    }
    }

    public void dump(PrintWriter pw) {
        final Rect r = new Rect();
@@ -1261,9 +1250,7 @@ public class NavigationBarView extends FrameLayout implements
            mNavigationInflaterView.dump(pw);
        }
        mContextualButtonGroup.dump(pw);
        if (mRecentsOnboarding != null) {
        mRecentsOnboarding.dump(pw);
        }
        mRegionSamplingHelper.dump(pw);
        mEdgeBackGestureHandler.dump(pw);
    }