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

Commit 97213902 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Update BubbleExpandedView inset & height" into qt-r1-bubbles-dev

parents c7eda6fa 8fe411d7
Loading
Loading
Loading
Loading
+12 −11
Original line number Diff line number Diff line
@@ -193,7 +193,8 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList
        mPm = context.getPackageManager();
        mDisplaySize = new Point();
        WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
        wm.getDefaultDisplay().getSize(mDisplaySize);
        // Get the real size -- this includes screen decorations (notches, statusbar, navbar).
        wm.getDefaultDisplay().getRealSize(mDisplaySize);
        Resources res = getResources();
        mMinHeight = res.getDimensionPixelSize(R.dimen.bubble_expanded_default_height);
        mPointerMargin = res.getDimensionPixelSize(R.dimen.bubble_pointer_margin);
@@ -313,12 +314,10 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList
     */
    void updateInsets(WindowInsets insets) {
        if (usingActivityView()) {
            int[] windowLocation = mActivityView.getLocationOnScreen();
            final int windowBottom = windowLocation[1] + mActivityView.getHeight();
            final int keyboardHeight = insets.getSystemWindowInsetBottom()
                    - insets.getStableInsetBottom();
            final int insetsBottom = Math.max(0,
                    windowBottom + keyboardHeight - mDisplaySize.y);
            int[] screenLoc = mActivityView.getLocationOnScreen();
            final int activityViewBottom = screenLoc[1] + mActivityView.getHeight();
            final int keyboardTop = mDisplaySize.y - insets.getSystemWindowInsetBottom();
            final int insetsBottom = Math.max(activityViewBottom - keyboardTop, 0);
            mActivityView.setForwardedInsets(Insets.of(0, 0, 0, insetsBottom));
        }
    }
@@ -415,10 +414,8 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList
            Log.d(TAG, "updateHeight: bubble=" + getBubbleKey());
        }
        if (usingActivityView()) {
            int max = getMaxExpandedHeight() - mSettingsIconHeight - mPointerHeight
                    - mPointerMargin;
            float desiredHeight = Math.max(mBubble.getDesiredHeight(mContext), mMinHeight);
            float height = Math.min(desiredHeight, max);
            float height = Math.min(desiredHeight, getMaxExpandedHeight());
            height = Math.max(height, mMinHeight);
            LayoutParams lp = (LayoutParams) mActivityView.getLayoutParams();
            mNeedsNewHeight =  lp.height != height;
@@ -438,7 +435,11 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList

    private int getMaxExpandedHeight() {
        int[] windowLocation = mActivityView.getLocationOnScreen();
        return mDisplaySize.y - windowLocation[1] - mSettingsIconHeight;
        int bottomInset = getRootWindowInsets() != null
                ? getRootWindowInsets().getStableInsetBottom()
                : 0;
        return mDisplaySize.y - windowLocation[1] - mSettingsIconHeight - mPointerHeight
                - mPointerMargin - bottomInset;
    }

    /**
+0 −8
Original line number Diff line number Diff line
@@ -408,14 +408,6 @@ public class BubbleStackView extends FrameLayout {
            if (!mIsExpanded || mIsExpansionAnimating) {
                return view.onApplyWindowInsets(insets);
            }

            float newY = getExpandedViewY();
            if (newY < 0) {
                // TODO: This means our expanded content is too big to fit on screen. Right now
                // we'll let it translate off but we should be clipping it & pushing the header
                // down so that it always remains visible.
            }
            mExpandedViewYAnim.animateToFinalPosition(newY);
            mExpandedAnimationController.updateYPosition(
                    // Update the insets after we're done translating otherwise position
                    // calculation for them won't be correct.