-
-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5612 from streetcomplete/info-button
Info button and hints
- Loading branch information
Showing
102 changed files
with
385 additions
and
620 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
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
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
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
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
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
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
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
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
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
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
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
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
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
47 changes: 7 additions & 40 deletions
47
...rc/main/java/de/westnordost/streetcomplete/quests/foot/AddProhibitedForPedestriansForm.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,50 +1,17 @@ | ||
package de.westnordost.streetcomplete.quests.foot | ||
|
||
import androidx.appcompat.app.AlertDialog | ||
import de.westnordost.streetcomplete.R | ||
import de.westnordost.streetcomplete.databinding.DialogLivingStreetConfirmationBinding | ||
import de.westnordost.streetcomplete.quests.AbstractOsmQuestForm | ||
import de.westnordost.streetcomplete.quests.AnswerItem | ||
import de.westnordost.streetcomplete.quests.AListQuestForm | ||
import de.westnordost.streetcomplete.quests.TextItem | ||
import de.westnordost.streetcomplete.quests.foot.ProhibitedForPedestriansAnswer.HAS_SEPARATE_SIDEWALK | ||
import de.westnordost.streetcomplete.quests.foot.ProhibitedForPedestriansAnswer.IS_LIVING_STREET | ||
import de.westnordost.streetcomplete.quests.foot.ProhibitedForPedestriansAnswer.NO | ||
import de.westnordost.streetcomplete.quests.foot.ProhibitedForPedestriansAnswer.YES | ||
import de.westnordost.streetcomplete.util.ktx.livingStreetSignDrawableResId | ||
|
||
class AddProhibitedForPedestriansForm : AbstractOsmQuestForm<ProhibitedForPedestriansAnswer>() { | ||
class AddProhibitedForPedestriansForm : AListQuestForm<ProhibitedForPedestriansAnswer>() { | ||
|
||
override val contentLayoutResId = R.layout.quest_prohibited_for_pedestrians_separate_sidewalk_explanation | ||
|
||
override val buttonPanelAnswers = listOf( | ||
AnswerItem(R.string.quest_generic_hasFeature_no) { applyAnswer(NO) }, | ||
AnswerItem(R.string.quest_generic_hasFeature_yes) { applyAnswer(YES) }, | ||
AnswerItem(R.string.quest_sidewalk_value_yes) { applyAnswer(HAS_SEPARATE_SIDEWALK) } | ||
override val items = listOf( | ||
TextItem(YES, R.string.quest_accessible_for_pedestrians_prohibited), | ||
TextItem(NO, R.string.quest_accessible_for_pedestrians_allowed), | ||
TextItem(HAS_SEPARATE_SIDEWALK, R.string.quest_accessible_for_pedestrians_separate_sidewalk), | ||
) | ||
|
||
// the living street answer stuff is copied from AddMaxSpeedForm | ||
override val otherAnswers: List<AnswerItem> get() { | ||
val result = mutableListOf<AnswerItem>() | ||
|
||
val highwayTag = element.tags["highway"]!! | ||
if (countryInfo.hasLivingStreet && MAYBE_LIVING_STREET.contains(highwayTag)) { | ||
result.add(AnswerItem(R.string.quest_maxspeed_answer_living_street) { confirmLivingStreet() }) | ||
} | ||
return result | ||
} | ||
|
||
private fun confirmLivingStreet() { | ||
val ctx = context ?: return | ||
val dialogBinding = DialogLivingStreetConfirmationBinding.inflate(layoutInflater) | ||
countryInfo.livingStreetSignDrawableResId?.let { dialogBinding.livingStreetImage.setImageResource(it) } | ||
AlertDialog.Builder(ctx) | ||
.setView(dialogBinding.root) | ||
.setTitle(R.string.quest_maxspeed_answer_living_street_confirmation_title) | ||
.setPositiveButton(R.string.quest_generic_confirmation_yes) { _, _ -> applyAnswer(IS_LIVING_STREET) } | ||
.setNegativeButton(R.string.quest_generic_confirmation_no, null) | ||
.show() | ||
} | ||
|
||
companion object { | ||
private val MAYBE_LIVING_STREET = listOf("residential", "unclassified") | ||
} | ||
} |
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
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
Oops, something went wrong.