Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e19b471
create custom bottom sheet (without all this scaffold stuff and witho…
westnordost Apr 14, 2026
2e2c700
convenience composable for SpeechBubbleShape
westnordost Apr 14, 2026
824e6ec
move
westnordost Apr 14, 2026
9ac83a8
use default text link styles
westnordost Apr 14, 2026
caa11d7
copy new implementation from M3
westnordost Apr 14, 2026
2a887b9
add QuestAnswerButtonBar
westnordost Apr 14, 2026
592b811
add QuestForm
westnordost Apr 14, 2026
079c3fc
use PaddingValues.Zero
westnordost Apr 14, 2026
3c3ce22
make FloatingOkButton enablebe (necessary for overlays)
westnordost Apr 14, 2026
ffa3fe0
add comments etc
westnordost Apr 14, 2026
bb97631
use WindowInfo in Dimensions.kt
westnordost Apr 14, 2026
2ae3a53
use BottomSheet in QuestForm, make scrollable, add floating OK button
westnordost Apr 14, 2026
dbc6113
always use CompositionLocalProvider with LocalContentAlpha for hint t…
westnordost Apr 14, 2026
18ebf60
put NoteBubble into own file
westnordost Apr 14, 2026
590a7d5
comments
westnordost Apr 14, 2026
631b21e
fix nested scrolling and flinging
westnordost Apr 14, 2026
154b0ee
add constant for speech bubble corner radius
westnordost Apr 14, 2026
f3228e5
FloatingActionButton: properly implement greying out when disabled -_-
westnordost Apr 15, 2026
7720e3c
add SpeechBubbleNoArrow because there are so many common elements
westnordost Apr 15, 2026
b1a19e8
use SpeechBubbleNoArrow
westnordost Apr 15, 2026
c2ea871
add OverlayForm
westnordost Apr 15, 2026
6abb7eb
fix Crosshair.kt
westnordost Apr 15, 2026
775d133
move speechBubbleCornerRadius to Dimensions.kt
westnordost Apr 15, 2026
9f4aee4
put divider color into Color.kt
westnordost Apr 15, 2026
2230076
use SpeechBubbleNoArrow also for NoteCommentItem
westnordost Apr 15, 2026
fa2a451
add some comments
westnordost Apr 15, 2026
d6ea645
apply review suggestions
westnordost Apr 15, 2026
2eff3b6
correct comment
westnordost Apr 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import de.westnordost.streetcomplete.databinding.ButtonPanelButtonBinding
import de.westnordost.streetcomplete.databinding.FragmentQuestAnswerBinding
import de.westnordost.streetcomplete.screens.main.bottom_sheet.AbstractBottomSheetFragment
import de.westnordost.streetcomplete.screens.main.bottom_sheet.IsMapOrientationAware
import de.westnordost.streetcomplete.ui.common.quest.QuestHeader
import de.westnordost.streetcomplete.ui.util.content
import de.westnordost.streetcomplete.util.FragmentViewBindingPropertyDelegate
import de.westnordost.streetcomplete.util.ktx.popIn
Expand Down Expand Up @@ -137,7 +138,7 @@ abstract class AbstractQuestForm :
protected open fun getHintImages(): List<DrawableResource> = questType.hintImages

@Composable
protected open fun ContentBeforeSpeechbubbleContent() {}
protected open fun ContentBeforeSpeechBubbleContent() {}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
Expand All @@ -152,7 +153,7 @@ abstract class AbstractQuestForm :
} }

binding.contentBeforeSpeechbubbleContent.content {
ContentBeforeSpeechbubbleContent()
ContentBeforeSpeechBubbleContent()
}

binding.okButton.setOnClickListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import de.westnordost.streetcomplete.databinding.FragmentQuestAnswerBinding
import de.westnordost.streetcomplete.quests.note_comments.NoteForm
import de.westnordost.streetcomplete.resources.*
import de.westnordost.streetcomplete.screens.main.bottom_sheet.AbstractCreateNoteFragment
import de.westnordost.streetcomplete.ui.common.quest.QuestHeader
import de.westnordost.streetcomplete.ui.theme.titleLarge
import de.westnordost.streetcomplete.ui.util.content
import de.westnordost.streetcomplete.util.ktx.viewLifecycleScope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import de.westnordost.streetcomplete.quests.AnswerItem
import de.westnordost.streetcomplete.quests.note_comments.NoteCommentItem
import de.westnordost.streetcomplete.quests.note_comments.NoteForm
import de.westnordost.streetcomplete.screens.main.bottom_sheet.AbstractCreateNoteFragment
import de.westnordost.streetcomplete.ui.theme.defaultTextLinkStyles
import de.westnordost.streetcomplete.ui.util.content
import de.westnordost.streetcomplete.ui.util.rememberSerializable
import de.westnordost.streetcomplete.util.image.loadImageBitmap
Expand Down Expand Up @@ -126,16 +127,8 @@ class NoteDiscussionForm : AbstractQuestForm(), TakePhotoFragment.Listener {
}

@Composable
override fun ContentBeforeSpeechbubbleContent() {
val textLinkStyles = TextLinkStyles(
style = SpanStyle(
color = MaterialTheme.colors.primary,
textDecoration = TextDecoration.Underline
),
focusedStyle = SpanStyle(
color = MaterialTheme.colors.secondary,
)
)
override fun ContentBeforeSpeechBubbleContent() {
val textLinkStyles = MaterialTheme.typography.defaultTextLinkStyles()
ProvideTextStyle(MaterialTheme.typography.body2) {
Column(
verticalArrangement = Arrangement.spacedBy(8.dp),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import de.westnordost.streetcomplete.data.osmnotes.edits.NoteEditAction
import de.westnordost.streetcomplete.data.osmnotes.edits.NoteEditsController
import de.westnordost.streetcomplete.data.osmtracks.Trackpoint
import de.westnordost.streetcomplete.databinding.FragmentCreateNoteBinding
import de.westnordost.streetcomplete.quests.QuestHeader
import de.westnordost.streetcomplete.quests.note_comments.NoteForm
import de.westnordost.streetcomplete.resources.*
import de.westnordost.streetcomplete.ui.common.quest.QuestHeader
import de.westnordost.streetcomplete.ui.util.content
import de.westnordost.streetcomplete.util.ktx.getLocationInWindow
import de.westnordost.streetcomplete.util.ktx.viewLifecycleScope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.material.ContentAlpha
import androidx.compose.material.Divider
import androidx.compose.material.LocalContentAlpha
import androidx.compose.material.LocalContentColor
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
Expand Down Expand Up @@ -45,11 +47,12 @@ fun EditDetails(
modifier = modifier,
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
Text(
text = dateTimeFormatter.format(createdTime),
style = MaterialTheme.typography.body2,
color = LocalContentColor.current.copy(alpha = ContentAlpha.medium),
)
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
Text(
text = dateTimeFormatter.format(createdTime),
style = MaterialTheme.typography.body2,
)
}
Row(
horizontalArrangement = Arrangement.spacedBy(16.dp),
verticalAlignment = Alignment.CenterVertically
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import kotlinx.coroutines.delay
import org.jetbrains.compose.resources.painterResource
import org.jetbrains.compose.resources.stringResource
import androidx.compose.ui.tooling.preview.Preview
import de.westnordost.streetcomplete.ui.theme.divider

/** Wizard which enables team mode */
@Composable
Expand Down Expand Up @@ -200,7 +201,7 @@ private fun SplitQuestsIllustration(
}

val arrangement = Arrangement.spacedBy((-48 + 64 * padding.value).dp)
val dividerColor = MaterialTheme.colors.onSurface.copy(alpha = 0.12f)
val dividerColor = MaterialTheme.colors.divider
val dividerWidth = 4.dp.toPx()
Column(
modifier = Modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.material.Checkbox
import androidx.compose.material.ContentAlpha
import androidx.compose.material.LocalContentAlpha
import androidx.compose.material.LocalContentColor
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
Expand Down Expand Up @@ -73,10 +75,11 @@ fun OverlaySelectionRow(

@Composable
private fun DisabledHint(text: String) {
Text(
text = text,
style = MaterialTheme.typography.body2,
fontStyle = FontStyle.Italic,
color = LocalContentColor.current.copy(alpha = ContentAlpha.medium),
)
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
Text(
text = text,
style = MaterialTheme.typography.body2,
fontStyle = FontStyle.Italic,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ import org.jetbrains.compose.resources.stringResource
private fun EditTypePresetsList(
viewModel: EditTypePresetsViewModel,
modifier: Modifier = Modifier,
contentPadding: PaddingValues = PaddingValues(0.dp)
contentPadding: PaddingValues = PaddingValues.Zero
) {
val presets by viewModel.presets.collectAsState()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ fun QuestSelectionList(
onSelect: (questType: QuestType, selected: Boolean) -> Unit,
onReorder: (questType: QuestType, toAfter: QuestType) -> Unit,
modifier: Modifier = Modifier,
contentPadding: PaddingValues = PaddingValues(0.dp),
contentPadding: PaddingValues = PaddingValues.Zero,
) {
var showEnableQuestDialog by remember { mutableStateOf<QuestType?>(null) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ import androidx.compose.foundation.layout.width
import androidx.compose.material.Checkbox
import androidx.compose.material.ContentAlpha
import androidx.compose.material.Icon
import androidx.compose.material.LocalContentAlpha
import androidx.compose.material.LocalContentColor
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
Expand Down Expand Up @@ -92,12 +94,13 @@ fun QuestSelectionRow(

@Composable
private fun DisabledHint(text: String) {
Text(
text = text,
style = MaterialTheme.typography.body2,
fontStyle = FontStyle.Italic,
color = LocalContentColor.current.copy(alpha = ContentAlpha.medium),
)
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
Text(
text = text,
style = MaterialTheme.typography.body2,
fontStyle = FontStyle.Italic,
)
}
}

@Preview
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import de.westnordost.streetcomplete.ui.theme.GrassGreen
fun EditTypeStatisticsColumn(
statistics: List<EditTypeStatistics>,
modifier: Modifier = Modifier,
contentPadding: PaddingValues = PaddingValues(0.dp),
contentPadding: PaddingValues = PaddingValues.Zero,
) {
var showInfo by remember { mutableStateOf<EditTypeStatistics?>(null) }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:width="32dp"
android:height="32dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import de.westnordost.streetcomplete.resources.*
import de.westnordost.streetcomplete.ui.common.dialogs.WheelPickerDialog
import de.westnordost.streetcomplete.ui.common.last_picked.LastPickedChipsRow
import de.westnordost.streetcomplete.ui.common.street_side_select.MiniCompass
import de.westnordost.streetcomplete.ui.theme.divider
import org.jetbrains.compose.resources.stringResource

/** Form to input how many lanes a road has */
Expand Down Expand Up @@ -80,7 +81,7 @@ fun LanesForm(
modifier = Modifier
.padding(horizontal = 8.dp)
.align(Alignment.BottomStart),
chipBorder = BorderStroke(1.dp, MaterialTheme.colors.onSurface.copy(alpha = 0.12f)),
chipBorder = BorderStroke(1.dp, MaterialTheme.colors.divider),
) { laneCount ->
LanesButtonContent(
laneCount = laneCount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material.ContentAlpha
import androidx.compose.material.LocalContentAlpha
import androidx.compose.material.LocalContentColor
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand Down Expand Up @@ -66,11 +68,12 @@ fun MaxSpeedForm(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(4.dp)
) {
Text(
text = stringResource(Res.string.quest_maxspeed_type_description),
color = LocalContentColor.current.copy(alpha = ContentAlpha.medium),
style = MaterialTheme.typography.body2,
)
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
Text(
text = stringResource(Res.string.quest_maxspeed_type_description),
style = MaterialTheme.typography.body2,
)
}
DropdownButton(
items = selectableMaxSpeedTypes,
onSelectedItem = { onAnswer(it) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ package de.westnordost.streetcomplete.quests.max_speed

import androidx.compose.foundation.layout.Column
import androidx.compose.material.ContentAlpha
import androidx.compose.material.LocalContentAlpha
import androidx.compose.material.LocalContentColor
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand Down Expand Up @@ -33,11 +35,12 @@ fun RoadTypeSelect(
horizontalAlignment = Alignment.CenterHorizontally,
modifier = modifier,
) {
Text(
text = stringResource(Res.string.quest_maxspeed_answer_roadtype_description),
color = LocalContentColor.current.copy(alpha = ContentAlpha.medium),
style = MaterialTheme.typography.body2,
)
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
Text(
text = stringResource(Res.string.quest_maxspeed_answer_roadtype_description),
style = MaterialTheme.typography.body2,
)
}
ItemSelectGrid(
columns = SimpleGridCells.Fixed(cells),
items = selectable,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
package de.westnordost.streetcomplete.quests.note_comments

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.material.ContentAlpha
import androidx.compose.material.Divider
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
Expand All @@ -24,11 +21,13 @@ import androidx.compose.ui.text.TextLinkStyles
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.withLink
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import de.westnordost.streetcomplete.data.osmnotes.NoteComment
import de.westnordost.streetcomplete.resources.*
import de.westnordost.streetcomplete.ui.common.SpeechBubbleArrowDirection
import de.westnordost.streetcomplete.ui.common.SpeechBubbleShape
import de.westnordost.streetcomplete.ui.common.speech_bubble.SpeechBubble
import de.westnordost.streetcomplete.ui.common.speech_bubble.SpeechBubbleArrowDirection
import de.westnordost.streetcomplete.ui.common.speech_bubble.SpeechBubbleNoArrow
import de.westnordost.streetcomplete.ui.util.annotateLinks
import de.westnordost.streetcomplete.ui.util.formatAnnotated
import de.westnordost.streetcomplete.util.ktx.toLocalDateTime
Expand All @@ -47,6 +46,7 @@ fun NoteCommentItem(
noteComment: NoteComment,
avatarPainter: Painter?,
modifier: Modifier = Modifier,
elevation: Dp = 16.dp,
textLinkStyles: TextLinkStyles? = null
) {
val annotatedUserName = buildAnnotatedString {
Expand Down Expand Up @@ -83,33 +83,21 @@ fun NoteCommentItem(
Row(horizontalArrangement = Arrangement.spacedBy(4.dp)) {
Surface(
modifier = Modifier.size(50.dp),
elevation = 16.dp,
elevation = elevation,
shape = CircleShape,
border = BorderStroke(1.dp, MaterialTheme.colors.onSurface.copy(alpha = 0.12f))
) {
Image(
painter = avatarPainter ?: painterResource(Res.drawable.avatar_osm_anonymous),
contentDescription = annotatedUserName.text
)
}

val speechBubbleShape = SpeechBubbleShape(
SpeechBubble(
arrowDirection = SpeechBubbleArrowDirection.Start,
cornerRadius = 16.dp,
arrowSize = 10.dp,
)
Surface(
elevation = 16.dp,
shape = speechBubbleShape,
border = BorderStroke(1.dp, MaterialTheme.colors.onSurface.copy(alpha = 0.12f))
elevation = elevation,
) {
SelectionContainer {
Column(
modifier = Modifier
.padding(speechBubbleShape.contentPadding)
.padding(horizontal = 16.dp, vertical = 12.dp),
verticalArrangement = Arrangement.spacedBy(4.dp)
) {
Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {
Text(annotatedCommentText)
Divider()
Text(
Expand All @@ -125,11 +113,7 @@ fun NoteCommentItem(
// the action (if anything else than a normal comment) is shown in a separate bubble, just
// like for example in github ("comment and close")
if (actionTextResource != null) {
Surface(
elevation = 16.dp,
shape = RoundedCornerShape(16.dp),
border = BorderStroke(1.dp, MaterialTheme.colors.onSurface.copy(alpha = 0.12f))
) {
SpeechBubbleNoArrow(elevation = elevation) {
Text(
text = stringResource(actionTextResource)
.formatAnnotated(annotatedUserName, dateText),
Expand Down
Loading