Skip to content

Commit

Permalink
Merge branch 'master' into modified
Browse files Browse the repository at this point in the history
  • Loading branch information
Helium314 committed Oct 8, 2024
2 parents 53c564d + b48bb09 commit 8bc1d21
Show file tree
Hide file tree
Showing 74 changed files with 2,037 additions and 190 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## v59.2

- Second try: Crash issue on subsequent app starts is maybe fixed in MapLibre (#5850)
- Fix notes that contained a "&" weren't showing correctly (#5938)
- added Argentinian Spanish by Ignacio L'Episcopo
- Show remarks from other mappers in all quest and overlay forms (#5794, #5889), by @kmpoppe
- Clarify some wordings (#5927, #5936), thanks @schra
- Places overlay: Various small improvements (#5926, #5940, #5944), by @mnalis
- Power supply: Also ask for alpine huts (#5943)

## v59.1

- Crash issue on subsequent app starts was maybe fixed in MapLibre (#5850)
Expand Down
6 changes: 5 additions & 1 deletion CONTRIBUTING_A_NEW_QUEST.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ Keep similar style to existing ones and the app in general. Note that the backgr

Once the quest icon is ready:

- when using Inkscape, save as "Optimized SVG" to remove unnecessary cruft or use another tool for that, like [svgo](https://github.com/svg/svgo)
- when using Inkscape, save as "Optimized SVG" to remove unnecessary cruft or use another tool for that, like [svgo](https://github.com/svg/svgo) or online [SVGOMG](https://svgomg.net/)
- Put SVG into [`res/graphics/quest`](res/graphics/quest) folder
- SVG is a standard format editable in various software, unlike internal Android Studio XML that will be produced in the next steps.
- Open Android Studio
Expand Down Expand Up @@ -464,6 +464,10 @@ Each of these folders should hold the same image resized to a different resoluti

The [rescaling script](https://github.com/matkoniecz/rescaling_for_android) may be useful, but you can also do this manually with Gimp or similar software.

Please make sure that the images do not take too much disk space. Most useful way to do that is by lowering JPEG quality, which can make images noticeably smaller. Play with settings to see which is the smallest size which does not degrade image quality visibly.

[GIMP](https://gimp.org/) allows such previews while saving JPG files, and there are also online tools like [squoosh](https://squoosh.app/) which allow for quick visual comparison if you prefer that.

Please try to keep the images small (consider they already make up more than half of the APK size), and consider using vector graphics instead of photos where it's reasonable.

After adding a photo, remember to update [the credits file](app/src/main/res/authors.txt) (different to the one for icons).
Expand Down
8 changes: 4 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ android {
applicationId = "de.westnordost.streetcomplete.expert"
minSdk = 21
targetSdk = 34
versionCode = 5906
versionName = "59.1"
versionCode = 5907
versionName = "59.2"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

Expand Down Expand Up @@ -203,7 +203,7 @@ dependencies {
implementation("io.github.pdvrieze.xmlutil:core:0.90.1")

// map and location
implementation("org.maplibre.gl:android-sdk:11.5.0")
implementation("org.maplibre.gl:android-sdk:11.5.1")

// opening hours parser
implementation("de.westnordost:osm-opening-hours:0.1.0")
Expand Down Expand Up @@ -232,7 +232,7 @@ dependencies {
/** Localizations that should be pulled from POEditor */
val bcp47ExportLanguages = setOf(
"ar", "ast", "be", "bg", "bs", "ca", "cs", "da", "de", "el",
"en", "en-AU", "en-GB", "eo", "es", "eu", "fa", "fi", "fr", "gl", "he", "hr", "hu", "hy",
"en", "en-AU", "en-GB", "eo", "es", "es-AR", "eu", "fa", "fi", "fr", "gl", "he", "hr", "hu", "hy",
"id", "it", "ja", "ko", "lt", "lv", "nb", "no", "nl", "nn", "pl", "pt", "pt-BR",
"ro", "ru", "sk", "sl", "sr-cyrl", "sr-latn", "sv", "sw", "th", "tr", "uk",
"zh", "zh-CN", "zh-HK", "zh-TW"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,42 +22,45 @@ private fun XmlReader.parseNotes(): List<Note> = try {

var note: ApiNote? = null
var comment: ApiNoteComment? = null
val names = ArrayList<String>()
var string = ""

forEach { when (it) {
START_ELEMENT -> {
when (localName) {
"note" -> note = ApiNote(LatLon(attribute("lat").toDouble(), attribute("lon").toDouble()))
"comment" -> comment = ApiNoteComment()
}
names.add(localName)
string = ""
}
TEXT -> when (names.lastOrNull()) {
// regarding IGNORABLE_WHITESPACE: https://github.com/pdvrieze/xmlutil/issues/241
TEXT, ENTITY_REF, CDSECT, IGNORABLE_WHITESPACE -> {
string += text
}
END_ELEMENT -> when (localName) {
// in note
"id" -> note?.id = string.toLong()
"date_created" -> note?.timestampCreated = parseTimestamp(string)
"date_closed" -> note?.timestampClosed = parseTimestamp(string)
"status" -> note?.status = Note.Status.valueOf(string.uppercase())

// in comment
"date" -> comment?.date = parseTimestamp(string)
"action" -> comment?.action = NoteComment.Action.valueOf(string.uppercase())
"text" -> comment?.text = string
"uid" -> comment?.uid = string.toLong()
"user" -> comment?.user = string

// note
"id" -> note?.id = text.toLong()
"date_created" -> note?.timestampCreated = parseTimestamp(text)
"date_closed" -> note?.timestampClosed = parseTimestamp(text)
"status" -> note?.status = Note.Status.valueOf(text.uppercase())
"note" -> {
val n = note!!
result.add(Note(n.position, n.id!!, n.timestampCreated!!, n.timestampClosed, n.status!!, n.comments))
}
// comment
"date" -> comment?.date = parseTimestamp(text)
"action" -> comment?.action = NoteComment.Action.valueOf(text.uppercase())
"text" -> comment?.text = text
"uid" -> comment?.uid = text.toLong()
"user" -> comment?.user = text
}
END_ELEMENT -> {
when (localName) {
"note" -> {
val n = note!!
result.add(Note(n.position, n.id!!, n.timestampCreated!!, n.timestampClosed, n.status!!, n.comments))
}
"comment" -> {
val c = comment!!
val cUser = if (c.user != null && c.uid != null) User(c.uid!!, c.user!!) else null
note?.comments?.add(NoteComment(c.date!!, c.action!!, c.text, cUser))
}
"comment" -> {
val c = comment!!
val cUser = if (c.user != null && c.uid != null) User(c.uid!!, c.user!!) else null
note?.comments?.add(NoteComment(c.date!!, c.action!!, c.text, cUser))
}
names.removeLastOrNull()
}
else -> {}
} }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import android.view.View
import android.view.ViewGroup
import android.widget.EditText
import android.widget.PopupMenu
import android.widget.RelativeLayout
import androidx.annotation.UiThread
import androidx.appcompat.app.AlertDialog
import androidx.core.os.bundleOf
Expand Down Expand Up @@ -233,6 +234,7 @@ abstract class AbstractOverlayForm :
setTitleHintLabel(
element?.let { getNameAndLocationSpanned(it, resources, featureDictionary) }
)
setObjNote(element?.tags?.get("note"))

binding.moreButton.setOnClickListener {
showOtherAnswers()
Expand Down Expand Up @@ -281,6 +283,19 @@ abstract class AbstractOverlayForm :
_binding = null
}

protected fun setObjNote(text: CharSequence?) {
binding.noteLabel.text = text
val titleHintLayout = (binding.titleHintLabelContainer.layoutParams as? RelativeLayout.LayoutParams)
titleHintLayout?.removeRule(RelativeLayout.ABOVE)
titleHintLayout?.addRule(RelativeLayout.ABOVE,
if (binding.noteLabel.text.isEmpty())
binding.speechbubbleContentContainer.id
else
binding.speechbubbleNoteContainer.id
)
binding.speechbubbleNoteContainer.isGone = binding.noteLabel.text.isEmpty()
}

/* --------------------------------- IsCloseableBottomSheet ------------------------------- */

@UiThread override fun onClickMapAt(position: LatLon, clickAreaSizeInMeters: Double): Boolean = false
Expand Down Expand Up @@ -378,7 +393,7 @@ abstract class AbstractOverlayForm :
protected abstract fun onClickOk()

protected inline fun <reified T : ViewBinding> contentViewBinding(
noinline viewBinder: (View) -> T
noinline viewBinder: (View) -> T,
) = FragmentViewBindingPropertyDelegate(this, viewBinder, R.id.content)

/* -------------------------------------- ...-Button -----------------------------------------*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ class PlacesOverlayForm : AbstractOverlayForm() {
}
}

/** return the id of the feature, without any brand stuff */
private val Feature.featureId get() = if (isSuggestion) id.substringBeforeLast("/") else id

private suspend fun createEditAction(
element: Element?,
geometry: ElementGeometry,
Expand All @@ -261,24 +264,32 @@ private suspend fun createEditAction(
val tagChanges = StringMapChangesBuilder(element?.tags ?: emptyMap())

val hasAddedNames = previousNames.isEmpty() && newNames.isNotEmpty()
val hasChangedNames = previousNames != newNames
var hasChangedNames = previousNames != newNames
val hasChangedFeature = newFeature != previousFeature
val hasChangedFeatureType = previousFeature?.featureId != newFeature.featureId
val isFeatureWithName = newFeature.addTags.get("name") != null
val wasFeatureWithName = previousFeature?.addTags?.get("name") != null
val wasVacant = element != null && element.isDisusedPlace()
val isVacant = newFeature.id == "shop/vacant"

if (newFeature.isSuggestion) {
// selecting NSI preset will always return empty newNames, even if NSI does set new name=* tag
hasChangedNames = parseLocalizedNames(newFeature.addTags) != previousNames
}

val shouldNotReplaceShop =
// if NSI added e.g. wikidata details, but neither names nor types changed (see #5940)
!hasChangedNames && !hasChangedFeatureType
// only a name was added (name was missing before; user wouldn't be able to answer
// if the place changed or not anyway, so rather keep previous information)
hasAddedNames && !hasChangedFeature
|| hasAddedNames && !hasChangedFeature
// previously: only the feature was changed, the non-empty name did not change
// - see #5195
// place has been added, nothing to replace
|| element == null
val shouldAlwaysReplaceShop =
// the feature is or was a brand feature (i.e. overwrites the name)
isFeatureWithName || wasFeatureWithName
// the feature is or was a brand feature (i.e. overwrites the name) and the type has changed
(isFeatureWithName || wasFeatureWithName) && hasChangedFeatureType
// was vacant before but not anymore (-> cleans up any previous tags that may be
// associated with the old place)
|| wasVacant && hasChangedFeature
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ abstract class AbstractOsmQuestForm<T> : AbstractQuestForm(), IsShowingQuestDeta

setTitle(getString(osmElementQuestType.getTitle(element.tags)))
setTitleHintLabel(getNameAndLocationSpanned(element, resources, featureDictionary))
setObjNote(element.tags["note"])

if (!TagEditor.showingTagEditor && prefs.getBoolean(Prefs.SHOW_HIDE_BUTTON, false)) {
floatingBottomView2.popIn()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package de.westnordost.streetcomplete.quests

import android.graphics.drawable.Drawable
import android.os.Bundle
import android.text.Editable
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand Down Expand Up @@ -175,6 +176,10 @@ abstract class AbstractQuestForm :
updateInfoButtonVisibility()
}

protected fun setObjNote(text: CharSequence?) {
binding.noteLabel.text = text
binding.speechbubbleNoteContainer.isGone = binding.noteLabel.text.isEmpty()
}
protected fun setHintImages(images: List<Drawable>) {
binding.infoPictures.isGone = images.isEmpty()
binding.infoPictures.removeAllViews()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class AddCampPower : OsmFilterQuestType<Boolean>() {
* values from other editors, and we don't want to damage them */
override val elementFilter = """
nodes, ways with
tourism ~ camp_site|caravan_site and (
tourism ~ camp_site|caravan_site|alpine_hut and (
!power_supply
or power_supply older today -4 years and power_supply ~ yes|no
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ class AddCrossing : OsmElementQuestType<CrossingAnswer> {
override val icon = R.drawable.ic_quest_pedestrian
override val achievements = listOf(PEDESTRIAN)

override val hint = R.string.quest_crossing_hint
override val hintImages = listOf(
R.drawable.informal_crossing,
)

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

override fun getHighlightedElements(element: Element, getMapData: () -> MapDataWithGeometry) =
Expand Down Expand Up @@ -70,7 +75,7 @@ class AddCrossing : OsmElementQuestType<CrossingAnswer> {
override fun applyAnswerTo(answer: CrossingAnswer, tags: Tags, geometry: ElementGeometry, timestampEdited: Long) {
when (answer) {
YES -> tags["highway"] = "crossing"
NO -> tags["crossing"] = "informal"
INFORMAL -> tags["crossing"] = "informal"
PROHIBITED -> tags["crossing"] = "no"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ class AddCrossingForm : AListQuestForm<CrossingAnswer>() {

override val items = listOf(
TextItem(YES, R.string.quest_crossing_yes),
TextItem(NO, R.string.quest_crossing_no),
TextItem(INFORMAL, R.string.quest_crossing_no),
TextItem(PROHIBITED, R.string.quest_crossing_prohibited),
)

/*
PROHIBITED is not possible for sidewalks or crossings (=separately mapped sidewalk
infrastructure) because if the crossing does not exist, it would require to also
Expand All @@ -26,8 +25,8 @@ class AddCrossingForm : AListQuestForm<CrossingAnswer>() {
See https://github.com/streetcomplete/StreetComplete/pull/2999#discussion_r681516203
and https://github.com/streetcomplete/StreetComplete/issues/5160
NO on the other hand would be okay because crossing=informal would not require deleting
the crossing ways (I would say... it is in edge case...)
INFORMAL on the other hand would be okay because crossing=informal would not require
deleting the crossing ways (I would say... it is in edge case...)
*/
override fun onClickOk() {
if (checkedItem?.value == PROHIBITED && isOnSidewalkOrCrossing()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ package de.westnordost.streetcomplete.quests.crossing

enum class CrossingAnswer {
YES,
NO,
INFORMAL,
PROHIBITED
}
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ val presetIconIndex = mapOf(
"fas-wifi" to R.drawable.ic_preset_fas_wifi,
"fas-wine-bottle" to R.drawable.ic_preset_fas_wine_bottle,
"iD-restriction-no-u-turn" to R.drawable.ic_preset_id_restriction_no_u_turn,
"iD-restriction-only-u-turn" to R.drawable.ic_preset_id_restriction_only_u_turn,
"maki-aerialway" to R.drawable.ic_preset_maki_aerialway,
"maki-airport" to R.drawable.ic_preset_maki_airport,
"maki-alcohol-shop" to R.drawable.ic_preset_maki_alcohol_shop,
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/authors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ vibrating_button_illustrati... CC-BY 4.0 Tobias Zwick
vibrating_button_i... (MCC234) CC0 CJ Malone
vibrating_button_i... (MCC505) CC0 https://commons.wikimedia.org/wiki/File:An_Australian_pedestrian_crossing_button.jpg (James Cridland)

informal_crossing.jpg CC-SA 2.0 https://wiki.openstreetmap.org/wiki/File:West_Highland_Way_crossing_road_-_geograph.org.uk_-_3986498_(cropped).jpg
ic_quest_tree.xml Public Domain https://commons.wikimedia.org/wiki/File:Broccoli-tree.svg (Dvortygirl)
ic_quest_website.xml Public Domain https://commons.wikimedia.org/wiki/File:Web_(89510)_-_The_Noun_Project.svg

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

45 changes: 45 additions & 0 deletions app/src/main/res/layout/fragment_overlay.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,51 @@
android:id="@+id/bottomSheetContainer"
tools:ignore="RtlHardcoded">

<de.westnordost.streetcomplete.view.MaskSpeechbubbleCornersFrameLayout
android:id="@+id/speechbubbleNoteContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/speech_bubble_none"
android:layout_above="@id/speechbubbleContentContainer"
android:layout_marginStart="@dimen/horizontal_speech_bubble_margin"
android:layout_marginEnd="@dimen/horizontal_speech_bubble_margin"
android:layout_marginBottom="4dp"
android:showDividers="middle"
android:paddingStart="22dp"
android:paddingEnd="22dp"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:divider="@drawable/space_16dp"
android:elevation="@dimen/speech_bubble_elevation"
android:visibility="gone">

<LinearLayout
android:id="@+id/noteArea"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:showDividers="middle">

<TextView
android:id="@+id/titleNoteLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.TitleMedium"
android:text="@string/note_for_object" />

<TextView
android:id="@+id/noteLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.Body"
android:textStyle="italic"
android:textColor="@color/hint_text"
android:autoLink="web"
android:textIsSelectable="true" />

</LinearLayout>

</de.westnordost.streetcomplete.view.MaskSpeechbubbleCornersFrameLayout>

<de.westnordost.streetcomplete.view.MaskSpeechbubbleCornersFrameLayout
android:id="@+id/titleHintLabelContainer"
Expand Down
Loading

0 comments on commit 8bc1d21

Please sign in to comment.