Skip to content

Commit

Permalink
denomination quest initial work
Browse files Browse the repository at this point in the history
  • Loading branch information
matkoniecz committed Oct 21, 2021
1 parent 451335e commit aa68f16
Show file tree
Hide file tree
Showing 9 changed files with 583 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class CountryInfo implements Serializable, Cloneable
List<String> weightLimitUnits;
List<String> popularSports;
List<String> popularReligions;
List<String> popularChristianDenominations;
String firstDayOfWorkweek;
Integer regularShoppingDays;
Integer workweekDays;
Expand Down Expand Up @@ -92,6 +93,12 @@ public List<String> getPopularReligions()
return Collections.unmodifiableList(popularReligions);
}

public List<String> getPopularChristianDenominations()
{
if(popularChristianDenominations == null) return new ArrayList<>(1);
return Collections.unmodifiableList(popularChristianDenominations);
}

public String getFirstDayOfWorkweek()
{
return firstDayOfWorkweek;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ import de.westnordost.streetcomplete.quests.summit_register.AddSummitRegister
import de.westnordost.streetcomplete.quests.recycling.AddRecyclingType
import de.westnordost.streetcomplete.quests.recycling_glass.DetermineRecyclingGlass
import de.westnordost.streetcomplete.quests.recycling_material.AddRecyclingContainerMaterials
import de.westnordost.streetcomplete.quests.religion.AddChristianDenomination
import de.westnordost.streetcomplete.quests.religion.AddReligionToPlaceOfWorship
import de.westnordost.streetcomplete.quests.religion.AddReligionToWaysideShrine
import de.westnordost.streetcomplete.quests.roof_shape.AddRoofShape
Expand Down Expand Up @@ -200,6 +201,7 @@ import javax.inject.Singleton

AddReligionToPlaceOfWorship(), // icons on maps are different - OSM Carto, mapy.cz, OsmAnd, Sputnik etc
AddReligionToWaysideShrine(),
AddChristianDenomination(),

AddPowerPolesMaterial(),

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package de.westnordost.streetcomplete.quests.religion

import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.data.osm.osmquests.OsmFilterQuestType
import de.westnordost.streetcomplete.data.osm.edits.update_tags.StringMapChangesBuilder
import de.westnordost.streetcomplete.data.user.achievements.QuestTypeAchievement.CITIZEN

class AddChristianDenomination : OsmFilterQuestType<Denomination>() {

override val elementFilter = """
nodes, ways, relations with
(
amenity = place_of_worship
or
amenity = monastery
)
and religion=christian
and !denomination or denomination=catholic
"""
override val commitMessage = "Add christian denomination for place of worship"
override val wikiLink = "Key:denomination"
override val icon = R.drawable.ic_quest_christian

override val questTypeAchievements = listOf(CITIZEN)

override fun getTitle(tags: Map<String, String>): Int =
if (tags.containsKey("name"))
R.string.quest_denomination_for_christian_place_of_worship_name_title
else
R.string.quest_denomination_for_christian_place_of_worship_title


override fun createForm() = AddChristianDenominationForm()

override fun applyAnswerTo(answer: Denomination, changes: StringMapChangesBuilder) {
changes.addOrModify("denomination", answer.osmValue)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package de.westnordost.streetcomplete.quests.religion

import android.os.Bundle

import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.quests.AImageListQuestAnswerFragment
import de.westnordost.streetcomplete.quests.AnswerItem
import de.westnordost.streetcomplete.quests.religion.Denomination.*
import de.westnordost.streetcomplete.view.image_select.Item

class AddChristianDenominationForm : AImageListQuestAnswerFragment<Denomination, Denomination>() {

/*
override val otherAnswers = listOf(
AnswerItem(R.string.quest_religion_for_place_of_worship_answer_multi) { applyAnswer(MULTIFAITH) }
)
*/

override val items get() = listOf(
// sorted by worldwide usages, *minus* country specific ones
Item(ROMAN_CATHOLIC, R.drawable.ic_religion_christian, R.string.quest_religion_roman_catholic),
).sortedBy { countryInfo.popularChristianDenominations.indexOf(it.value!!.osmValue) }

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
imageSelector.cellLayoutId = R.layout.cell_icon_select_with_label_below
}

override fun onClickOk(selectedItems: List<Denomination>) {
applyAnswer(selectedItems.single())
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package de.westnordost.streetcomplete.quests.religion

enum class ChristianDenomination(val osmValue: String) {
// sorted by worldwide usages, *minus* country specific ones
// https://wiki.openstreetmap.org/wiki/Key:denomination#Christian_denominations
ROMAN_CATHOLIC("roman_catholic"),
UNSPECIFIC_CATHOLIC("catholic"),
UNSPECIFIC_PROTESTANT("protestant"),
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package de.westnordost.streetcomplete.quests.religion

enum class Denomination(val osmValue: String) {
// sorted by worldwide usages, *minus* country specific ones
ROMAN_CATHOLIC("roman_catholic"),
}
17 changes: 17 additions & 0 deletions app/src/main/res/drawable/ic_quest_christian.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="128dp"
android:height="128dp"
android:viewportWidth="128"
android:viewportHeight="128">
<path
android:pathData="m128,64c0,35.346 -28.654,64 -64,64s-64,-28.654 -64,-64 28.654,-64 64,-64 64,28.654 64,64"
android:strokeWidth=".2"
android:fillColor="#9bbe55"/>
<path
android:fillColor="#FF000000"
android:pathData="m55,25v24h-24v16h24v48h16v-48h24v-16h-24v-24z"
android:fillAlpha="0.2"/>
<path
android:pathData="m55,20v24h-24v16h24v48h16v-48h24v-16h-24v-24z"
android:fillColor="#9d6147"/>
</vector>
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,8 @@ Otherwise, you can download another keyboard in the app store. Popular keyboards
<string name="quest_bench_answer_picnic_table">It’s a picnic table</string>
<string name="quest_religion_for_place_of_worship_name_title">What religion is practiced at %s?</string>
<string name="quest_religion_for_place_of_worship_title">What religion is practiced at this place?</string>
<string name="quest_denomination_for_christian_place_of_worship_name_title">What type of Christianity is practiced at %s?</string>
<string name="quest_denomination_for_christian_place_of_worship_title">What type of Christianity is practiced at this place?</string>
<string name="quest_religion_christian">Christianity</string>
<string name="quest_religion_muslim">Islam</string>
<string name="quest_religion_hindu">Hinduism</string>
Expand Down Expand Up @@ -1092,4 +1094,5 @@ If you are overwhelmed by the number of quests, you can always fine-tune which q
<string name="quest_fireHydrant_diameter_title">What diameter is on this fire hydrant’s sign?</string>
<string name="quest_fireHydrant_diameter_unusualInput_confirmation_description">This diameter looks implausible.</string>
<string name="quest_fireHydrant_confirmation_title">"Are you sure? Sometimes the diameter can be found on the hydrant itself."</string>
<string name="quest_religion_roman_catholic">Roman catholic</string>
</resources>
Loading

0 comments on commit aa68f16

Please sign in to comment.