forked from organicmaps/organicmaps
do profile UI/UX
This commit is contained in:
parent
45a8da004b
commit
6f0c27d73a
8 changed files with 37 additions and 21 deletions
|
@ -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))
|
||||
|
|
|
@ -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<CountryCodePicker>(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
|
||||
}
|
||||
|
|
|
@ -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<CountryCodePicker>(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,
|
||||
)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
val WhiteForText = Color(0xFFFFFFFF)
|
||||
|
||||
val BorderDay = Color(0xFFC9D4E7)
|
||||
val BorderNight = Color(0xFFFFFFFF)
|
||||
|
||||
@Composable
|
||||
fun getBorderColor() = if (isSystemInDarkTheme()) BorderNight else BorderDay
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="onBackground">#FFFFFF</color>
|
||||
</resources>
|
|
@ -137,5 +137,5 @@
|
|||
|
||||
<color name="material_calendar_surface_dark">#929292</color>
|
||||
<color name="onBackground">#2B2D33</color>
|
||||
<color name="border">#C9D4E7</color>
|
||||
<color name="onBackgroundNight">#FFFFFF</color>
|
||||
</resources>
|
||||
|
|
Loading…
Add table
Reference in a new issue