Skip to content

Commit f4ab905

Browse files
committed
Fix IME padding issues in specific screens and update Material version
This commit introduces the following changes: - Updates the Material library from version 1.12.0 to 1.13.0. - Adds `ImePaddingConfig.ONLY_CONTENT` to `DocumentOfferCodeScreen`, `BiometricScreen`, and `PinScreen` to ensure content is correctly padded when the keyboard is visible. - Modifies `ContentScreen.kt` to handle different IME padding configurations: - `NO_PADDING`: No IME padding is applied. - `WITH_BOTTOM_BAR`: Applies IME padding to the bottom bar. - `ONLY_CONTENT`: Applies IME padding to the main content area.
1 parent c78e215 commit f4ab905

File tree

5 files changed

+32
-3
lines changed

5 files changed

+32
-3
lines changed

common-feature/src/main/java/eu/europa/ec/commonfeature/ui/biometric/BiometricScreen.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import eu.europa.ec.uilogic.component.AppIcons
4646
import eu.europa.ec.uilogic.component.content.ContentHeader
4747
import eu.europa.ec.uilogic.component.content.ContentHeaderConfig
4848
import eu.europa.ec.uilogic.component.content.ContentScreen
49+
import eu.europa.ec.uilogic.component.content.ImePaddingConfig
4950
import eu.europa.ec.uilogic.component.content.ScreenNavigateAction
5051
import eu.europa.ec.uilogic.component.preview.PreviewTheme
5152
import eu.europa.ec.uilogic.component.preview.ThemeModePreviews
@@ -89,7 +90,8 @@ fun BiometricScreen(
8990
onBack = {
9091
viewModel.setEvent(Event.OnNavigateBack)
9192
},
92-
contentErrorConfig = state.error
93+
contentErrorConfig = state.error,
94+
imePaddingConfig = ImePaddingConfig.ONLY_CONTENT
9395
) {
9496
Body(
9597
state = state,

common-feature/src/main/java/eu/europa/ec/commonfeature/ui/pin/PinScreen.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import eu.europa.ec.resourceslogic.R
4545
import eu.europa.ec.uilogic.component.AppIconAndText
4646
import eu.europa.ec.uilogic.component.AppIconAndTextDataUi
4747
import eu.europa.ec.uilogic.component.content.ContentScreen
48+
import eu.europa.ec.uilogic.component.content.ImePaddingConfig
4849
import eu.europa.ec.uilogic.component.preview.PreviewTheme
4950
import eu.europa.ec.uilogic.component.preview.ThemeModePreviews
5051
import eu.europa.ec.uilogic.component.utils.SPACING_LARGE
@@ -87,6 +88,7 @@ fun PinScreen(
8788
isLoading = state.isLoading,
8889
navigatableAction = state.action,
8990
onBack = { viewModel.setEvent(state.onBackEvent) },
91+
imePaddingConfig = ImePaddingConfig.ONLY_CONTENT,
9092
stickyBottom = { paddingValues ->
9193
WrapStickyBottomContent(
9294
modifier = Modifier

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ secrets = "2.0.1"
4646
turbine = "1.2.1"
4747
koin = "4.1.0"
4848
koinAnnotations = "2.1.0"
49-
material = "1.12.0"
49+
material = "1.13.0"
5050
mockito = "5.19.0"
5151
mockitoKotlin = "6.0.0"
5252
ktor = "3.2.3"

issuance-feature/src/main/java/eu/europa/ec/issuancefeature/ui/code/DocumentOfferCodeScreen.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import eu.europa.ec.commonfeature.config.OfferCodeUiConfig
3939
import eu.europa.ec.uilogic.component.AppIconAndText
4040
import eu.europa.ec.uilogic.component.AppIconAndTextDataUi
4141
import eu.europa.ec.uilogic.component.content.ContentScreen
42+
import eu.europa.ec.uilogic.component.content.ImePaddingConfig
4243
import eu.europa.ec.uilogic.component.content.ScreenNavigateAction
4344
import eu.europa.ec.uilogic.component.preview.PreviewTheme
4445
import eu.europa.ec.uilogic.component.preview.ThemeModePreviews
@@ -67,6 +68,7 @@ fun DocumentOfferCodeScreen(
6768
isLoading = state.isLoading,
6869
contentErrorConfig = state.error,
6970
navigatableAction = ScreenNavigateAction.BACKABLE,
71+
imePaddingConfig = ImePaddingConfig.ONLY_CONTENT,
7072
onBack = { viewModel.setEvent(Event.Pop) },
7173
) { paddingValues ->
7274
Content(

ui-logic/src/main/java/eu/europa/ec/uilogic/component/content/ContentScreen.kt

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import androidx.compose.foundation.layout.PaddingValues
2424
import androidx.compose.foundation.layout.Row
2525
import androidx.compose.foundation.layout.fillMaxSize
2626
import androidx.compose.foundation.layout.fillMaxWidth
27+
import androidx.compose.foundation.layout.imePadding
2728
import androidx.compose.foundation.layout.navigationBarsPadding
2829
import androidx.compose.foundation.layout.statusBarsPadding
2930
import androidx.compose.foundation.layout.wrapContentSize
@@ -80,6 +81,10 @@ enum class ScreenNavigateAction {
8081
BACKABLE, CANCELABLE, NONE
8182
}
8283

84+
enum class ImePaddingConfig {
85+
NO_PADDING, WITH_BOTTOM_BAR, ONLY_CONTENT
86+
}
87+
8388
data class BroadcastAction(val intentFilters: List<String>, val callback: (Intent?) -> Unit)
8489

8590
@Composable
@@ -96,6 +101,7 @@ fun ContentScreen(
96101
snackbarHost: @Composable () -> Unit = {},
97102
contentErrorConfig: ContentErrorConfig? = null,
98103
broadcastAction: BroadcastAction? = null,
104+
imePaddingConfig: ImePaddingConfig = ImePaddingConfig.NO_PADDING,
99105
bodyContent: @Composable (PaddingValues) -> Unit
100106
) {
101107
val keyboardController = LocalSoftwareKeyboardController.current
@@ -133,6 +139,13 @@ fun ContentScreen(
133139
modifier = Modifier
134140
.wrapContentSize()
135141
.navigationBarsPadding()
142+
.then(
143+
if (imePaddingConfig == ImePaddingConfig.WITH_BOTTOM_BAR) {
144+
Modifier.imePadding()
145+
} else {
146+
Modifier
147+
}
148+
)
136149
) {
137150
bottomBar()
138151
}
@@ -160,7 +173,17 @@ fun ContentScreen(
160173
paddingValues = screenPaddingsIgnoringSticky
161174
)
162175
} else {
163-
Column(modifier = Modifier.fillMaxSize()) {
176+
Column(
177+
modifier = Modifier
178+
.fillMaxSize()
179+
.then(
180+
if (imePaddingConfig == ImePaddingConfig.ONLY_CONTENT) {
181+
Modifier.imePadding()
182+
} else {
183+
Modifier
184+
}
185+
)
186+
) {
164187

165188
Box(modifier = Modifier.weight(1f)) {
166189
bodyContent(

0 commit comments

Comments
 (0)