From 0aa78a5172d5b82e84441caa6f04782161274001 Mon Sep 17 00:00:00 2001 From: WhiredPlanck Date: Mon, 30 Dec 2024 19:28:22 +0800 Subject: [PATCH] refactor: constraint the text views' height in CandidateItemUi --- .../osfans/trime/ime/candidates/CandidateItemUi.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/osfans/trime/ime/candidates/CandidateItemUi.kt b/app/src/main/java/com/osfans/trime/ime/candidates/CandidateItemUi.kt index a1d6f88165..586764099a 100644 --- a/app/src/main/java/com/osfans/trime/ime/candidates/CandidateItemUi.kt +++ b/app/src/main/java/com/osfans/trime/ime/candidates/CandidateItemUi.kt @@ -13,11 +13,14 @@ import com.osfans.trime.data.theme.FontManager import com.osfans.trime.data.theme.Theme import com.osfans.trime.ime.core.AutoScaleTextView import com.osfans.trime.util.pressHighlightDrawable +import splitties.dimensions.dp +import splitties.views.dsl.constraintlayout.bottomOfParent import splitties.views.dsl.constraintlayout.centerHorizontally import splitties.views.dsl.constraintlayout.centerVertically import splitties.views.dsl.constraintlayout.constraintLayout import splitties.views.dsl.constraintlayout.horizontalChain import splitties.views.dsl.constraintlayout.packed +import splitties.views.dsl.constraintlayout.topOfParent import splitties.views.dsl.constraintlayout.verticalChain import splitties.views.dsl.core.Ui import splitties.views.dsl.core.view @@ -63,7 +66,14 @@ class CandidateItemUi( listOf(lastText, firstText), style = packed, defaultWidth = wrapContent, - defaultHeight = wrapContent, + initFirstViewParams = { + height = dp(theme.generalStyle.commentHeight) + topOfParent() + }, + initLastViewParams = { + height = dp(theme.generalStyle.candidateViewHeight) + bottomOfParent() + }, initParams = { centerHorizontally() }, ) } else {