forked from organicmaps/organicmaps
android: adjust UI
This commit is contained in:
parent
dc9c67480c
commit
7cb1b6e51f
5 changed files with 54 additions and 9 deletions
|
@ -11,6 +11,8 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.unit.dp
|
||||
import app.tourism.ui.theme.TextStyles
|
||||
import app.tourism.ui.theme.getSelectedColor
|
||||
import app.tourism.ui.theme.getSelectedTextColor
|
||||
|
||||
@Composable
|
||||
fun BorderedItem(
|
||||
|
@ -23,7 +25,7 @@ fun BorderedItem(
|
|||
Text(
|
||||
modifier = Modifier
|
||||
.background(
|
||||
color = if (highlighted) MaterialTheme.colorScheme.surface
|
||||
color = if (highlighted) getSelectedColor()
|
||||
else MaterialTheme.colorScheme.background,
|
||||
shape = shape
|
||||
)
|
||||
|
@ -34,6 +36,7 @@ fun BorderedItem(
|
|||
.padding(12.dp)
|
||||
.then(modifier),
|
||||
text = label,
|
||||
color = getSelectedTextColor(),
|
||||
style = TextStyles.h4
|
||||
)
|
||||
}
|
|
@ -16,6 +16,8 @@ import androidx.compose.ui.unit.dp
|
|||
import app.tourism.applyAppBorder
|
||||
import app.tourism.ui.models.SingleChoiceItem
|
||||
import app.tourism.ui.theme.TextStyles
|
||||
import app.tourism.ui.theme.getSelectedColor
|
||||
import app.tourism.ui.theme.getSelectedTextColor
|
||||
|
||||
@Composable
|
||||
fun HorizontalSingleChoice(
|
||||
|
@ -23,7 +25,7 @@ fun HorizontalSingleChoice(
|
|||
items: List<SingleChoiceItem>,
|
||||
selected: SingleChoiceItem?,
|
||||
onSelectedChanged: (SingleChoiceItem) -> Unit,
|
||||
selectedColor: Color = MaterialTheme.colorScheme.surface,
|
||||
selectedColor: Color = getSelectedColor(),
|
||||
unselectedColor: Color = MaterialTheme.colorScheme.background,
|
||||
itemModifier: Modifier = Modifier,
|
||||
) {
|
||||
|
@ -49,8 +51,8 @@ private fun SingleChoiceItem(
|
|||
item: SingleChoiceItem,
|
||||
isSelected: Boolean,
|
||||
onClick: () -> Unit,
|
||||
selectedColor: Color = MaterialTheme.colorScheme.surface,
|
||||
unselectedColor: Color = MaterialTheme.colorScheme.background,
|
||||
selectedColor: Color,
|
||||
unselectedColor: Color,
|
||||
) {
|
||||
val shape = RoundedCornerShape(16.dp)
|
||||
Text(
|
||||
|
@ -68,6 +70,7 @@ private fun SingleChoiceItem(
|
|||
.padding(12.dp)
|
||||
.then(modifier),
|
||||
text = item.label,
|
||||
color = if (isSelected) getSelectedTextColor() else MaterialTheme.colorScheme.onBackground,
|
||||
style = TextStyles.h4
|
||||
)
|
||||
}
|
||||
|
|
|
@ -13,11 +13,19 @@ import androidx.compose.material3.Text
|
|||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import app.organicmaps.R
|
||||
import app.tourism.ui.models.SingleChoiceItem
|
||||
import app.tourism.ui.theme.DarkestBlue
|
||||
import app.tourism.ui.theme.SelectedDay
|
||||
import app.tourism.ui.theme.SelectedNight
|
||||
import app.tourism.ui.theme.SelectedTextDay
|
||||
import app.tourism.ui.theme.SelectedTextNight
|
||||
import app.tourism.ui.theme.TextStyles
|
||||
import app.tourism.ui.theme.getSelectedColor
|
||||
import app.tourism.ui.theme.getSelectedTextColor
|
||||
|
||||
@Composable
|
||||
fun PlaceTabRow(modifier: Modifier = Modifier, tabIndex: Int, onTabIndexChanged: (Int) -> Unit) {
|
||||
|
@ -32,7 +40,10 @@ fun PlaceTabRow(modifier: Modifier = Modifier, tabIndex: Int, onTabIndexChanged:
|
|||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.background(color = MaterialTheme.colorScheme.surface, shape)
|
||||
.background(
|
||||
color = MaterialTheme.colorScheme.surface,
|
||||
shape
|
||||
)
|
||||
.then(modifier)
|
||||
.padding(8.dp),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
|
@ -56,19 +67,24 @@ private fun SingleChoiceItem(
|
|||
onClick: () -> Unit,
|
||||
) {
|
||||
val shape = RoundedCornerShape(50.dp)
|
||||
val notSelectedColor = MaterialTheme.colorScheme.surface
|
||||
val notSelectedTextColor = MaterialTheme.colorScheme.onBackground
|
||||
val selectedColor = getSelectedColor()
|
||||
val selectedTextColor = getSelectedTextColor()
|
||||
|
||||
Text(
|
||||
modifier = Modifier
|
||||
.wrapContentSize()
|
||||
.clip(shape)
|
||||
.clickable { onClick() }
|
||||
.background(
|
||||
color = if (isSelected) MaterialTheme.colorScheme.primary.copy(alpha = 0.1f)
|
||||
else MaterialTheme.colorScheme.surface,
|
||||
color = if (isSelected) selectedColor else notSelectedColor,
|
||||
shape = shape
|
||||
)
|
||||
.padding(8.dp),
|
||||
text = item.label,
|
||||
style = TextStyles.b1,
|
||||
color = if (isSelected) selectedTextColor else notSelectedTextColor,
|
||||
maxLines = 1
|
||||
)
|
||||
}
|
||||
|
|
|
@ -7,16 +7,20 @@ import androidx.compose.foundation.layout.offset
|
|||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import app.organicmaps.R
|
||||
import app.tourism.Constants
|
||||
import app.tourism.ui.common.VerticalSpace
|
||||
import app.tourism.ui.common.WebView
|
||||
import app.tourism.ui.common.buttons.PrimaryButton
|
||||
import app.tourism.ui.theme.TextStyles
|
||||
import app.tourism.utils.getAnnotatedStringFromHtml
|
||||
|
||||
@Composable
|
||||
fun DescriptionScreen(
|
||||
|
@ -31,7 +35,11 @@ fun DescriptionScreen(
|
|||
description?.let {
|
||||
Column(Modifier.verticalScroll(rememberScrollState())) {
|
||||
VerticalSpace(height = 16.dp)
|
||||
WebView(data = it)
|
||||
Text(
|
||||
text = it.getAnnotatedStringFromHtml(),
|
||||
style = TextStyles.b1,
|
||||
fontSize = 14.sp
|
||||
)
|
||||
VerticalSpace(height = 100.dp)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package app.tourism.ui.theme
|
||||
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
|
@ -28,5 +29,19 @@ val HintNight = Color(0xFFAAABAD)
|
|||
@Composable
|
||||
fun getHintColor() = if (isSystemInDarkTheme()) HintNight else HintDay
|
||||
|
||||
val SelectedDay = Blue.copy(alpha = 0.1f)
|
||||
val SelectedNight = Color(0xFFFFFFFF)
|
||||
@Composable
|
||||
fun getStarColor() = StarYellow
|
||||
fun getSelectedColor() = if (isDark()) SelectedNight else SelectedDay
|
||||
|
||||
val SelectedTextDay = Color.Black
|
||||
val SelectedTextNight = Color.Black
|
||||
@Composable
|
||||
fun getSelectedTextColor() = if (isDark()) SelectedTextNight else SelectedTextDay
|
||||
|
||||
@Composable
|
||||
fun getStarColor() = StarYellow
|
||||
|
||||
// for some reason isSystemInDarkTheme() not working here
|
||||
@Composable
|
||||
fun isDark(): Boolean = MaterialTheme.colorScheme.background == DarkestBlue
|
Loading…
Add table
Reference in a new issue