|
@@ -20,6 +20,8 @@ import android.view.View
|
|
import android.view.View.MeasureSpec.AT_MOST
|
|
import android.view.View.MeasureSpec.AT_MOST
|
|
import android.view.View.MeasureSpec.EXACTLY
|
|
import android.view.View.MeasureSpec.EXACTLY
|
|
import android.view.View.MeasureSpec.UNSPECIFIED
|
|
import android.view.View.MeasureSpec.UNSPECIFIED
|
|
|
|
+import android.view.View.MeasureSpec.getSize
|
|
|
|
+import android.view.View.MeasureSpec.makeMeasureSpec
|
|
import android.widget.FrameLayout
|
|
import android.widget.FrameLayout
|
|
import com.afollestad.materialdialogs.MaterialDialog
|
|
import com.afollestad.materialdialogs.MaterialDialog
|
|
import com.afollestad.materialdialogs.R
|
|
import com.afollestad.materialdialogs.R
|
|
@@ -78,20 +80,20 @@ internal class DialogLayout(
|
|
widthMeasureSpec: Int,
|
|
widthMeasureSpec: Int,
|
|
heightMeasureSpec: Int
|
|
heightMeasureSpec: Int
|
|
) {
|
|
) {
|
|
- val specWidth = MeasureSpec.getSize(widthMeasureSpec)
|
|
|
|
- var specHeight = MeasureSpec.getSize(heightMeasureSpec)
|
|
|
|
|
|
+ val specWidth = getSize(widthMeasureSpec)
|
|
|
|
+ var specHeight = getSize(heightMeasureSpec)
|
|
if (specHeight > maxHeight) {
|
|
if (specHeight > maxHeight) {
|
|
specHeight = maxHeight
|
|
specHeight = maxHeight
|
|
}
|
|
}
|
|
|
|
|
|
titleLayout.measure(
|
|
titleLayout.measure(
|
|
- MeasureSpec.makeMeasureSpec(specWidth, EXACTLY),
|
|
|
|
- MeasureSpec.makeMeasureSpec(0, UNSPECIFIED)
|
|
|
|
|
|
+ makeMeasureSpec(specWidth, EXACTLY),
|
|
|
|
+ makeMeasureSpec(0, UNSPECIFIED)
|
|
)
|
|
)
|
|
if (buttonsLayout.shouldBeVisible()) {
|
|
if (buttonsLayout.shouldBeVisible()) {
|
|
buttonsLayout.measure(
|
|
buttonsLayout.measure(
|
|
- MeasureSpec.makeMeasureSpec(specWidth, EXACTLY),
|
|
|
|
- MeasureSpec.makeMeasureSpec(0, UNSPECIFIED)
|
|
|
|
|
|
+ makeMeasureSpec(specWidth, EXACTLY),
|
|
|
|
+ makeMeasureSpec(0, UNSPECIFIED)
|
|
)
|
|
)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -99,22 +101,14 @@ internal class DialogLayout(
|
|
titleLayout.measuredHeight + buttonsLayout.measuredHeight
|
|
titleLayout.measuredHeight + buttonsLayout.measuredHeight
|
|
val remainingHeight = specHeight - titleAndButtonsHeight
|
|
val remainingHeight = specHeight - titleAndButtonsHeight
|
|
contentView.measure(
|
|
contentView.measure(
|
|
- MeasureSpec.makeMeasureSpec(specWidth, EXACTLY),
|
|
|
|
- MeasureSpec.makeMeasureSpec(remainingHeight, AT_MOST)
|
|
|
|
|
|
+ makeMeasureSpec(specWidth, EXACTLY),
|
|
|
|
+ makeMeasureSpec(remainingHeight, AT_MOST)
|
|
)
|
|
)
|
|
|
|
|
|
val totalHeight = titleLayout.measuredHeight +
|
|
val totalHeight = titleLayout.measuredHeight +
|
|
contentView.measuredHeight +
|
|
contentView.measuredHeight +
|
|
buttonsLayout.measuredHeight
|
|
buttonsLayout.measuredHeight
|
|
setMeasuredDimension(specWidth, totalHeight)
|
|
setMeasuredDimension(specWidth, totalHeight)
|
|
-
|
|
|
|
- Log.d(
|
|
|
|
- "MaterialDialogs",
|
|
|
|
- "DialogLayout.onMeasure($specWidth, $totalHeight)\n" +
|
|
|
|
- "\ttitleHeight = ${titleLayout.measuredHeight}, " +
|
|
|
|
- "\tcontentHeight = ${contentView.measuredHeight}, " +
|
|
|
|
- "\tbuttonsHeight = ${buttonsLayout.measuredHeight}"
|
|
|
|
- )
|
|
|
|
}
|
|
}
|
|
|
|
|
|
override fun onLayout(
|
|
override fun onLayout(
|