Skip to content

Commit

Permalink
Merge pull request #640 from Orange-OpenSource/634-bug-exposed-dropdo…
Browse files Browse the repository at this point in the history
…wn-menu-backgound-changed-to-surface-in-015

634 - [Bug]: Exposed Dropdown Menu backgound changed to 'surface' in 0.15
  • Loading branch information
paulinea authored Sep 22, 2023
2 parents b7941d2 + 7d4e3d9 commit cc23e4a
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 51 deletions.
1 change: 0 additions & 1 deletion app/src/main/java/com/orange/ods/app/ui/MainScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ fun MainScreen(themeConfigurations: Set<OdsThemeConfigurationContract>, mainView

Scaffold(
modifier = modifier,
backgroundColor = OdsTheme.colors.background,
topBar = {
Surface(elevation = if (isSystemInDarkTheme()) 0.dp else AppBarDefaults.TopAppBarElevation) {
Column {
Expand Down
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- \[Lib\] Fix a bug where `OdsDropdownMenu` was not dismissed on user click ([#617](https://github.com/Orange-OpenSource/ods-android/issues/617))
- \[Lib\] Fix disabled color of text and icon in `OdsDropdownMenu` ([#617](https://github.com/Orange-OpenSource/ods-android/issues/617))
- \[Lib\] Fix background color of components in dark mode ([#634](https://github.com/Orange-OpenSource/ods-android/issues/634))

## [0.15.0](https://github.com/Orange-OpenSource/ods-android/compare/0.14.0...0.15.0) - 2023-09-12

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ package com.orange.ods.compose.component.textfield
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.material.TextField
import androidx.compose.material.Typography
Expand Down Expand Up @@ -204,52 +203,50 @@ fun OdsTextField(
) {
val filledTextField = OdsTheme.componentsConfiguration.textFieldStyle == OdsComponentsConfiguration.ComponentStyle.Filled

Surface { // Nest text field in a Surface in order to have correct content text color in dark mode
if (filledTextField) {
OdsFilledTextField(
value = value,
onValueChange = onValueChange,
modifier = modifier,
enabled = enabled,
readOnly = readOnly,
label = label,
placeholder = placeholder,
leadingIcon = leadingIcon,
leadingIconContentDescription = leadingIconContentDescription,
onLeadingIconClick = onLeadingIconClick,
trailing = trailing,
isError = isError,
errorMessage = errorMessage,
visualTransformation = visualTransformation,
keyboardOptions = keyboardOptions,
keyboardActions = keyboardActions,
singleLine = singleLine,
maxLines = maxLines,
characterCounter = characterCounter
)
} else {
OdsOutlinedTextField(
value = value,
onValueChange = onValueChange,
modifier = modifier,
enabled = enabled,
readOnly = readOnly,
label = label,
placeholder = placeholder,
leadingIcon = leadingIcon,
leadingIconContentDescription = leadingIconContentDescription,
onLeadingIconClick = onLeadingIconClick,
trailing = trailing,
isError = isError,
errorMessage = errorMessage,
visualTransformation = visualTransformation,
keyboardOptions = keyboardOptions,
keyboardActions = keyboardActions,
singleLine = singleLine,
maxLines = maxLines,
characterCounter = characterCounter
)
}
if (filledTextField) {
OdsFilledTextField(
value = value,
onValueChange = onValueChange,
modifier = modifier,
enabled = enabled,
readOnly = readOnly,
label = label,
placeholder = placeholder,
leadingIcon = leadingIcon,
leadingIconContentDescription = leadingIconContentDescription,
onLeadingIconClick = onLeadingIconClick,
trailing = trailing,
isError = isError,
errorMessage = errorMessage,
visualTransformation = visualTransformation,
keyboardOptions = keyboardOptions,
keyboardActions = keyboardActions,
singleLine = singleLine,
maxLines = maxLines,
characterCounter = characterCounter
)
} else {
OdsOutlinedTextField(
value = value,
onValueChange = onValueChange,
modifier = modifier,
enabled = enabled,
readOnly = readOnly,
label = label,
placeholder = placeholder,
leadingIcon = leadingIcon,
leadingIconContentDescription = leadingIconContentDescription,
onLeadingIconClick = onLeadingIconClick,
trailing = trailing,
isError = isError,
errorMessage = errorMessage,
visualTransformation = visualTransformation,
keyboardOptions = keyboardOptions,
keyboardActions = keyboardActions,
singleLine = singleLine,
maxLines = maxLines,
characterCounter = characterCounter
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
package com.orange.ods.compose.component.utilities

import android.content.res.Configuration
import androidx.compose.material.Surface
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
Expand All @@ -26,7 +25,7 @@ import kotlin.reflect.KClass
*/
@Composable
internal fun Preview(content: @Composable () -> Unit) = OdsTheme(BuildConfig.PREVIEW_THEME_CONFIGURATION) {
Surface(color = OdsTheme.colors.surface, content = content)
content()
}

/**
Expand Down
3 changes: 2 additions & 1 deletion lib/src/main/java/com/orange/ods/compose/theme/OdsTheme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ package com.orange.ods.compose.theme
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Shapes
import androidx.compose.material.Surface
import androidx.compose.material.Typography
import androidx.compose.material.ripple.LocalRippleTheme
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -98,7 +99,7 @@ fun OdsTheme(
MaterialTheme(
colors = colors.materialColors
) {
content()
Surface(color = colors.background, content = content)
}
}
}

0 comments on commit cc23e4a

Please sign in to comment.