From 801bb9e51c502d8fcedb8e89d8cfd9dd0931edd3 Mon Sep 17 00:00:00 2001 From: Igor Bubelov Date: Fri, 11 Oct 2024 17:02:02 +0700 Subject: [PATCH] Remove deprecated tile service dependency --- .../androidMain/kotlin/area/AreaAdapter.kt | 2 -- .../kotlin/element/ElementFragment.kt | 2 -- app/src/androidMain/kotlin/map/MapFragment.kt | 1 - .../kotlin/map/MapViewExtensions.kt | 33 ------------------- gradle/libs.versions.toml | 6 ++-- gradle/wrapper/gradle-wrapper.properties | 4 +-- 6 files changed, 5 insertions(+), 43 deletions(-) diff --git a/app/src/androidMain/kotlin/area/AreaAdapter.kt b/app/src/androidMain/kotlin/area/AreaAdapter.kt index 8de1fca7..4110b851 100644 --- a/app/src/androidMain/kotlin/area/AreaAdapter.kt +++ b/app/src/androidMain/kotlin/area/AreaAdapter.kt @@ -8,7 +8,6 @@ import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView import androidx.viewbinding.ViewBinding import icons.iconTypeface -import map.enableDarkModeIfNecessary import map.showPolygons import okhttp3.HttpUrl import org.btcmap.databinding.ItemAreaDescriptionBinding @@ -137,7 +136,6 @@ class AreaAdapter( listener: Listener, ) { if (item is Item.Map && binding is ItemMapBinding) { - binding.map.enableDarkModeIfNecessary() binding.map.showPolygons(item.polygons, item.paddingPx) binding.root.setOnClickListener { listener.onMapClick() } } diff --git a/app/src/androidMain/kotlin/element/ElementFragment.kt b/app/src/androidMain/kotlin/element/ElementFragment.kt index 4d37c2a1..f40f23fc 100644 --- a/app/src/androidMain/kotlin/element/ElementFragment.kt +++ b/app/src/androidMain/kotlin/element/ElementFragment.kt @@ -25,7 +25,6 @@ import icons.iconTypeface import kotlinx.coroutines.flow.update import kotlinx.coroutines.runBlocking import map.MapMarkersRepo -import map.enableDarkModeIfNecessary import map.getErrorColor import map.getOnSurfaceColor import okhttp3.HttpUrl.Companion.toHttpUrlOrNull @@ -99,7 +98,6 @@ class ElementFragment : Fragment() { element.tags.optString("icon:android").ifBlank { "question_mark" } ) binding.map.overlays.add(marker) - binding.map.enableDarkModeIfNecessary() } } diff --git a/app/src/androidMain/kotlin/map/MapFragment.kt b/app/src/androidMain/kotlin/map/MapFragment.kt index 1cee766e..8d6d334c 100644 --- a/app/src/androidMain/kotlin/map/MapFragment.kt +++ b/app/src/androidMain/kotlin/map/MapFragment.kt @@ -208,7 +208,6 @@ class MapFragment : Fragment() { setMultiTouchControls(true) addLocationOverlay() addCancelSelectionOverlay() - enableDarkModeIfNecessary() } bottomSheetBehavior = BottomSheetBehavior.from(binding.elementDetails) diff --git a/app/src/androidMain/kotlin/map/MapViewExtensions.kt b/app/src/androidMain/kotlin/map/MapViewExtensions.kt index 3709e7f4..d86f724d 100644 --- a/app/src/androidMain/kotlin/map/MapViewExtensions.kt +++ b/app/src/androidMain/kotlin/map/MapViewExtensions.kt @@ -1,11 +1,8 @@ package map -import android.content.res.Configuration import android.graphics.Color import org.locationtech.jts.geom.Polygon -import org.osmdroid.tileprovider.tilesource.OnlineTileSourceBase import org.osmdroid.util.GeoPoint -import org.osmdroid.util.MapTileIndex import org.osmdroid.views.MapView fun MapView.showPolygons(polygons: List, paddingPx: Int) { @@ -26,34 +23,4 @@ fun MapView.showPolygons(polygons: List, paddingPx: Int) { paddingPx, ) } -} - -fun MapView.enableDarkModeIfNecessary() { - val nightMode = - resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK == Configuration.UI_MODE_NIGHT_YES - - if (nightMode) { - setTileSource( - object : OnlineTileSourceBase( - "stadia_alidade_smooth_dark", - 0, - 20, - 256, - "png", - arrayOf("https://api.btcmap.org/tiles") - ) { - override fun getTileURLString(pMapTileIndex: Long): String { - val zoom = MapTileIndex.getZoom(pMapTileIndex) - val x = MapTileIndex.getX(pMapTileIndex) - val y = MapTileIndex.getY(pMapTileIndex) - return "$baseUrl?theme=alidade_smooth_dark&zoom=$zoom&x=$x&y=$y" - } - } - ) - - overlayManager.tilesOverlay.apply { - loadingBackgroundColor = android.R.color.black - loadingLineColor = Color.DKGRAY - } - } } \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 041eb4b8..cffdfc64 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] # https://developer.android.com/build/releases/gradle-plugin -agp = "8.6.1" +agp = "8.7.0" # https://github.com/JetBrains/kotlin/releases kotlin = "1.9.25" # Allows suspending functions @@ -34,8 +34,8 @@ jts = "1.20.0" # https://github.com/PhilJay/MPAndroidChart/releases mpandroidchart = "v3.1.0" # Used to cache data and store user preferences -# https://developer.android.com/kotlin/ktx#sqlite -sqlite = "2.5.0-alpha08" +# https://developer.android.com/jetpack/androidx/releases/sqlite +sqlite = "2.5.0-alpha09" # Used to download, cache and display images # https://github.com/coil-kt/coil/releases coil = "2.7.0" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 381baa9c..68e8816d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=544c35d6bd849ae8a5ed0bcea39ba677dc40f49df7d1835561582da2009b961d -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionSha256Sum=d725d707bfabd4dfdc958c624003b3c80accc03f7037b5122c4b1d0ef15cecab +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME