diff --git a/android/app/src/main/java/app/tourism/Constants.kt b/android/app/src/main/java/app/tourism/Constants.kt index fa3c8dc78c..57bda6cc32 100644 --- a/android/app/src/main/java/app/tourism/Constants.kt +++ b/android/app/src/main/java/app/tourism/Constants.kt @@ -9,6 +9,7 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.res.colorResource import androidx.compose.ui.unit.dp import app.organicmaps.R +import app.tourism.ui.theme.getBorderColor const val TAG = "GLOBAL_TAG" const val BASE_URL = "http://192.168.1.80:8888/api/" @@ -35,6 +36,6 @@ object Constants { @Composable fun Modifier.applyAppBorder() = this.border( width = 1.dp, - color = colorResource(id = R.color.border), + color = getBorderColor(), shape = RoundedCornerShape(20.dp) ).clip(RoundedCornerShape(20.dp)) diff --git a/android/app/src/main/java/app/tourism/ui/screens/main/profile/personal_data/PersonalDataScreen.kt b/android/app/src/main/java/app/tourism/ui/screens/main/profile/personal_data/PersonalDataScreen.kt index 485bf687f7..ab90b628d9 100644 --- a/android/app/src/main/java/app/tourism/ui/screens/main/profile/personal_data/PersonalDataScreen.kt +++ b/android/app/src/main/java/app/tourism/ui/screens/main/profile/personal_data/PersonalDataScreen.kt @@ -24,6 +24,8 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.focus.FocusDirection +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.res.colorResource @@ -139,14 +141,23 @@ fun PersonalDataScreen(onBackClick: () -> Boolean, profileVM: ProfileViewModel) text = stringResource(id = R.string.country), fontSize = 12.sp ) + val lContentColor = MaterialTheme.colorScheme.onBackground.toArgb() AndroidView( factory = { context -> val view = LayoutInflater.from(context) .inflate(R.layout.ccp_profile, null, false) val ccp = view.findViewById(R.id.ccp) - ccp.setCountryForNameCode(countryCodeName) - ccp.setOnCountryChangeListener { - profileVM.setCountryCodeName(ccp.selectedCountryNameCode) + + ccp.apply { + setDialogBackgroundColor(Color.Transparent.toArgb()) + this.contentColor = lContentColor + setDialogTextColor(lContentColor) + setArrowColor(lContentColor) + + setCountryForNameCode(countryCodeName) + setOnCountryChangeListener { + profileVM.setCountryCodeName(ccp.selectedCountryNameCode) + } } view } diff --git a/android/app/src/main/java/app/tourism/ui/screens/main/profile/profile/ProfileScreen.kt b/android/app/src/main/java/app/tourism/ui/screens/main/profile/profile/ProfileScreen.kt index 560e23698f..e1df1d0dd1 100644 --- a/android/app/src/main/java/app/tourism/ui/screens/main/profile/profile/ProfileScreen.kt +++ b/android/app/src/main/java/app/tourism/ui/screens/main/profile/profile/ProfileScreen.kt @@ -30,15 +30,14 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip +import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.res.colorResource import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import androidx.compose.ui.viewinterop.AndroidView -import androidx.hilt.navigation.compose.hiltViewModel import app.organicmaps.R import app.tourism.Constants import app.tourism.applyAppBorder @@ -56,6 +55,7 @@ import app.tourism.ui.common.nav.AppTopBar import app.tourism.ui.common.ui_state.Loading import app.tourism.ui.screens.main.ThemeViewModel import app.tourism.ui.theme.TextStyles +import app.tourism.ui.theme.getBorderColor import app.tourism.ui.utils.showToast import com.hbb20.CountryCodePicker @@ -160,19 +160,24 @@ fun ProfileBar(personalData: PersonalData) { HorizontalSpace(width = 16.dp) Column { Text(text = personalData.fullName, style = TextStyles.h2) - Country(Modifier.fillMaxWidth(), personalData.country) + Country( + Modifier.fillMaxWidth(), + personalData.country, + contentColor = MaterialTheme.colorScheme.onBackground.toArgb(), + ) } } } @Composable -fun Country(modifier: Modifier = Modifier, countryCodeName: String) { +fun Country(modifier: Modifier = Modifier, countryCodeName: String, contentColor: Int) { AndroidView( modifier = Modifier.then(modifier), factory = { context -> val view = LayoutInflater.from(context) .inflate(R.layout.ccp_as_country_label, null, false) val ccp = view.findViewById(R.id.ccp) + ccp.contentColor = contentColor ccp.setCountryForNameCode(countryCodeName) ccp.showArrow(false) ccp.setCcpClickable(false) @@ -242,7 +247,7 @@ fun GenericProfileItem( Icon( modifier = Modifier.size(22.dp), painter = painterResource(id = icon), - tint = colorResource(id = R.color.border), + tint = getBorderColor(), contentDescription = label, ) } diff --git a/android/app/src/main/java/app/tourism/ui/theme/Color.kt b/android/app/src/main/java/app/tourism/ui/theme/Color.kt index 7544b8c8ec..b1029596f4 100644 --- a/android/app/src/main/java/app/tourism/ui/theme/Color.kt +++ b/android/app/src/main/java/app/tourism/ui/theme/Color.kt @@ -1,5 +1,7 @@ package app.tourism.ui.theme +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.runtime.Composable import androidx.compose.ui.graphics.Color val Blue = Color(0xFF0688E7) @@ -9,9 +11,15 @@ val LightestBlue = Color(0xFFEEF4FF) val DarkerBlue = Color(0xFF272f46) val DarkestBlue = Color(0xFF101832) val HeartRed = Color(0xFFFF6C61) -val StarYellow= Color(0xFFF8D749) +val StarYellow = Color(0xFFF8D749) val DarkGrayForText = Color(0xFF78787F) val Gray = Color(0xFFD5D5D6) val LightGray = Color(0xFFF4F4F4) val DarkForText = Color(0xFF2B2D33) -val WhiteForText = Color(0xFFFFFFFF) \ No newline at end of file +val WhiteForText = Color(0xFFFFFFFF) + +val BorderDay = Color(0xFFC9D4E7) +val BorderNight = Color(0xFFFFFFFF) + +@Composable +fun getBorderColor() = if (isSystemInDarkTheme()) BorderNight else BorderDay \ No newline at end of file diff --git a/android/app/src/main/res/layout/ccp_as_country_label.xml b/android/app/src/main/res/layout/ccp_as_country_label.xml index a5158697e2..28b17c10f5 100644 --- a/android/app/src/main/res/layout/ccp_as_country_label.xml +++ b/android/app/src/main/res/layout/ccp_as_country_label.xml @@ -6,7 +6,6 @@ android:layout_height="wrap_content" android:paddingVertical="12dp" app:ccp_showArrow="false" - app:ccp_contentColor="@color/onBackground" app:ccp_autoDetectLanguage="true" app:ccp_textGravity="LEFT" app:ccp_padding="0dp" diff --git a/android/app/src/main/res/layout/ccp_profile.xml b/android/app/src/main/res/layout/ccp_profile.xml index 8f80c47c6b..27460be0a8 100644 --- a/android/app/src/main/res/layout/ccp_profile.xml +++ b/android/app/src/main/res/layout/ccp_profile.xml @@ -6,10 +6,6 @@ android:layout_height="wrap_content" android:paddingVertical="0dp" app:ccp_autoDetectLanguage="true" - app:ccp_contentColor="@color/onBackground" - app:ccpDialog_backgroundColor="@color/transparent" - app:ccpDialog_textColor="@color/onBackground" - app:ccp_arrowColor="@color/onBackground" app:ccp_textGravity="LEFT" app:ccp_padding="0dp" app:ccpDialog_background="@color/transparent" diff --git a/android/app/src/main/res/values-night/colors.xml b/android/app/src/main/res/values-night/colors.xml deleted file mode 100644 index 3ad7d62ec5..0000000000 --- a/android/app/src/main/res/values-night/colors.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - #FFFFFF - \ No newline at end of file diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml index d76f485ca9..2c8d9af674 100644 --- a/android/app/src/main/res/values/colors.xml +++ b/android/app/src/main/res/values/colors.xml @@ -137,5 +137,5 @@ #929292 #2B2D33 - #C9D4E7 + #FFFFFF