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

Commit f8f0c8ea authored by Adam Powell's avatar Adam Powell Committed by Android (Google) Code Review
Browse files

Merge "Fix measurement issues with Spinner and ListPopupWindow"

parents ebc34f82 7507d3d3
Loading
Loading
Loading
Loading
+21 −1
Original line number Diff line number Diff line
@@ -1080,6 +1080,8 @@ public class ListPopupWindow {
            if (!mDropDownVerticalOffsetSet) {
                mDropDownVerticalOffset = -mTempRect.top;
            }
        } else {
            mTempRect.setEmpty();
        }

        // Max height available on the screen for a popup.
@@ -1092,7 +1094,25 @@ public class ListPopupWindow {
            return maxHeight + padding;
        }

        final int listContent = mDropDownList.measureHeightOfChildren(MeasureSpec.UNSPECIFIED,
        final int childWidthSpec;
        switch (mDropDownWidth) {
            case ViewGroup.LayoutParams.WRAP_CONTENT:
                childWidthSpec = MeasureSpec.makeMeasureSpec(
                        mContext.getResources().getDisplayMetrics().widthPixels -
                        (mTempRect.left + mTempRect.right),
                        MeasureSpec.AT_MOST);
                break;
            case ViewGroup.LayoutParams.MATCH_PARENT:
                childWidthSpec = MeasureSpec.makeMeasureSpec(
                        mContext.getResources().getDisplayMetrics().widthPixels -
                        (mTempRect.left + mTempRect.right),
                        MeasureSpec.EXACTLY);
                break;
            default:
                childWidthSpec = MeasureSpec.makeMeasureSpec(mDropDownWidth, MeasureSpec.EXACTLY);
                break;
        }
        final int listContent = mDropDownList.measureHeightOfChildren(childWidthSpec,
                0, ListView.NO_POSITION, maxHeight - otherHeights, -1);
        // add padding only if the list has items in it, that way we don't show
        // the popup if it is not needed
+0 −1
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ import android.database.DataSetObserver;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;