am 6283a125: Merge "ButtonBarLayout: Let allowStacking to be set through code" into mnc-dev

* commit '6283a12579835c39969e1f550304b899e3659c7d':
  ButtonBarLayout: Let allowStacking to be set through code
This commit is contained in:
Jason Monk
2015-06-22 20:02:19 +00:00
committed by Android Git Automerger
2 changed files with 13 additions and 1 deletions

View File

@@ -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);

View File

@@ -2315,4 +2315,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>