-
-
Notifications
You must be signed in to change notification settings - Fork 361
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Grill fuel quest -- add OtherAnswer that this is just a firering, not…
… a Grill (#5371) * add a "not a BBQ" other answer * try to fix compile issues * cleanups * try to fix compile error * try NOT_BBQ as an enum * enum kludge * include * try to get it to compile * try to import variables * try to get rid of "sealed interface class" in order to get it to compile * add confirmNotBbq() * add missing import * indicate magic value * try to get "sealed interface BbqFuelAnswer" to work * try buttonPanelAnswers from dier_type * try building_entrance items override * whitespace cleanups * Update app/src/main/java/de/westnordost/streetcomplete/quests/bbq_fuel/AddBbqFuelForm.kt * rename NOT_BBQ => IsFirePitAnswer * indicate what it is instead of what it is not, try different words for clarification and shortening * rephrase other answer, use different message format * try to fix compilation error Failed to flatten XML for resource 'quest_bbq_fuel_not_a_bbq' with error: Invalid unicode escape sequence in string * cleanup texts * Update app/src/main/res/values/strings.xml Co-authored-by: Flo Edelmann <[email protected]> --------- Co-authored-by: Tobias Zwick <[email protected]> Co-authored-by: Flo Edelmann <[email protected]>
- Loading branch information
1 parent
9de3369
commit 723078c
Showing
5 changed files
with
45 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 23 additions & 5 deletions
28
app/src/main/java/de/westnordost/streetcomplete/quests/bbq_fuel/AddBbqFuelForm.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,32 @@ | ||
package de.westnordost.streetcomplete.quests.bbq_fuel | ||
|
||
import androidx.appcompat.app.AlertDialog | ||
Check failure on line 3 in app/src/main/java/de/westnordost/streetcomplete/quests/bbq_fuel/AddBbqFuelForm.kt GitHub Actions / Kotlin
|
||
import de.westnordost.streetcomplete.R | ||
import de.westnordost.streetcomplete.quests.AListQuestForm | ||
import de.westnordost.streetcomplete.quests.AnswerItem | ||
import de.westnordost.streetcomplete.quests.TextItem | ||
import de.westnordost.streetcomplete.quests.bbq_fuel.BbqFuel.WOOD | ||
import de.westnordost.streetcomplete.quests.bbq_fuel.BbqFuel.ELECTRIC | ||
import de.westnordost.streetcomplete.quests.bbq_fuel.BbqFuel.CHARCOAL | ||
|
||
class AddBbqFuelForm : AListQuestForm<BbqFuel>() { | ||
class AddBbqFuelForm : AListQuestForm<BbqFuelAnswer>() { | ||
override val items: List<TextItem<BbqFuelAnswer>> = listOf( | ||
TextItem(WOOD, R.string.quest_bbq_fuel_wood), | ||
TextItem(ELECTRIC, R.string.quest_bbq_fuel_electric), | ||
TextItem(CHARCOAL, R.string.quest_bbq_fuel_charcoal), | ||
) | ||
|
||
override val items = listOf( | ||
TextItem(BbqFuel.WOOD, R.string.quest_bbq_fuel_wood), | ||
TextItem(BbqFuel.ELECTRIC, R.string.quest_bbq_fuel_electric), | ||
TextItem(BbqFuel.CHARCOAL, R.string.quest_bbq_fuel_charcoal), | ||
override val otherAnswers = listOf( | ||
AnswerItem(R.string.quest_bbq_fuel_not_a_bbq) { confirmNotBbq() }, | ||
) | ||
|
||
private fun confirmNotBbq() { | ||
val ctx = context ?: return | ||
AlertDialog.Builder(ctx) | ||
.setTitle(R.string.quest_generic_confirmation_title) | ||
.setMessage(R.string.quest_bbq_fuel_not_a_bbq_confirmation) | ||
.setPositiveButton(R.string.quest_generic_confirmation_yes) { _, _ -> applyAnswer(IsFirePitAnswer) } | ||
.setNegativeButton(R.string.quest_generic_confirmation_no, null) | ||
.show() | ||
} | ||
} |
7 changes: 0 additions & 7 deletions
7
app/src/main/java/de/westnordost/streetcomplete/quests/bbq_fuel/BbqFuel.kt
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
app/src/main/java/de/westnordost/streetcomplete/quests/bbq_fuel/BbqFuelAnswer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package de.westnordost.streetcomplete.quests.bbq_fuel | ||
|
||
sealed interface BbqFuelAnswer | ||
|
||
enum class BbqFuel(val osmValue: String) : BbqFuelAnswer { | ||
WOOD("wood"), | ||
ELECTRIC("electric"), | ||
CHARCOAL("charcoal") | ||
} | ||
|
||
object IsFirePitAnswer : BbqFuelAnswer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters