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

Commit 5658328d authored by Jason Monk's avatar Jason Monk
Browse files

ButtonBarLayout: Let allowStacking to be set through code

Bug: 21997648
Change-Id: I7ac38d39b4aa282f59b7d13f21d06c7c465ebb20
parent b1891b3f
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ import com.android.internal.R;
 */
public class ButtonBarLayout extends LinearLayout {
    /** Whether the current configuration allows stacking. */
    private final boolean mAllowStacking;
    private boolean mAllowStacking;

    private int mLastWidthSize = -1;

@@ -43,6 +43,16 @@ public class ButtonBarLayout extends LinearLayout {
        ta.recycle();
    }

    public void setAllowStacking(boolean allowStacking) {
        if (mAllowStacking != allowStacking) {
            mAllowStacking = allowStacking;
            if (!mAllowStacking && getOrientation() == LinearLayout.VERTICAL) {
                setStacked(false);
            }
            requestLayout();
        }
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        final int widthSize = MeasureSpec.getSize(widthMeasureSpec);
+2 −0
Original line number Diff line number Diff line
@@ -2314,4 +2314,6 @@
  <java-symbol type="plurals" name="selected_count" />
  <java-symbol type="drawable" name="ic_dialog_alert_material" />

  <java-symbol type="bool" name="allow_stacked_button_bar" />

</resources>