Skip to content

Commit

Permalink
Merge branch 'mnalis-helium314-noprofiles' 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 d147219 + 148a60f commit 9b7b591
Show file tree
Hide file tree
Showing 12 changed files with 284 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jobs:
uses: jonasb/android-problem-matchers-action@v1
- name: Build the app
run: |
./gradlew assembleDebug && mv app/build/outputs/apk/debug/app-debug.apk app/build/outputs/apk/debug/StreetComplete-mnalis-debug.apk
./gradlew assembleDebug && mv app/build/outputs/apk/debug/app-debug.apk app/build/outputs/apk/debug/StreetComplete-mnalis-helium314-noprofiles-debug.apk
- name: Upload apk
uses: actions/upload-artifact@v2
with:
name: debug apk
path: app/build/outputs/apk/debug/StreetComplete-mnalis-debug.apk
path: app/build/outputs/apk/debug/StreetComplete-mnalis-helium314-noprofiles-debug.apk
27 changes: 26 additions & 1 deletion CHANGES-mnalis.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
## Changes in mnalis branch
## Changes in mnalis-helium314-noprofiles branch

This file details changes made in https://github.com/mnalis/StreetComplete/tree/mnalis
as modified from upstream https://github.com/streetcomplete/StreetComplete

From `mnalis` branch:
* automatic gihub build Actions
to get artifact .apk, so we don't need local android build environment
* update email/github links to this repository
Expand All @@ -12,13 +13,34 @@ as modified from upstream https://github.com/streetcomplete/StreetComplete
including your own (only hide notes that user explicitely asked to hide,
and which can be unhidden via `Restore hidden quests` preference)

Cherry-picked from `helium314` branch (from https://github.com/Helium314/StreetComplete/tree/mods):
* add phone number and website quests (commit a01c492bdc1f7385a7b83acd59fed5100fc55cdf)
* adjust dark theme (commit 3251e335c7839520a2eb95b120d6ad88d333f19c)
* move "none" answer for cycleway to more convenient position (commit 4812c692041d3c3b5ccd4dbbe249132c107317e1)


## TODO
* check https://github.com/Helium314/StreetComplete/tree/mods changes

See https://github.com/streetcomplete/StreetComplete/discussions/3003#discussioncomment-963592

Not included yet:
* add poi "quests" and adjust quest dot offset (commit 2ea50a4433d9db5b5101a739efd4c9e4282959fc)
* add gpx notes (commit a01bc6a2ba54fca1c791237571d6b08a4f1ceb2e)
* add button to reverse quest order (commit 1982e79ef618444bc41cb609f9d5270805a24ab2)
* auto-download only if auto-upload is allowed (commit 52cf846a7544c5c1fbf39f1ef0cae8eb93b945ab)
* UNDONE! (but taking pictures) - rename app (commit 70a2b3be92533f05beadb83e0a66b07ec6bebfde)
* UNDONE! (preparing for westnordost presets) - add quest profiles (commit 3d97a952d355e2ef4b4ee3c6db0670cda60f5876)

* get icon for phone quest from atrate branch?
to update `helium314` quest.
Maybe even check `atrate` code for such quest and merge/replace?

* allow house address quest even if no building type ?
See [issue #2464](https://github.com/streetcomplete/StreetComplete/issues/2464)
* add language selector (or force language to HR in this fork if it is much simpler)
See https://github.com/streetcomplete/StreetComplete/issues/2964#issuecomment-862609036 and related issues.
* replace helium314 reverse quest order button with quick preset change button?
* check https://github.com/matkoniecz/Zazolc ?
* check https://github.com/streetcomplete/StreetComplete/compare/master...pietervdvn:master ?
* make GitHub build signed version, so upgrade does not mean uninstalling and losing all preferences
Expand All @@ -35,6 +57,9 @@ as modified from upstream https://github.com/streetcomplete/StreetComplete
https://coletiv.com/blog/android-github-actions-setup/
https://riggaroo.dev/using-github-actions-to-automate-our-release-process/
https://medium.com/google-developer-experts/github-actions-for-android-developers-6b54c8a32f55
If I need new app name, see Helium314 "rename app" patch (but it breaks taking notes in debug version, so beware/test!)
* implement quest for air compressor
https://github.com/streetcomplete/StreetComplete/issues/3053
* fix images in Notes
can't save them in helim314 branch, probably due to path changes? FIXME is it fixed now with reverted "rename app" Helium314 patch?
* house type quest, allow caching Residental/Commercial too
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ global:
text_fill_color: '#ccf'
text_water_color: '#ccf'

railway_color: '#903'
railway_color: '#603'
road_color: '#559'
road_outline_color: '#99f'
highway_color: '#033'
Expand All @@ -19,13 +19,13 @@ global:
square_color: global.road_color

earth_color: '#2e2e48'
water_color: '#002'
green_color: '#363054'
forest_color: '#403962'
town_color: '#3d364e'
water_color: '#006'
green_color: '#455944'
forest_color: '#375436'
town_color: '#211d2b'

building_color: [0.16, 0.36, 0.36, 0.75]
building_outline_color: [0.12, 0.32, 0.32, 0.75]
building_outline_color: [0.26, 0.6, 0.6, 0.75]

boundary_color: '#e72'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import de.westnordost.streetcomplete.quests.bus_stop_shelter.AddBusStopShelter
import de.westnordost.streetcomplete.quests.car_wash_type.AddCarWashType
import de.westnordost.streetcomplete.quests.construction.MarkCompletedBuildingConstruction
import de.westnordost.streetcomplete.quests.construction.MarkCompletedHighwayConstruction
import de.westnordost.streetcomplete.quests.contact.*
import de.westnordost.streetcomplete.quests.crossing_type.AddCrossingType
import de.westnordost.streetcomplete.quests.crossing_island.AddCrossingIsland
import de.westnordost.streetcomplete.quests.defibrillator.AddIsDefibrillatorIndoor
Expand Down Expand Up @@ -324,6 +325,8 @@ import javax.inject.Singleton
AddKosher(),
AddWheelchairAccessBusiness(featureDictionaryFuture), // used by wheelmap, OsmAnd, MAPS.ME
AddInternetAccess(), // used by OsmAnd
AddContactPhone(), // from Helium314 mods
AddContactWebsite(), // from Helium314 mods

/* ↓ 5.quests that are very numerous ---------------------------------------------------- */

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

import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.data.osm.edits.update_tags.StringMapChangesBuilder
import de.westnordost.streetcomplete.data.osm.osmquests.OsmFilterQuestType

class AddContactPhone : OsmFilterQuestType<String>() {

override val elementFilter = """
nodes, ways, relations with
(
tourism = information and information = office
or """.trimIndent() +

// The common list is shared by the name quest, the opening hours quest and the wheelchair quest.
// So when adding other tags to the common list keep in mind that they need to be appropriate for all those quests.
// Independent tags can by added in the "wheelchair only" tab.

mapOf(
"amenity" to arrayOf(
// common
"restaurant", "cafe", "nightclub","internet_cafe",
"cinema", "townhall", "courthouse", "embassy", "community_centre", "youth_centre", "library",
"dentist", "doctors", "clinic", "veterinary","animal_shelter",

// name & wheelchair only
"arts_centre","ferry_terminal"
),
"tourism" to arrayOf(
// common
"zoo", "aquarium", "gallery", "museum",

// name & wheelchair
"hotel", "guest_house", "motel", "hostel", "alpine_hut", "apartment", "resort", "camp_site", "caravan_site", "chalet" // accommodations

// and tourism = information, see above
),
"shop" to arrayOf(
// common
"beauty", "massage", "hairdresser","boutique","wool","tattoo","electrical","florist","glaziery",
"locksmith","computer","electronics","hifi","mobile_phone","bicycle","outdoor","sports","clothing","art","craft","model",
"musical_instrument","camera","books","travel_agency","cheese","chocolate","coffee","health_food"
),
"leisure" to arrayOf(
// common
"fitness_centre", "bowling_alley","sports_centre"
),
"office" to arrayOf(
// common
"insurance", "government", "travel_agent", "tax_advisor", "religion", "employment_agency",

// name & wheelchair
"lawyer", "estate_agent", "therapist"
),
"craft" to arrayOf(
// common
"carpenter", "shoemaker", "tailor", "photographer", "dressmaker",
"electronics_repair", "key_cutter", "stonemason","winery"
)
).map { it.key + " ~ " + it.value.joinToString("|") }.joinToString("\n or ") +
"\n) and !phone and !contact:phone and !contact:mobile and !brand and name"

override val commitMessage = "Add phone number"
override val wikiLink = "Key:phone"
override val icon = R.drawable.ic_quest_blind_traffic_lights_sound

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

override fun getTitleArgs(tags: Map<String, String>, featureName: Lazy<String?>): Array<String> {
val name = tags["name"]
return if (name != null) arrayOf(name) else arrayOf()
}

override fun createForm() = AddContactPhoneForm()

override fun applyAnswerTo(answer: String, changes: StringMapChangesBuilder) {
changes.add("phone", answer)
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package de.westnordost.streetcomplete.quests.contact

import android.os.Bundle
import android.view.View

import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.quests.AbstractQuestFormAnswerFragment
import de.westnordost.streetcomplete.util.TextChangedWatcher
import kotlinx.android.synthetic.main.quest_phone.*


class AddContactPhoneForm : AbstractQuestFormAnswerFragment<String>() {

override val contentLayoutResId = R.layout.quest_phone

private val contact get() = nameInput?.text?.toString().orEmpty().trim()

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

val prefill = "+" // maybe store or do better?
nameInput.setText(prefill)
nameInput.addTextChangedListener(TextChangedWatcher { checkIsFormComplete() })
}

override fun onClickOk() {
applyAnswer(contact)
}


override fun isFormComplete() = contact.isNotEmpty()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package de.westnordost.streetcomplete.quests.contact

import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.data.osm.edits.update_tags.StringMapChangesBuilder
import de.westnordost.streetcomplete.data.osm.osmquests.OsmFilterQuestType

class AddContactWebsite : OsmFilterQuestType<String>() {

override val elementFilter = """
nodes, ways, relations with
(
tourism = information and information = office
or """.trimIndent() +

// The common list is shared by the name quest, the opening hours quest and the wheelchair quest.
// So when adding other tags to the common list keep in mind that they need to be appropriate for all those quests.
// Independent tags can by added in the "wheelchair only" tab.

mapOf(
"amenity" to arrayOf(
// common
"restaurant", "cafe", "nightclub", // eat & drink
"cinema", "townhall", "courthouse", "embassy", "community_centre", "youth_centre", "library", // civic
"internet_cafe", // commercial
"dentist", "doctors", "clinic", "veterinary", // health
"animal_shelter",

// name & wheelchair only
"arts_centre","ferry_terminal"
),
"tourism" to arrayOf(
// common
"zoo", "aquarium", "gallery", "museum",

// name & wheelchair
"hotel", "guest_house", "motel", "hostel", "alpine_hut", "apartment", "resort", "camp_site", "caravan_site", "chalet" // accommodations
),
"shop" to arrayOf(
// common
"beauty", "massage", "hairdresser","boutique","wool","tattoo","electrical","florist","glaziery",
"computer","electronics","hifi","mobile_phone","bicycle","outdoor","sports","clothing","art","craft","model",
"musical_instrument","camera","books","travel_agency","cheese","chocolate","coffee","health_food"

),
"leisure" to arrayOf(
// common
"fitness_centre", "bowling_alley","sports_centre"
),
"office" to arrayOf(
// common
"insurance", "government", "travel_agent", "tax_advisor", "religion", "employment_agency",

// name & wheelchair
"lawyer", "estate_agent", "therapist"
),
"craft" to arrayOf(
// common
"carpenter", "shoemaker", "tailor", "photographer", "dressmaker",
"electronics_repair", "key_cutter", "stonemason","winery"
)
).map { it.key + " ~ " + it.value.joinToString("|") }.joinToString("\n or ") +
"\n) and !website and !contact:website and !contact:facebook and !contact:instagram and !brand and name"

override val commitMessage = "Add website"
override val wikiLink = "Key:website"
override val icon = R.drawable.ic_quest_wifi

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

override fun getTitleArgs(tags: Map<String, String>, featureName: Lazy<String?>): Array<String> {
val name = tags["name"]
return if (name != null) arrayOf(name) else arrayOf()
}

override fun createForm() = AddContactWebsiteForm()

override fun applyAnswerTo(answer: String, changes: StringMapChangesBuilder) {
changes.add("website", answer)
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package de.westnordost.streetcomplete.quests.contact

import android.os.Bundle
import android.view.View

import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.quests.AbstractQuestFormAnswerFragment
import de.westnordost.streetcomplete.util.TextChangedWatcher
import kotlinx.android.synthetic.main.quest_website.*


class AddContactWebsiteForm : AbstractQuestFormAnswerFragment<String>() {

override val contentLayoutResId = R.layout.quest_website

private val contact get() = nameInput?.text?.toString().orEmpty().trim()

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

nameInput.setText("http://")
nameInput.addTextChangedListener(TextChangedWatcher { checkIsFormComplete() })
}

override fun onClickOk() {
applyAnswer(contact)
}


override fun isFormComplete() = contact.isNotEmpty()
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ fun Cycleway.getTitleResId(): Int = when(this) {
}

val DISPLAYED_CYCLEWAY_ITEMS: List<Cycleway> = listOf(
NONE,
TRACK,
EXCLUSIVE_LANE,
ADVISORY_LANE,
UNSPECIFIED_LANE,
SUGGESTION_LANE,
SEPARATE,
NONE,
PICTOGRAMS,
BUSWAY,
SIDEWALK_EXPLICIT,
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/res/layout/quest_phone.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<EditText
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/nameInput"
android:inputType="phone"
android:textSize="40sp"
tools:text="Bürger König"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
10 changes: 10 additions & 0 deletions app/src/main/res/layout/quest_website.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<EditText
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/nameInput"
android:inputType="textUri"
android:textSize="40sp"
tools:text="Bürger König"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,8 @@ Otherwise, you can download another keyboard in the app store. Popular keyboards
<string name="quest_religion_for_place_of_worship_title">What religion is practiced at this place?</string>
<string name="quest_religion_christian">Christianity</string>
<string name="quest_religion_muslim">Islam</string>
<string name="quest_contact_phone">"What is the phone number of %s?"</string>
<string name="quest_contact_website">"What is the website of %s?"</string>
<string name="quest_religion_hindu">Hinduism</string>
<string name="quest_religion_buddhist">Buddhism</string>
<string name="quest_religion_shinto">Shinto</string>
Expand Down

0 comments on commit 9b7b591

Please sign in to comment.