From 312b60efa3bffa375cf043aa16962878b6e67cd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20W=C3=BCrl?= Date: Sun, 8 Oct 2023 12:02:24 +0200 Subject: [PATCH] roll back osmdroid and update target sdk --- app/build.gradle | 9 +++++---- app/src/main/AndroidManifest.xml | 13 ++++++------- .../java/org/blitzortung/android/app/AppService.kt | 3 ++- .../blitzortung/android/app/view/PreferenceKey.kt | 4 ++-- .../java/org/blitzortung/android/map/OwnMapView.kt | 9 +++++++-- 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 030d3e80..f6db898b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,7 +11,7 @@ android { defaultConfig { applicationId "org.blitzortung.android.app" minSdkVersion 15 - targetSdkVersion 32 + targetSdkVersion 33 versionCode 287 versionName '2.1.13' multiDexEnabled false @@ -67,7 +67,7 @@ dependencies { implementation 'androidx.core:core-ktx:1.12.0' implementation 'androidx.recyclerview:recyclerview:1.3.1' implementation 'androidx.work:work-runtime-ktx:2.8.1' - implementation 'org.osmdroid:osmdroid-android:6.1.17' + implementation 'org.osmdroid:osmdroid-android:6.1.11' // waiting for https://github.com/osmdroid/osmdroid/issues/1822 // Dagger2 @@ -91,7 +91,7 @@ kapt.includeCompileClasspath = false import org.gradle.api.tasks.testing.logging.TestExceptionFormat import org.gradle.api.tasks.testing.logging.TestLogEvent -tasks.withType(Test) { +tasks.withType(Test).configureEach { jacoco.includeNoLocationClasses = true jacoco.excludes = ['jdk.internal.*'] testLogging { @@ -105,7 +105,8 @@ tasks.withType(Test) { maxHeapSize = "4g" } -task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) { +tasks.register('jacocoTestReport', JacocoReport) { + dependsOn['testDebugUnitTest'] reports { xml.required.set(true) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 40ab628f..f479bd21 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,7 +1,7 @@ - + + @@ -9,21 +9,20 @@ - + + android:theme="@style/AppTheme" + android:usesCleartextTraffic="true"> diff --git a/app/src/main/java/org/blitzortung/android/app/AppService.kt b/app/src/main/java/org/blitzortung/android/app/AppService.kt index 0300be34..43e7bb0e 100644 --- a/app/src/main/java/org/blitzortung/android/app/AppService.kt +++ b/app/src/main/java/org/blitzortung/android/app/AppService.kt @@ -198,7 +198,8 @@ class AppService : Service(), OnSharedPreferenceChangeListener { } else { 0 } - pendingIntent = PendingIntent.getService(this, 0, intent, flags) + val pendingIntent = PendingIntent.getService(this, 0, intent, flags) + this.pendingIntent = pendingIntent val period = (backgroundPeriod * 1000).toLong() alarmManager.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, period, period, pendingIntent) diff --git a/app/src/main/java/org/blitzortung/android/app/view/PreferenceKey.kt b/app/src/main/java/org/blitzortung/android/app/view/PreferenceKey.kt index ebe759d3..ef62b94f 100644 --- a/app/src/main/java/org/blitzortung/android/app/view/PreferenceKey.kt +++ b/app/src/main/java/org/blitzortung/android/app/view/PreferenceKey.kt @@ -132,8 +132,8 @@ interface OnSharedPreferenceChangeListener : SharedPreferences.OnSharedPreferenc keys.forEach { onSharedPreferenceChanged(sharedPreferences, it) } } - override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, keyString: String) { - val key = PreferenceKey.fromString(keyString) + override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, keyString: String?) { + val key = PreferenceKey.fromString(keyString.orEmpty()) key?.also { onSharedPreferenceChanged(sharedPreferences, it) } } diff --git a/app/src/main/java/org/blitzortung/android/map/OwnMapView.kt b/app/src/main/java/org/blitzortung/android/map/OwnMapView.kt index c2f3099e..d1cdc9e9 100644 --- a/app/src/main/java/org/blitzortung/android/map/OwnMapView.kt +++ b/app/src/main/java/org/blitzortung/android/map/OwnMapView.kt @@ -28,6 +28,7 @@ import android.view.LayoutInflater import android.view.MotionEvent import android.view.View import androidx.appcompat.app.AlertDialog +import androidx.core.view.GestureDetectorCompat import org.blitzortung.android.app.Main import org.blitzortung.android.app.R import org.blitzortung.android.app.view.PreferenceKey @@ -37,7 +38,7 @@ import org.osmdroid.views.MapView class OwnMapView(context: Context) : MapView(context) { - private val gestureDetector: GestureDetector = GestureDetector(context, GestureListener()) + private val gestureDetector: GestureDetectorCompat = GestureDetectorCompat(context, GestureListener()) init { minZoomLevel = 1.5 @@ -93,7 +94,11 @@ class OwnMapView(context: Context) : MapView(context) { } override fun onTouchEvent(event: MotionEvent): Boolean { - return gestureDetector.onTouchEvent(event) + return if (gestureDetector.onTouchEvent(event)) { + true + } else { + super.onTouchEvent(event) + } } val popup: View by lazy { LayoutInflater.from(context).inflate(R.layout.popup, this, false) }