Skip to content

Commit

Permalink
Merge branch 'mnalis-westnordost-profiles' into mnalis-westnordost-pr…
Browse files Browse the repository at this point in the history
…ofiles-helium314
  • Loading branch information
mnalis committed Jul 14, 2021
2 parents a44cc41 + 72285e6 commit 009c6b7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class AddHandrail : OsmFilterQuestType<Boolean>() {
override val commitMessage = "Add whether steps have a handrail"
override val wikiLink = "Key:handrail"
override val icon = R.drawable.ic_quest_steps_handrail
override val isSplitWayEnabled = true

override fun getTitle(tags: Map<String, String>) = R.string.quest_handrail_title

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class QuestPresetsAdapter @Inject constructor(
private val questPresetsController: QuestPresetsController
) : RecyclerView.Adapter<QuestPresetsAdapter.QuestPresetViewHolder>(), LifecycleObserver {

private val presets: MutableList<QuestPreset> = mutableListOf()
private var presets: MutableList<QuestPreset> = mutableListOf()

private val lifecycleScope = CoroutineScope(SupervisorJob() + Dispatchers.Main)

Expand All @@ -46,6 +46,7 @@ class QuestPresetsAdapter @Inject constructor(

@OnLifecycleEvent(Lifecycle.Event.ON_START)
fun onStart() {
presets = mutableListOf()
presets.add(QuestPreset(0, context.getString(R.string.quest_presets_default_name)))
presets.addAll(questPresetsController.getAllQuestPresets())

Expand Down Expand Up @@ -83,7 +84,7 @@ class QuestPresetsAdapter @Inject constructor(
}
itemView.deleteButton.isEnabled = true
itemView.deleteButton.isInvisible = with.id == 0L
itemView.deleteButton.setOnClickListener { onClickDeleteQuestPreset(with.id) }
itemView.deleteButton.setOnClickListener { onClickDeleteQuestPreset(with) }
}

fun onSelectQuestPreset(presetId: Long) {
Expand All @@ -92,10 +93,10 @@ class QuestPresetsAdapter @Inject constructor(
}
}

fun onClickDeleteQuestPreset(presetId: Long) {
AlertDialog.Builder(itemView.context)
.setMessage(R.string.quest_presets_delete_message)
.setPositiveButton(R.string.delete_confirmation) { _,_ -> deleteQuestPreset(presetId) }
fun onClickDeleteQuestPreset(preset: QuestPreset) {
AlertDialog.Builder(itemView.context, R.style.Theme_Bubble_Dialog_Alert)
.setMessage(itemView.context.getString(R.string.quest_presets_delete_message, preset.name))
.setPositiveButton(R.string.delete_confirmation) { _,_ -> deleteQuestPreset(preset.id) }
.setNegativeButton(android.R.string.cancel, null)
.show()
}
Expand Down
12 changes: 12 additions & 0 deletions app/src/main/res/raw/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
v34.0-beta1: |
<h3>🚌🚴 Quest presets</h3>
<ul>
<li>Show quests that are quick and easy to solve (from a distance) first by default. This makes
contributing more efficient and diverse while also easier to do f.e. as a passenger (#2944, ...)</li>
<li>You can now save different quest presets for different situations, f.e. one preset when you
only want a solve some important quests while on a bus, or on a bike tour etc.<br/>This was
a much requested feature: (#1301, #1654, #1746, #1987, #2054, #2069, #2279, #2565, #2308, #3034, ...)</li>
<li>Inform new users once about the possibility to change quest presets</li>
<li>Added search/filter function for the quest presets settings (#3008)</li>
</ul>
v33.1: |
<ul>
<li>Fix crash when tapping on an achievement in your profile screen (#3027)</li>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1072,5 +1072,5 @@ Otherwise, you can download another keyboard in the app store. Popular keyboards
If you are overwhelmed by the number of quests, you can always fine-tune what quests are displayed to you and in what order in the settings.</string>
<string name="quest_presets_preset_name_hint">New preset name</string>
<string name="quest_presets_default_name">Default</string>
<string name="quest_presets_delete_message">Delete this preset? The quest selection and order for it will be irrevocably lost.</string>
<string name="quest_presets_delete_message">"Delete preset \"%s\"? The quest selection and order for it will be irrevocably lost."</string>
</resources>

0 comments on commit 009c6b7

Please sign in to comment.