From 1e0e96294e8604f2784ca4f8673837ff0186b840 Mon Sep 17 00:00:00 2001 From: Katrina Knight Date: Wed, 27 Nov 2024 04:14:12 +0000 Subject: [PATCH] fix: remove accidental double extension, made sure to use AppTheme --- .../AddBuildingLevelsButton.kt | 5 ++- .../building_levels/AddBuildingLevelsForm.kt | 35 +++++++++++-------- .../streetcomplete/util/ktx/Modifier.kt | 11 ------ 3 files changed, 24 insertions(+), 27 deletions(-) delete mode 100644 app/src/main/java/de/westnordost/streetcomplete/util/ktx/Modifier.kt diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/building_levels/AddBuildingLevelsButton.kt b/app/src/main/java/de/westnordost/streetcomplete/quests/building_levels/AddBuildingLevelsButton.kt index c51b850b53..e1467f5bd9 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/quests/building_levels/AddBuildingLevelsButton.kt +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/building_levels/AddBuildingLevelsButton.kt @@ -20,6 +20,7 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import de.westnordost.streetcomplete.R +import de.westnordost.streetcomplete.ui.theme.AppTheme @Composable fun AddBuildingLevelsButton(lastLevels: Int, lastRoofLevels: Int?,modifier: Modifier = Modifier){ @@ -57,5 +58,7 @@ fun AddBuildingLevelsButton(lastLevels: Int, lastRoofLevels: Int?,modifier: Modi name = "Add Building Levels Button" ) fun PreviewAddBuildingLevelsButton(){ - AddBuildingLevelsButton(3,1) + AppTheme { + AddBuildingLevelsButton(3, 1) + } } diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/building_levels/AddBuildingLevelsForm.kt b/app/src/main/java/de/westnordost/streetcomplete/quests/building_levels/AddBuildingLevelsForm.kt index df3250fa7b..a67de123f6 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/quests/building_levels/AddBuildingLevelsForm.kt +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/building_levels/AddBuildingLevelsForm.kt @@ -46,7 +46,8 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.style.TextAlign import androidx.core.text.isDigitsOnly -import de.westnordost.streetcomplete.util.ktx.conditional +import de.westnordost.streetcomplete.ui.ktx.conditional +import de.westnordost.streetcomplete.ui.theme.AppTheme @Composable fun AddBuildingLevelsFormControl( @@ -152,15 +153,17 @@ fun AddBuildingLevelsFormControl( fun PreviewAddBuildingLevelsFormControl() { var regularLevels = remember { mutableStateOf("55") } var roofLevels = remember { mutableStateOf("55") } - AddBuildingLevelsFormControl( - regularLevels, - roofLevels, - buildingLevels = listOf( - BuildingLevelsAnswer(5, 2), - BuildingLevelsAnswer(4, 1), - BuildingLevelsAnswer(3, 0) + AppTheme { + AddBuildingLevelsFormControl( + regularLevels, + roofLevels, + buildingLevels = listOf( + BuildingLevelsAnswer(5, 2), + BuildingLevelsAnswer(4, 1), + BuildingLevelsAnswer(3, 0) + ) ) - ) + } } class AddBuildingLevelsForm : AbstractOsmQuestForm() { @@ -190,12 +193,14 @@ class AddBuildingLevelsForm : AbstractOsmQuestForm() { binding.questBuildingLevelsBase.setContent { regularLevels = rememberSaveable { mutableStateOf(if(element.tags["building:levels"]!=null) element.tags["building:levels"].toString() else "") } roofLevels = rememberSaveable { mutableStateOf(if(element.tags["roof:levels"]!=null) element.tags["roof:levels"].toString() else "") } - AddBuildingLevelsFormControl( - regularLevels, - roofLevels, - onFormChanged = { checkIsFormComplete() }, - buildingLevels = lastPickedAnswers - ) + AppTheme { + AddBuildingLevelsFormControl( + regularLevels, + roofLevels, + onFormChanged = { checkIsFormComplete() }, + buildingLevels = lastPickedAnswers + ) + } } } diff --git a/app/src/main/java/de/westnordost/streetcomplete/util/ktx/Modifier.kt b/app/src/main/java/de/westnordost/streetcomplete/util/ktx/Modifier.kt deleted file mode 100644 index 9d274dd4c8..0000000000 --- a/app/src/main/java/de/westnordost/streetcomplete/util/ktx/Modifier.kt +++ /dev/null @@ -1,11 +0,0 @@ -package de.westnordost.streetcomplete.util.ktx - -import androidx.compose.ui.Modifier - -fun Modifier.conditional(condition : Boolean, modifier : Modifier.() -> Modifier) : Modifier { - return if (condition) { - then(modifier(Modifier)) - } else { - this - } -}