Skip to content

Commit 3bc7aa8

Browse files
committed
feat(welcome-screen)added the resizable text composable
1 parent 70bab19 commit 3bc7aa8

6 files changed

Lines changed: 26 additions & 78 deletions

File tree

components/ui/bolt/src/commonMain/kotlin/app/k9mail/core/ui/compose/designsystem/atom/text/TextDisplayMediumAutoResize.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package app.k9mail.core.ui.compose.designsystem.atom.text
33
import androidx.compose.foundation.text.BasicText
44
import androidx.compose.foundation.text.TextAutoSize
55
import androidx.compose.runtime.Composable
6+
import androidx.compose.material3.Text as Material3Text
67
import androidx.compose.ui.Modifier
78
import androidx.compose.ui.graphics.Color
89
import androidx.compose.ui.text.TextStyle
@@ -18,7 +19,7 @@ fun TextDisplayMediumAutoResize(
1819
textAlign: TextAlign? = null,
1920
) {
2021
val style: TextStyle = MainTheme.typography.displayMedium
21-
BasicText(
22+
Material3Text(
2223
text = text,
2324
modifier = modifier,
2425
style = style.merge(

core/common/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ kotlin {
2424
implementation(projects.core.logging.implLegacy)
2525
implementation(projects.core.logging.api)
2626
implementation(projects.core.logging.implFile)
27-
implementation(libs.koin.compose)
2827
}
2928
getByName("commonJvmTest") {
3029
dependencies {

core/common/src/commonMain/kotlin/net/thunderbird/core/common/provider/BrandTypographyProvider.kt

Lines changed: 0 additions & 17 deletions
This file was deleted.

core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/text/TextDisplayMediumAutoResize.kt

Lines changed: 0 additions & 49 deletions
This file was deleted.

feature/onboarding/welcome/src/main/kotlin/app/k9mail/feature/onboarding/welcome/ui/WelcomeContent.kt

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,21 @@ import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonFilled
2424
import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonText
2525
import app.k9mail.core.ui.compose.designsystem.atom.text.TextBodyLarge
2626
import app.k9mail.core.ui.compose.designsystem.atom.text.TextBodySmall
27-
import app.k9mail.core.ui.compose.designsystem.atom.text.TextDisplayMedium
2827
import app.k9mail.core.ui.compose.designsystem.atom.text.TextDisplayMediumAutoResize
2928
import app.k9mail.core.ui.compose.designsystem.template.LazyColumnWithHeaderFooter
3029
import app.k9mail.core.ui.compose.designsystem.template.ResponsiveContent
3130
import app.k9mail.feature.onboarding.welcome.R
31+
import net.thunderbird.core.ui.common.window.WindowSizeClass
32+
import net.thunderbird.core.ui.common.window.WindowWidthSizeClass
33+
import net.thunderbird.core.ui.common.window.calculateWindowSizeInfo
3234
import net.thunderbird.core.ui.compose.theme2.MainTheme
3335
import org.jetbrains.compose.resources.painterResource
3436

3537
private const val CIRCLE_COLOR = 0xFFEEEEEE
3638
private const val CIRCLE_SIZE_DP = 200
39+
private const val CIRCLE_SIZE_SMALL_DP = 125
3740
private const val LOGO_SIZE_DP = 125
41+
private const val LOGO_SIZE_SMALL_DP = 80
3842

3943
@Composable
4044
internal fun WelcomeContent(
@@ -90,6 +94,19 @@ private fun WelcomeHeaderSection(
9094
private fun WelcomeLogo(
9195
modifier: Modifier = Modifier,
9296
) {
97+
val windowSizeInfo = calculateWindowSizeInfo()
98+
val isSmallScreen =
99+
windowSizeInfo.sizeClass.widthSizeClass == WindowWidthSizeClass.Small
100+
val circleSize = if (isSmallScreen) {
101+
CIRCLE_SIZE_SMALL_DP
102+
} else {
103+
CIRCLE_SIZE_DP
104+
}
105+
val logoSize = if (isSmallScreen) {
106+
LOGO_SIZE_SMALL_DP
107+
} else {
108+
LOGO_SIZE_DP
109+
}
93110
Column(
94111
modifier = modifier,
95112
horizontalAlignment = Alignment.CenterHorizontally,
@@ -98,13 +115,13 @@ private fun WelcomeLogo(
98115
modifier = Modifier
99116
.clip(CircleShape)
100117
.background(Color(CIRCLE_COLOR))
101-
.size(CIRCLE_SIZE_DP.dp),
118+
.size(circleSize.dp),
102119
) {
103120
Image(
104121
painter = painterResource(MainTheme.images.logo),
105122
contentDescription = null,
106123
modifier = Modifier
107-
.size(LOGO_SIZE_DP.dp)
124+
.size(logoSize.dp)
108125
.align(Alignment.Center),
109126
)
110127
}
@@ -135,12 +152,10 @@ private fun WelcomeTitle(
135152
modifier = modifier.padding(horizontal = MainTheme.spacings.quadruple),
136153
horizontalAlignment = Alignment.CenterHorizontally,
137154
) {
138-
UsingBrandTypography {
139-
TextDisplayMediumAutoResize(
140-
text = title,
141-
textAlign = TextAlign.Center,
142-
)
143-
}
155+
TextDisplayMediumAutoResize(
156+
text = title,
157+
textAlign = TextAlign.Center,
158+
)
144159
}
145160
}
146161

gradle/libs.versions.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,6 @@ junit = { module = "junit:junit", version.ref = "junit" }
255255
jutf7 = { module = "com.beetstra.jutf7:jutf7", version.ref = "jutf7" }
256256
jzlib = { module = "com.jcraft:jzlib", version.ref = "jzlib" }
257257
koin-bom = { module = "io.insert-koin:koin-bom", version.ref = "koinBom" }
258-
koin-compose = { module = "io.insert-koin:koin-compose" }
259258
koin-core = { module = "io.insert-koin:koin-core" }
260259
koin-core-viewmodel = { module = "io.insert-koin:koin-core-viewmodel" }
261260
koin-compose-viewmodel = { module = "io.insert-koin:koin-compose-viewmodel" }

0 commit comments

Comments
 (0)