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

Commit 8c1b02e7 authored by Adam Powell's avatar Adam Powell
Browse files

Fix MediaRouteActionProvider button sizing

Bug 6768999

Use proper layout height for MediaRouteButtons generated from
MediaRouteActionProvider.

Update ActionMenuView's LayoutParams handling to correctly propagate
width/height values if the supplied LayoutParams is of a different
type.

Change-Id: I1e1b250d873869ca27f59ffb06ccf2299d57b40d
parent 41a48e4a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.util.Log;
import android.view.ActionProvider;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;

import java.lang.ref.WeakReference;

@@ -82,6 +83,8 @@ public class MediaRouteActionProvider extends ActionProvider {
        mView = new MediaRouteButton(mContext);
        mView.setRouteTypes(mRouteTypes);
        mView.setExtendedSettingsClickListener(mExtendedSettingsListener);
        mView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.MATCH_PARENT));
        return mView;
    }

+8 −2
Original line number Diff line number Diff line
@@ -489,8 +489,10 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo

    @Override
    protected LayoutParams generateLayoutParams(ViewGroup.LayoutParams p) {
        if (p instanceof LayoutParams) {
            LayoutParams result = new LayoutParams((LayoutParams) p);
        if (p != null) {
            final LayoutParams result = p instanceof LayoutParams
                    ? new LayoutParams((LayoutParams) p)
                    : new LayoutParams(p);
            if (result.gravity <= Gravity.NO_GRAVITY) {
                result.gravity = Gravity.CENTER_VERTICAL;
            }
@@ -563,6 +565,10 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo
            super(c, attrs);
        }

        public LayoutParams(ViewGroup.LayoutParams other) {
            super(other);
        }

        public LayoutParams(LayoutParams other) {
            super((LinearLayout.LayoutParams) other);
            isOverflowButton = other.isOverflowButton;