This repository was archived by the owner on Sep 3, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
core/src/main/java/com/afollestad/materialdialogs Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ import androidx.annotation.RestrictTo
29
29
import androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP
30
30
import com.afollestad.materialdialogs.R
31
31
import com.afollestad.materialdialogs.utils.MDUtil.dimenPx
32
+ import com.afollestad.materialdialogs.utils.MDUtil.maybeSetAdditionalPadding
32
33
import com.afollestad.materialdialogs.utils.isNotVisible
33
34
import com.afollestad.materialdialogs.utils.isRtl
34
35
import com.afollestad.materialdialogs.utils.isVisible
@@ -114,6 +115,7 @@ class DialogTitleLayout(
114
115
val titleHalfHeight = titleView.measuredHeight / 2
115
116
val titleTop = contentMidPoint - titleHalfHeight
116
117
val titleBottom = contentMidPoint + titleHalfHeight
118
+ + titleView.maybeSetAdditionalPadding(titleView.measuredHeight)
117
119
var titleLeft: Int
118
120
var titleRight: Int
119
121
Original file line number Diff line number Diff line change @@ -234,6 +234,12 @@ object MDUtil {
234
234
}
235
235
}
236
236
237
+ @RestrictTo(LIBRARY_GROUP ) fun TextView.maybeSetAdditionalPadding (height : Int ): Int {
238
+ val fm = paint.fontMetrics
239
+ val textHeight = fm.descent - fm.ascent
240
+ return if (textHeight > height) (textHeight - height).toInt() else 0
241
+ }
242
+
237
243
@RestrictTo(LIBRARY_GROUP ) inline fun Int?.ifNotZero (block : (value: Int ) -> Unit ) {
238
244
if (this != null && this != 0 ) {
239
245
block(this )
You can’t perform that action at this time.
0 commit comments