forked from streetcomplete/StreetComplete
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
583 additions
and
0 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
38 changes: 38 additions & 0 deletions
38
app/src/main/java/de/westnordost/streetcomplete/quests/religion/AddChristianDenomination.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,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) | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...c/main/java/de/westnordost/streetcomplete/quests/religion/AddChristianDenominationForm.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,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()) | ||
} | ||
} | ||
|
9 changes: 9 additions & 0 deletions
9
app/src/main/java/de/westnordost/streetcomplete/quests/religion/ChristianDenomination.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,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"), | ||
} |
6 changes: 6 additions & 0 deletions
6
app/src/main/java/de/westnordost/streetcomplete/quests/religion/Denomination.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,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"), | ||
} |
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,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> |
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.