Browse Source

Action button stacking layout tweaks, may help with #1697

Aidan Follestad 6 years ago
parent
commit
f2f8362c54

+ 12 - 1
core/src/main/java/com/afollestad/materialdialogs/internal/button/DialogActionButtonLayout.kt

@@ -134,8 +134,19 @@ internal class DialogActionButtonLayout(
       for (button in visibleButtons) {
         totalWidth += button.measuredWidth + buttonSpacing
       }
-      if (totalWidth >= parentWidth) {
+      if (totalWidth >= parentWidth && !stackButtons) {
         stackButtons = true
+        for (button in visibleButtons) {
+          button.measure(
+              makeMeasureSpec(parentWidth, EXACTLY),
+              makeMeasureSpec(buttonHeightStacked, EXACTLY)
+          )
+          button.update(
+              baseContext = baseContext,
+              appContext = appContext,
+              stacked = true
+          )
+        }
       }
     }