ButtonBarLayout: Let allowStacking to be set through code
Bug: 21997648
Change-Id: I7ac38d39b4aa282f59b7d13f21d06c7c465ebb20
diff --git a/core/java/com/android/internal/widget/ButtonBarLayout.java b/core/java/com/android/internal/widget/ButtonBarLayout.java
index 39613e8..3b7bce4 100644
--- a/core/java/com/android/internal/widget/ButtonBarLayout.java
+++ b/core/java/com/android/internal/widget/ButtonBarLayout.java
@@ -31,7 +31,7 @@
*/
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 @@
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);
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 295251c..fb403f5 100755
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -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>