diff --git a/core/base/src/main/java/de/mm20/launcher2/icons/Icons.kt b/core/base/src/main/java/de/mm20/launcher2/icons/Icons.kt index 7c8c647cd..00e495a48 100644 --- a/core/base/src/main/java/de/mm20/launcher2/icons/Icons.kt +++ b/core/base/src/main/java/de/mm20/launcher2/icons/Icons.kt @@ -1899,4 +1899,409 @@ private val _LetterSpacing2 = materialIcon("Icons.Rounded.LetterSpacing2") { } val Icons.Rounded.LetterSpacing2 - get() = _LetterSpacing2 \ No newline at end of file + get() = _LetterSpacing2 + +// adapted from: https://www.flaticon.com/free-icons/climb +private val _Climbing = materialIcon("Icons.Rounded.Climbing") { + materialPath { + moveTo(x = 12.9f, y = 23.92f) + curveToRelative( + dx1 = -0.78f, + dy1 = -0.36f, + dx2 = -0.78f, + dy2 = -0.5f, + dx3 = -0.07f, + dy3 = -3.8f, + ) + curveToRelative( + dx1 = 0.8f, + dy1 = -3.7f, + dx2 = 0.19f, + dy2 = -5.73f, + dx3 = -1.73f, + dy3 = -5.73f, + ) + curveToRelative( + dx1 = -1.1f, + dy1 = 0.0f, + dx2 = -3.13f, + dy2 = 0.35f, + dx3 = -3.36f, + dy3 = 0.58f, + ) + curveToRelative( + dx1 = -0.01f, + dy1 = 0.01f, + dx2 = 0.22f, + dy2 = 0.65f, + dx3 = 0.5f, + dy3 = 1.42f, + ) + curveToRelative( + dx1 = 0.73f, + dy1 = 1.93f, + dx2 = 0.7f, + dy2 = 2.46f, + dx3 = -0.19f, + dy3 = 2.7f, + ) + curveTo( + x1 = 7.15f, + y1 = 19.31f, + x2 = 7.0f, + y2 = 19.13f, + x3 = 6.0f, + y3 = 16.44f, + ) + curveToRelative( + dx1 = -0.81f, + dy1 = -2.16f, + dx2 = -0.84f, + dy2 = -2.26f, + dx3 = -0.66f, + dy3 = -2.65f, + ) + curveToRelative( + dx1 = 0.21f, + dy1 = -0.46f, + dx2 = 0.26f, + dy2 = -0.49f, + dx3 = 2.71f, + dy3 = -1.12f, + ) + curveToRelative( + dx1 = 1.6f, + dy1 = -0.42f, + dx2 = 1.6f, + dy2 = -0.42f, + dx3 = 1.6f, + dy3 = -2.73f, + ) + reflectiveCurveToRelative( + dx1 = 0.0f, + dy1 = -2.31f, + dx2 = -1.8f, + dy2 = -2.31f, + ) + curveToRelative( + dx1 = -2.12f, + dy1 = 0.0f, + dx2 = -2.17f, + dy2 = -0.01f, + dx3 = -2.42f, + dy3 = -0.54f, + ) + curveTo( + x1 = 5.28f, + y1 = 6.8f, + x2 = 5.3f, + y2 = 6.73f, + x3 = 6.06f, + y3 = 4.48f, + ) + curveToRelative( + dx1 = 0.96f, + dy1 = -2.85f, + dx2 = 1.06f, + dy2 = -3.0f, + dx3 = 1.84f, + dy3 = -2.75f, + ) + curveTo( + x1 = 8.66f, + y1 = 1.97f, + x2 = 8.67f, + y2 = 2.31f, + x3 = 8.0f, + y3 = 4.28f, + ) + arcToRelative( + a = 24.0f, + b = 24.0f, + theta = 0.0f, + isMoreThanHalf = false, + isPositiveArc = false, + dx1 = -0.5f, + dy1 = 1.56f, + ) + curveToRelative( + dx1 = 0.03f, + dy1 = 0.03f, + dx2 = 9.0f, + dy2 = 0.08f, + dx3 = 9.0f, + dy3 = 0.05f, + ) + lineToRelative(dx = -0.52f, dy = -1.55f) + curveTo( + x1 = 15.36f, + y1 = 2.5f, + x2 = 15.34f, + y2 = 2.37f, + x3 = 15.69f, + y3 = 2.0f, + ) + curveToRelative( + dx1 = 0.34f, + dy1 = -0.37f, + dx2 = 0.93f, + dy2 = -0.38f, + dx3 = 1.26f, + dy3 = -0.03f, + ) + curveToRelative( + dx1 = 0.16f, + dy1 = 0.18f, + dx2 = 0.2f, + dy2 = 0.3f, + dx3 = 0.95f, + dy3 = 2.5f, + ) + curveToRelative( + dx1 = 0.82f, + dy1 = 2.43f, + dx2 = 0.84f, + dy2 = 2.53f, + dx3 = 0.48f, + dy3 = 2.9f, + ) + curveToRelative( + dx1 = -0.28f, + dy1 = 0.3f, + dx2 = -0.24f, + dy2 = 0.3f, + dx3 = -2.23f, + dy3 = 0.3f, + ) + curveToRelative( + dx1 = -1.81f, + dy1 = 0.02f, + dx2 = -1.81f, + dy2 = 0.02f, + dx3 = -1.81f, + dy3 = 3.05f, + ) + reflectiveCurveToRelative( + dx1 = 0.0f, + dy1 = 3.03f, + dx2 = 0.58f, + dy2 = 4.72f, + ) + curveToRelative( + dx1 = 0.33f, + dy1 = 0.94f, + dx2 = 0.6f, + dy2 = 1.8f, + dx3 = 0.62f, + dy3 = 1.9f, + ) + arcToRelative( + a = 78.0f, + b = 78.0f, + theta = 0.0f, + isMoreThanHalf = false, + isPositiveArc = true, + dx1 = -1.3f, + dy1 = 6.1f, + ) + arcToRelative( + a = 1.1f, + b = 1.1f, + theta = 0.0f, + isMoreThanHalf = false, + isPositiveArc = true, + dx1 = -1.33f, + dy1 = 0.48f, + ) + moveToRelative(dx = -5.86f, dy = -2.37f) + curveToRelative( + dx1 = -1.37f, + dy1 = -0.39f, + dx2 = -1.95f, + dy2 = -1.85f, + dx3 = -0.8f, + dy3 = -2.03f, + ) + curveToRelative( + dx1 = 0.19f, + dy1 = -0.02f, + dx2 = 0.24f, + dy2 = 0.0f, + dx3 = 0.43f, + dy3 = 0.12f, + ) + arcToRelative( + a = 1.9f, + b = 1.9f, + theta = 0.0f, + isMoreThanHalf = false, + isPositiveArc = false, + dx1 = 2.37f, + dy1 = -0.17f, + ) + curveToRelative( + dx1 = 0.33f, + dy1 = -0.3f, + dx2 = 0.76f, + dy2 = 0.61f, + dx3 = 0.54f, + dy3 = 1.13f, + ) + curveToRelative( + dx1 = -0.26f, + dy1 = 0.63f, + dx2 = -1.72f, + dy2 = 1.18f, + dx3 = -2.54f, + dy3 = 0.95f, + ) + moveToRelative(dx = 9.6f, dy = -2.34f) + curveToRelative( + dx1 = -0.78f, + dy1 = -0.52f, + dx2 = -0.45f, + dy2 = -1.53f, + dx3 = 0.67f, + dy3 = -2.07f, + ) + quadToRelative( + dx1 = 1.52f, + dy1 = -0.73f, + dx2 = 2.52f, + dy2 = 0.25f, + ) + curveToRelative( + dx1 = 0.81f, + dy1 = 0.8f, + dx2 = 0.43f, + dy2 = 1.34f, + dx3 = -1.04f, + dy3 = 1.45f, + ) + arcToRelative( + a = 3.0f, + b = 3.0f, + theta = 0.0f, + isMoreThanHalf = false, + isPositiveArc = false, + dx1 = -1.09f, + dy1 = 0.26f, + ) + curveToRelative( + dx1 = -0.62f, + dy1 = 0.25f, + dx2 = -0.83f, + dy2 = 0.27f, + dx3 = -1.07f, + dy3 = 0.11f, + ) + moveTo(x = 4.28f, y = 10.89f) + curveToRelative( + dx1 = -1.0f, + dy1 = -0.65f, + dx2 = 0.04f, + dy2 = -2.17f, + dx3 = 1.38f, + dy3 = -2.0f, + ) + curveToRelative( + dx1 = 2.0f, + dy1 = 0.26f, + dx2 = 2.11f, + dy2 = 1.86f, + dx3 = 0.13f, + dy3 = 1.99f, + ) + lineToRelative(dx = -1.0f, dy = 0.06f) + curveToRelative( + dx1 = -0.31f, + dy1 = 0.03f, + dx2 = -0.4f, + dy2 = 0.02f, + dx3 = -0.5f, + dy3 = -0.05f, + ) + moveToRelative(dx = 7.16f, dy = -5.68f) + arcToRelative( + a = 1.82f, + b = 1.82f, + theta = 0.0f, + isMoreThanHalf = true, + isPositiveArc = true, + dx1 = 2.37f, + dy1 = -2.03f, + ) + arcToRelative( + a = 1.84f, + b = 1.84f, + theta = 0.0f, + isMoreThanHalf = false, + isPositiveArc = true, + dx1 = -2.37f, + dy1 = 2.03f, + ) + moveToRelative(dx = 6.5f, dy = -3.2f) + curveToRelative( + dx1 = -0.47f, + dy1 = -1.16f, + dx2 = -1.85f, + dy2 = -1.53f, + dx3 = -2.74f, + dy3 = -0.74f, + ) + arcToRelative( + a = 1.0f, + b = 1.0f, + theta = 0.0f, + isMoreThanHalf = false, + isPositiveArc = true, + dx1 = -0.23f, + dy1 = 0.17f, + ) + arcTo( + horizontalEllipseRadius = 1.6f, + verticalEllipseRadius = 1.6f, + theta = 0.0f, + isMoreThanHalf = false, + isPositiveArc = true, + x1 = 14.8f, + y1 = 0.4f, + ) + curveToRelative( + dx1 = 0.17f, + dy1 = -0.5f, + dx2 = 0.68f, + dy2 = -0.52f, + dx3 = 1.62f, + dy3 = -0.07f, + ) + arcToRelative( + a = 3.0f, + b = 3.0f, + theta = 0.0f, + isMoreThanHalf = false, + isPositiveArc = false, + dx1 = 0.84f, + dy1 = 0.28f, + ) + curveToRelative( + dx1 = 1.22f, + dy1 = 0.18f, + dx2 = 1.34f, + dy2 = 0.26f, + dx3 = 1.33f, + dy3 = 0.9f, + ) + curveToRelative( + dx1 = 0.0f, + dy1 = 0.7f, + dx2 = -0.43f, + dy2 = 1.05f, + dx3 = -0.64f, + dy3 = 0.52f, + ) + } +} + +val Icons.Rounded.Climbing + get() = _Climbing diff --git a/core/base/src/main/java/de/mm20/launcher2/search/Location.kt b/core/base/src/main/java/de/mm20/launcher2/search/Location.kt index 64bf12a8e..42cea6232 100644 --- a/core/base/src/main/java/de/mm20/launcher2/search/Location.kt +++ b/core/base/src/main/java/de/mm20/launcher2/search/Location.kt @@ -7,6 +7,7 @@ import android.os.Bundle import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.rounded.DirectionsBike import androidx.compose.material.icons.rounded.AccountBalance +import androidx.compose.material.icons.rounded.AttachFile import androidx.compose.material.icons.rounded.AttachMoney import androidx.compose.material.icons.rounded.Attractions import androidx.compose.material.icons.rounded.BakeryDining @@ -106,6 +107,7 @@ import androidx.compose.material.icons.rounded.Synagogue import androidx.compose.material.icons.rounded.TakeoutDining import androidx.compose.material.icons.rounded.TempleBuddhist import androidx.compose.material.icons.rounded.TempleHindu +import androidx.compose.material.icons.rounded.Terminal import androidx.compose.material.icons.rounded.TheaterComedy import androidx.compose.material.icons.rounded.Theaters import androidx.compose.material.icons.rounded.Train @@ -133,6 +135,8 @@ import de.mm20.launcher2.search.location.PaymentMethod import java.time.LocalDateTime import java.time.temporal.TemporalAdjusters import android.location.Location as AndroidLocation +import androidx.core.net.toUri +import de.mm20.launcher2.icons.Climbing interface Location : SavableSearchable { @@ -167,7 +171,7 @@ interface Location : SavableSearchable { return context.tryStartActivity( Intent( Intent.ACTION_VIEW, - Uri.parse("geo:$latitude,$longitude?q=${Uri.encode(label)}") + "geo:$latitude,$longitude?q=${Uri.encode(label)}".toUri() ), options ) @@ -246,6 +250,7 @@ interface Location : SavableSearchable { LocationIcon.Pharmacy -> Icons.Rounded.LocalPharmacy to R.color.indigo LocationIcon.HairSalon -> Icons.Rounded.ContentCut to R.color.indigo LocationIcon.Laundromat -> Icons.Rounded.LocalLaundryService to R.color.indigo + LocationIcon.Stationery -> Icons.Rounded.AttachFile to R.color.indigo // purple: sports and recreation LocationIcon.Sports -> Icons.Rounded.Sports to R.color.purple LocationIcon.FitnessCenter -> Icons.Rounded.FitnessCenter to R.color.purple @@ -266,12 +271,14 @@ interface Location : SavableSearchable { LocationIcon.Kayaking -> Icons.Rounded.Kayaking to R.color.purple LocationIcon.Skateboarding -> Icons.Rounded.Skateboarding to R.color.purple LocationIcon.Cricket -> Icons.Rounded.SportsCricket to R.color.purple + LocationIcon.Climbing -> Icons.Rounded.Climbing to R.color.purple LocationIcon.MartialArts -> Icons.Rounded.SportsMartialArts to R.color.purple LocationIcon.NordicWalking -> Icons.Rounded.NordicWalking to R.color.purple LocationIcon.Paragliding -> Icons.Rounded.Paragliding to R.color.purple LocationIcon.Gymnastics -> Icons.Rounded.SportsGymnastics to R.color.purple LocationIcon.Snowboarding -> Icons.Rounded.Snowboarding to R.color.purple LocationIcon.Hockey -> Icons.Rounded.SportsHockey to R.color.purple + LocationIcon.Hackerspace -> Icons.Rounded.Terminal to R.color.purple // green: finances LocationIcon.Bank -> Icons.Rounded.AttachMoney to R.color.green LocationIcon.Atm -> Icons.Rounded.LocalAtm to R.color.green diff --git a/core/i18n/src/main/res/values-de/strings.xml b/core/i18n/src/main/res/values-de/strings.xml index f013a7356..9f81a50a4 100644 --- a/core/i18n/src/main/res/values-de/strings.xml +++ b/core/i18n/src/main/res/values-de/strings.xml @@ -717,6 +717,8 @@ Feuerwache Gerichtsgebäude Rathaus + Schreibwarenladen + Kletterhalle Abmelden Beschriftung Anzeigen in diff --git a/core/i18n/src/main/res/values/strings.xml b/core/i18n/src/main/res/values/strings.xml index d73a8342b..2d933b5df 100644 --- a/core/i18n/src/main/res/values/strings.xml +++ b/core/i18n/src/main/res/values/strings.xml @@ -987,6 +987,9 @@ Fire station Courthouse Townhall + Stationery + Climbing gym + Hackerspace Label Tags Show in diff --git a/core/shared/src/main/java/de/mm20/launcher2/search/location/LocationIcon.kt b/core/shared/src/main/java/de/mm20/launcher2/search/location/LocationIcon.kt index 66621c877..555f5a7b9 100644 --- a/core/shared/src/main/java/de/mm20/launcher2/search/location/LocationIcon.kt +++ b/core/shared/src/main/java/de/mm20/launcher2/search/location/LocationIcon.kt @@ -70,6 +70,7 @@ enum class LocationIcon { Pharmacy, HairSalon, Laundromat, + Stationery, Sports, FitnessCenter, @@ -89,12 +90,14 @@ enum class LocationIcon { Kayaking, Skateboarding, Cricket, + Climbing, MartialArts, NordicWalking, Paragliding, Gymnastics, Snowboarding, Hockey, + Hackerspace, Rugby, Bank, diff --git a/data/locations/src/main/java/de/mm20/launcher2/locations/providers/openstreetmaps/OsmLocation.kt b/data/locations/src/main/java/de/mm20/launcher2/locations/providers/openstreetmaps/OsmLocation.kt index 760f851e8..28f853fa0 100644 --- a/data/locations/src/main/java/de/mm20/launcher2/locations/providers/openstreetmaps/OsmLocation.kt +++ b/data/locations/src/main/java/de/mm20/launcher2/locations/providers/openstreetmaps/OsmLocation.kt @@ -224,6 +224,7 @@ private fun Map.categorize(context: Context): Pair R.string.poi_category_optician to LocationIcon.Optician "hairdresser" -> R.string.poi_category_hairdresser to LocationIcon.HairSalon "laundry" -> R.string.poi_category_laundry to LocationIcon.Laundromat + "stationery" -> R.string.poi_category_stationery to LocationIcon.Stationery else -> R.string.poi_category_shopping to LocationIcon.Shopping } @@ -308,7 +309,7 @@ private fun Map.categorize(context: Context): Pair R.string.poi_category_stadium to LocationIcon.Stadium "fitness_centre" -> R.string.poi_category_fitness_center to LocationIcon.FitnessCenter "swimming_pool" -> R.string.poi_category_swimming to LocationIcon.Swimming - "pitch", "sports_centre" -> matchAnyTag("sport") { + "pitch", "sports_centre", "sports_hall" -> matchAnyTag("sport") { "soccer" with (R.string.poi_category_soccer to LocationIcon.Soccer) "tennis" with (R.string.poi_category_tennis to LocationIcon.Tennis) "basketball" with (R.string.poi_category_basketball to LocationIcon.Basketball) @@ -321,10 +322,12 @@ private fun Map.categorize(context: Context): Pair R.string.poi_category_golf to LocationIcon.Golf "park" -> R.string.poi_category_park to LocationIcon.Park + "hackerspace" -> R.string.poi_category_hackerspace to LocationIcon.Hackerspace else -> null } } diff --git a/data/locations/src/main/java/de/mm20/launcher2/locations/providers/openstreetmaps/OsmLocationProvider.kt b/data/locations/src/main/java/de/mm20/launcher2/locations/providers/openstreetmaps/OsmLocationProvider.kt index fbb2bc47a..73c79279f 100644 --- a/data/locations/src/main/java/de/mm20/launcher2/locations/providers/openstreetmaps/OsmLocationProvider.kt +++ b/data/locations/src/main/java/de/mm20/launcher2/locations/providers/openstreetmaps/OsmLocationProvider.kt @@ -10,6 +10,7 @@ import de.mm20.launcher2.preferences.search.LocationSearchSettings import de.mm20.launcher2.search.Location import de.mm20.launcher2.search.ResultScore import de.mm20.launcher2.search.UpdateResult +import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.toImmutableList import kotlinx.coroutines.CancellationException import kotlinx.coroutines.CoroutineScope @@ -150,104 +151,107 @@ internal class OsmLocationProvider( } private val poiCategories = mapOf( - R.string.poi_category_restaurant to "amenity=restaurant", - R.string.poi_category_fast_food to "amenity=fast_food", - R.string.poi_category_bar to "amenity=bar", - R.string.poi_category_cafe to "amenity=cafe", - R.string.poi_category_hotel to "tourism=hotel", - R.string.poi_category_supermarket to "shop=supermarket", - R.string.poi_category_school to "amenity=school", - R.string.poi_category_parking to "amenity=parking", - R.string.poi_category_fuel to "amenity=fuel", - R.string.poi_category_toilets to "amenity=toilets", - R.string.poi_category_pharmacy to "amenity=pharmacy", - R.string.poi_category_hospital to "amenity=hospital", - R.string.poi_category_post_office to "amenity=post_office", - R.string.poi_category_pub to "amenity=pub", - R.string.poi_category_doctors to "amenity=doctors", - R.string.poi_category_police to "amenity=police", - R.string.poi_category_dentist to "amenity=dentist", - R.string.poi_category_library to "amenity=library", - R.string.poi_category_ice_cream to "amenity=ice_cream", - R.string.poi_category_theater to "amenity=theatre", - R.string.poi_category_cinema to "amenity=cinema", - R.string.poi_category_nightclub to "amenity=nightclub", - R.string.poi_category_clinic to "amenity=clinic", - R.string.poi_category_university to "amenity=university", - R.string.poi_category_clothes to "shop=clothes", - R.string.poi_category_convenience to "shop=convenience", - R.string.poi_category_hairdresser to "shop=hairdresser", - R.string.poi_category_books to "shop=books", - R.string.poi_category_bakery to "shop=bakery", - R.string.poi_category_car_rental to "amenity=car_rental", - R.string.poi_category_car_sharing to "amenity=car_sharing", - R.string.poi_category_mobile_phone to "shop=mobile_phone", - R.string.poi_category_furniture to "shop=furniture", - R.string.poi_category_alcohol to "shop=alcohol", - R.string.poi_category_florist to "shop=florist", - R.string.poi_category_mall to "shop=mall", - R.string.poi_category_optician to "shop=optician", - R.string.poi_category_jewelry to "shop=jewelry", - R.string.poi_category_laundry to "amenity=laundry", - R.string.poi_category_bank to "amenity=bank", - R.string.poi_category_soccer to "leisure=pitch,sport=soccer", - R.string.poi_category_basketball to "leisure=pitch,sport=basketball", - R.string.poi_category_tennis to "leisure=pitch,sport=tennis", - R.string.poi_category_atm to "amenity=atm", - R.string.poi_category_kiosk to "shop=kiosk", - R.string.poi_category_museum to "tourism=museum", - R.string.poi_category_fitness_center to "leisure=fitness_centre", - R.string.poi_category_church to "amenity=place_of_worship,religion=christian", - R.string.poi_category_mosque to "amenity=place_of_worship,religion=muslim", - R.string.poi_category_buddhist_temple to "amenity=place_of_worship,religion=buddhist", - R.string.poi_category_hindu_temple to "amenity=place_of_worship,religion=hindu", - R.string.poi_category_synagogue to "amenity=place_of_worship,religion=jewish", - R.string.poi_category_pizza_restaurant to "amenity=restaurant,cuisine=pizza", - R.string.poi_category_burger_restaurant to "amenity=restaurant,cuisine=burger", - R.string.poi_category_place_of_worship to "amenity=place_of_worship", - R.string.poi_category_chinese_restaurant to "amenity=restaurant,cuisine=chinese", - R.string.poi_category_japanese_restaurant to "amenity=restaurant,cuisine=japanese", - R.string.poi_category_kebab_restaurant to "amenity=restaurant,cuisine=kebab", - R.string.poi_category_asian_restaurant to "amenity=restaurant,cuisine=asian", - R.string.poi_category_ramen_restaurant to "amenity=restaurant,cuisine=ramen", - R.string.poi_category_soup_restaurant to "amenity=restaurant,cuisine=soup", - R.string.poi_category_brunch_restaurant to "amenity=restaurant,cuisine=brunch", - R.string.poi_category_car_wash to "amenity=car_wash", - R.string.poi_category_charging_station to "amenity=charging_station", - R.string.poi_category_motorcycle_rental to "amenity=motorcycle_rental", - R.string.poi_category_gallery to "tourism=gallery", - R.string.poi_category_amusement_park to "tourism=theme_park", - R.string.poi_category_concert_hall to "amenity=concert_hall", - R.string.poi_category_stadium to "leisure=stadium", - R.string.poi_category_casino to "amenity=casino", - R.string.poi_category_discount_store to "shop=discount", - R.string.poi_category_pet to "shop=pet", - R.string.poi_category_shopping to "shop=mall", - R.string.poi_category_swimming to "leisure=swimming_pool", - R.string.poi_category_martial_arts to "leisure=sports_centre,sport=martial_arts", - R.string.poi_category_golf to "leisure=golf_course", - R.string.poi_category_gymnastics to "leisure=sports_hall,sport=gymnastics", - R.string.poi_category_ice_hockey to "leisure=sports_centre,sport=ice_hockey", - R.string.poi_category_baseball to "leisure=pitch,sport=baseball", - R.string.poi_category_american_football to "leisure=pitch,sport=american_football", - R.string.poi_category_handball to "leisure=pitch,sport=handball", - R.string.poi_category_volleyball to "leisure=pitch,sport=volleyball", - R.string.poi_category_skiing to "leisure=piste", - R.string.poi_category_cricket to "leisure=pitch,sport=cricket", - R.string.poi_category_park to "leisure=park", - R.string.poi_category_monument to "historic=monument", - R.string.poi_category_government_building to "building=government", - R.string.poi_category_fire_station to "amenity=fire_station", - R.string.poi_category_courthouse to "amenity=courthouse", - R.string.poi_category_townhall to "amenity=townhall" + R.string.poi_category_restaurant to listOf("amenity=restaurant"), + R.string.poi_category_fast_food to listOf("amenity=fast_food"), + R.string.poi_category_bar to listOf("amenity=bar"), + R.string.poi_category_cafe to listOf("amenity=cafe"), + R.string.poi_category_hotel to listOf("tourism=hotel"), + R.string.poi_category_supermarket to listOf("shop=supermarket"), + R.string.poi_category_school to listOf("amenity=school"), + R.string.poi_category_parking to listOf("amenity=parking"), + R.string.poi_category_fuel to listOf("amenity=fuel"), + R.string.poi_category_toilets to listOf("amenity=toilets"), + R.string.poi_category_pharmacy to listOf("amenity=pharmacy"), + R.string.poi_category_hospital to listOf("amenity=hospital"), + R.string.poi_category_post_office to listOf("amenity=post_office"), + R.string.poi_category_pub to listOf("amenity=pub"), + R.string.poi_category_doctors to listOf("amenity=doctors"), + R.string.poi_category_police to listOf("amenity=police"), + R.string.poi_category_dentist to listOf("amenity=dentist"), + R.string.poi_category_library to listOf("amenity=library"), + R.string.poi_category_ice_cream to listOf("amenity=ice_cream"), + R.string.poi_category_theater to listOf("amenity=theatre"), + R.string.poi_category_cinema to listOf("amenity=cinema"), + R.string.poi_category_nightclub to listOf("amenity=nightclub"), + R.string.poi_category_clinic to listOf("amenity=clinic"), + R.string.poi_category_university to listOf("amenity=university"), + R.string.poi_category_clothes to listOf("shop=clothes"), + R.string.poi_category_convenience to listOf("shop=convenience"), + R.string.poi_category_hairdresser to listOf("shop=hairdresser"), + R.string.poi_category_books to listOf("shop=books"), + R.string.poi_category_bakery to listOf("shop=bakery"), + R.string.poi_category_car_rental to listOf("amenity=car_rental"), + R.string.poi_category_car_sharing to listOf("amenity=car_sharing"), + R.string.poi_category_mobile_phone to listOf("shop=mobile_phone"), + R.string.poi_category_furniture to listOf("shop=furniture"), + R.string.poi_category_alcohol to listOf("shop=alcohol"), + R.string.poi_category_florist to listOf("shop=florist"), + R.string.poi_category_mall to listOf("shop=mall"), + R.string.poi_category_optician to listOf("shop=optician"), + R.string.poi_category_jewelry to listOf("shop=jewelry"), + R.string.poi_category_laundry to listOf("amenity=laundry"), + R.string.poi_category_bank to listOf("amenity=bank"), + R.string.poi_category_soccer to listOf("leisure=pitch,sport=soccer"), + R.string.poi_category_basketball to listOf("leisure=pitch,sport=basketball"), + R.string.poi_category_tennis to listOf("leisure=pitch,sport=tennis"), + R.string.poi_category_atm to listOf("amenity=atm"), + R.string.poi_category_kiosk to listOf("shop=kiosk"), + R.string.poi_category_museum to listOf("tourism=museum"), + R.string.poi_category_fitness_center to listOf("leisure=fitness_centre"), + R.string.poi_category_church to listOf("amenity=place_of_worship,religion=christian"), + R.string.poi_category_mosque to listOf("amenity=place_of_worship,religion=muslim"), + R.string.poi_category_buddhist_temple to listOf("amenity=place_of_worship,religion=buddhist"), + R.string.poi_category_hindu_temple to listOf("amenity=place_of_worship,religion=hindu"), + R.string.poi_category_synagogue to listOf("amenity=place_of_worship,religion=jewish"), + R.string.poi_category_pizza_restaurant to listOf("amenity=restaurant,cuisine=pizza"), + R.string.poi_category_burger_restaurant to listOf("amenity=restaurant,cuisine=burger"), + R.string.poi_category_place_of_worship to listOf("amenity=place_of_worship"), + R.string.poi_category_chinese_restaurant to listOf("amenity=restaurant,cuisine=chinese"), + R.string.poi_category_japanese_restaurant to listOf("amenity=restaurant,cuisine=japanese"), + R.string.poi_category_kebab_restaurant to listOf("amenity=restaurant,cuisine=kebab"), + R.string.poi_category_asian_restaurant to listOf("amenity=restaurant,cuisine=asian"), + R.string.poi_category_ramen_restaurant to listOf("amenity=restaurant,cuisine=ramen"), + R.string.poi_category_soup_restaurant to listOf("amenity=restaurant,cuisine=soup"), + R.string.poi_category_brunch_restaurant to listOf("amenity=restaurant,cuisine=brunch"), + R.string.poi_category_car_wash to listOf("amenity=car_wash"), + R.string.poi_category_charging_station to listOf("amenity=charging_station"), + R.string.poi_category_motorcycle_rental to listOf("amenity=motorcycle_rental"), + R.string.poi_category_gallery to listOf("tourism=gallery"), + R.string.poi_category_amusement_park to listOf("tourism=theme_park"), + R.string.poi_category_concert_hall to listOf("amenity=concert_hall"), + R.string.poi_category_stadium to listOf("leisure=stadium"), + R.string.poi_category_casino to listOf("amenity=casino"), + R.string.poi_category_discount_store to listOf("shop=discount"), + R.string.poi_category_pet to listOf("shop=pet"), + R.string.poi_category_shopping to listOf("shop=mall"), + R.string.poi_category_swimming to listOf("leisure=swimming_pool"), + R.string.poi_category_martial_arts to listOf("leisure=sports_centre", "leisure=sports_hall").map { "$it,sport=martial_arts" }, + R.string.poi_category_golf to listOf("leisure=golf_course"), + R.string.poi_category_gymnastics to listOf("leisure=sports_hall", "leisure=sports_centre").map { "$it,sport=gymnastics" }, + R.string.poi_category_ice_hockey to listOf("leisure=sports_hall", "leisure=sports_centre").map { "$it,sport=ice_hockey" }, + R.string.poi_category_baseball to listOf("leisure=pitch,sport=baseball"), + R.string.poi_category_american_football to listOf("leisure=pitch,sport=american_football"), + R.string.poi_category_handball to listOf("leisure=pitch,sport=handball"), + R.string.poi_category_volleyball to listOf("leisure=pitch,sport=volleyball"), + R.string.poi_category_skiing to listOf("leisure=piste"), + R.string.poi_category_cricket to listOf("leisure=pitch,sport=cricket"), + R.string.poi_category_park to listOf("leisure=park"), + R.string.poi_category_monument to listOf("historic=monument"), + R.string.poi_category_government_building to listOf("building=government"), + R.string.poi_category_fire_station to listOf("amenity=fire_station"), + R.string.poi_category_courthouse to listOf("amenity=courthouse"), + R.string.poi_category_townhall to listOf("amenity=townhall"), + R.string.poi_category_stationery to listOf("shop=stationery"), + R.string.poi_category_climbing_gym to listOf("leisure=sports_hall", "leisure=sports_centre").map { "$it,sport=climbing" }, + R.string.poi_category_hackerspace to listOf("leisure=hackerspace") ).mapKeys { context.getString(it.key) } private fun delocalizeToQueryableTags(localizedQuery: String): List = - poiCategories.mapNotNull { (string, tags) -> + poiCategories.flatMap { (string, tags) -> val score = ResultScore( localizedQuery, primaryFields = listOf(string) ) - if (score.score > 0.8f) tags else null + if (score.score > 0.8f) tags else persistentListOf() } }