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

Commit 373577da authored by PETER LIANG's avatar PETER LIANG Committed by Automerger Merge Worker
Browse files

Merge "Fix the tooltip view can't be adjusted under the change of display or...

Merge "Fix the tooltip view can't be adjusted under the change of display or font size." into sc-dev am: e22236ff am: d5ca9d40

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14532142

Change-Id: I5d191191e4cf2cedf9fdcaacedfc2d2013dd9e90
parents fa0e9c9f d5ca9d40
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
@@ -77,7 +77,6 @@ class BaseTooltipView extends FrameLayout {
        mAnchorView = anchorView;
        mCurrentLayoutParams = createDefaultLayoutParams();

        updateDimensions();
        initViews();
    }

@@ -85,14 +84,8 @@ class BaseTooltipView extends FrameLayout {
    protected void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);

        updateDimensions();
        updateTextView();

        mAnchorView.onConfigurationChanged(newConfig);
        final Rect anchorViewLocation = mAnchorView.getWindowLocationOnScreen();
        updateArrowWith(anchorViewLocation);
        updateWidthWith(anchorViewLocation);
        updateLocationWith(anchorViewLocation);
        updateTooltipView();

        mWindowManager.updateViewLayout(this, mCurrentLayoutParams);
    }
@@ -129,10 +122,7 @@ class BaseTooltipView extends FrameLayout {
        }

        mIsShowing = true;
        final Rect anchorViewLocation = mAnchorView.getWindowLocationOnScreen();
        updateArrowWith(anchorViewLocation);
        updateWidthWith(anchorViewLocation);
        updateLocationWith(anchorViewLocation);
        updateTooltipView();

        mWindowManager.addView(this, mCurrentLayoutParams);
    }
@@ -207,6 +197,16 @@ class BaseTooltipView extends FrameLayout {
                        R.dimen.accessibility_floating_tooltip_text_corner_radius);
    }

    private void updateTooltipView() {
        updateDimensions();
        updateTextView();

        final Rect anchorViewLocation = mAnchorView.getWindowLocationOnScreen();
        updateArrowWith(anchorViewLocation);
        updateWidthWith(anchorViewLocation);
        updateLocationWith(anchorViewLocation);
    }

    private void updateTextView() {
        mTextView.setTextSize(COMPLEX_UNIT_PX, mFontSize);
        mTextView.setPadding(mTextViewPadding, mTextViewPadding, mTextViewPadding,