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

Commit 9dccff08 authored by Alan Viverette's avatar Alan Viverette Committed by Android (Google) Code Review
Browse files

Merge "Unhide PopupWindow.getMaxAvailableHeight(View, int, boolean)"

parents 615480f0 b854d07a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -40917,6 +40917,7 @@ package android.widget {
    method public int getInputMethodMode();
    method public int getMaxAvailableHeight(android.view.View);
    method public int getMaxAvailableHeight(android.view.View, int);
    method public int getMaxAvailableHeight(android.view.View, int, boolean);
    method public boolean getOverlapAnchor();
    method public int getSoftInputMode();
    method public int getWidth();
+1 −0
Original line number Diff line number Diff line
@@ -43526,6 +43526,7 @@ package android.widget {
    method public int getInputMethodMode();
    method public int getMaxAvailableHeight(android.view.View);
    method public int getMaxAvailableHeight(android.view.View, int);
    method public int getMaxAvailableHeight(android.view.View, int, boolean);
    method public boolean getOverlapAnchor();
    method public int getSoftInputMode();
    method public int getWidth();
+9 −7
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.widget;

import com.android.internal.R;

import android.annotation.NonNull;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
@@ -1504,7 +1505,7 @@ public class PopupWindow {
     * @return The maximum available height for the popup to be completely
     *         shown.
     */
    public int getMaxAvailableHeight(View anchor) {
    public int getMaxAvailableHeight(@NonNull View anchor) {
        return getMaxAvailableHeight(anchor, 0);
    }

@@ -1519,7 +1520,7 @@ public class PopupWindow {
     * @return The maximum available height for the popup to be completely
     *         shown.
     */
    public int getMaxAvailableHeight(View anchor, int yOffset) {
    public int getMaxAvailableHeight(@NonNull View anchor, int yOffset) {
        return getMaxAvailableHeight(anchor, yOffset, false);
    }

@@ -1537,20 +1538,21 @@ public class PopupWindow {
     *        bottom decorations
     * @return The maximum available height for the popup to be completely
     *         shown.
     *
     * @hide Pending API council approval.
     */
    public int getMaxAvailableHeight(View anchor, int yOffset, boolean ignoreBottomDecorations) {
    public int getMaxAvailableHeight(
            @NonNull View anchor, int yOffset, boolean ignoreBottomDecorations) {
        final Rect displayFrame = new Rect();
        anchor.getWindowVisibleDisplayFrame(displayFrame);

        final int[] anchorPos = mDrawingLocation;
        anchor.getLocationOnScreen(anchorPos);

        int bottomEdge = displayFrame.bottom;
        final int bottomEdge;
        if (ignoreBottomDecorations) {
            Resources res = anchor.getContext().getResources();
            final Resources res = anchor.getContext().getResources();
            bottomEdge = res.getDisplayMetrics().heightPixels;
        } else {
            bottomEdge = displayFrame.bottom;
        }

        final int distanceToBottom;