diff --git a/ChoiceSDK/build.gradle b/ChoiceSDK/build.gradle index 7ce7c3e..f0f7478 100644 --- a/ChoiceSDK/build.gradle +++ b/ChoiceSDK/build.gradle @@ -8,21 +8,30 @@ buildscript { } project.ext.buildNumber = buildNumber - project.ext.sdkVersionName = "0.2.0" + project.ext.sdkVersionName = "0.3.0" project.ext.appVersionName = "${project.sdkVersionName}.${project.buildNumber}" - project.ext.versionCode = 8 + project.ext.versionCode = 9 project.ext.groupId = "at.bluesource.choicesdk" - ext.kotlin_version = "1.5.20" + ext.kotlin_version = "1.5.21" + ext.coroutines_version = "1.5.1" + ext.ktlint_version = "0.42.0" + ext.core_ktx_version = "1.6.0" + ext.rxjava_version = "3.0.13" + ext.rxandroid_version = "3.0.0" + ext.rxrelay_version = "3.0.1" + + ext.firebase_bom_version = "28.3.0" repositories { google() - jcenter() - maven { url 'http://developer.huawei.com/repo/' } + gradlePluginPortal() + + maven { url 'https://developer.huawei.com/repo/' } } dependencies { - classpath 'com.android.tools.build:gradle:4.2.2' + classpath 'com.android.tools.build:gradle:7.0.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.jaredsburrows:gradle-license-plugin:0.8.80' @@ -45,9 +54,9 @@ plugins { allprojects { repositories { google() - jcenter() + gradlePluginPortal() - maven { url 'http://developer.huawei.com/repo/' } + maven { url 'https://developer.huawei.com/repo/' } maven { name "Gitlab" diff --git a/ChoiceSDK/choicesdk-analytics/build.gradle b/ChoiceSDK/choicesdk-analytics/build.gradle index 3f241dd..c201662 100644 --- a/ChoiceSDK/choicesdk-analytics/build.gradle +++ b/ChoiceSDK/choicesdk-analytics/build.gradle @@ -15,12 +15,11 @@ android { minSdkVersion 19 targetSdkVersion 29 - versionName project.sdkVersionName - versionCode project.versionCode - consumerProguardFiles "consumer-rules.pro" } + resourcePrefix 'choicesdk' + buildTypes { release { minifyEnabled false @@ -47,20 +46,20 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.core:core-ktx:1.6.0' + implementation "androidx.core:core-ktx:$core_ktx_version" // RX - api 'io.reactivex.rxjava3:rxjava:3.0.13' - api 'io.reactivex.rxjava3:rxandroid:3.0.0' + api "io.reactivex.rxjava3:rxjava:$rxjava_version" + api "io.reactivex.rxjava3:rxandroid:$rxandroid_version" // RxRelay - implementation 'com.jakewharton.rxrelay3:rxrelay:3.0.0' + implementation "com.jakewharton.rxrelay3:rxrelay:$rxrelay_version" // ChoiceSDK Core api project(":choicesdk-core") // GMS - implementation platform('com.google.firebase:firebase-bom:28.2.0') + implementation platform("com.google.firebase:firebase-bom:$firebase_bom_version") implementation 'com.google.firebase:firebase-analytics-ktx' // HMS diff --git a/ChoiceSDK/choicesdk-analytics/src/main/java/at/bluesource/choicesdk/analytics/factory/AnalyticsFactory.kt b/ChoiceSDK/choicesdk-analytics/src/main/java/at/bluesource/choicesdk/analytics/factory/AnalyticsFactory.kt index af46e5a..e2d42d1 100644 --- a/ChoiceSDK/choicesdk-analytics/src/main/java/at/bluesource/choicesdk/analytics/factory/AnalyticsFactory.kt +++ b/ChoiceSDK/choicesdk-analytics/src/main/java/at/bluesource/choicesdk/analytics/factory/AnalyticsFactory.kt @@ -11,7 +11,7 @@ import at.bluesource.choicesdk.core.MobileServicesDetector /** * Analytics factory, uses [MobileServicesDetector] to get instance of [Analytics] - * Automatically decides if GMS or HMS should be used. GMS is always preferred first. + * Automatically decides if GMS or HMS should be used. * * Throws [UnsupportedOperationException] if no underlying api has been found. * diff --git a/ChoiceSDK/choicesdk-app/build.gradle b/ChoiceSDK/choicesdk-app/build.gradle index 24b2971..3cd38ff 100644 --- a/ChoiceSDK/choicesdk-app/build.gradle +++ b/ChoiceSDK/choicesdk-app/build.gradle @@ -90,8 +90,8 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.core:core-ktx:1.6.0' - implementation 'androidx.appcompat:appcompat:1.3.0' + implementation "androidx.core:core-ktx:$core_ktx_version" + implementation 'androidx.appcompat:appcompat:1.3.1' implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'com.android.support:multidex:1.0.3' @@ -105,7 +105,7 @@ dependencies { implementation 'com.huawei.hms:maps:5.3.0.300' // Coroutines - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" // HTTP Lib implementation "com.squareup.retrofit2:retrofit:2.9.0" diff --git a/ChoiceSDK/choicesdk-app/src/main/java/com/bluesource/choicesdk_app/biometrics/BiometricsActivity.kt b/ChoiceSDK/choicesdk-app/src/main/java/com/bluesource/choicesdk_app/biometrics/BiometricsActivity.kt index f2ade61..45134b9 100644 --- a/ChoiceSDK/choicesdk-app/src/main/java/com/bluesource/choicesdk_app/biometrics/BiometricsActivity.kt +++ b/ChoiceSDK/choicesdk-app/src/main/java/com/bluesource/choicesdk_app/biometrics/BiometricsActivity.kt @@ -22,7 +22,7 @@ class BiometricsActivity : AppCompatActivity() { setContentView(R.layout.activity_biometrics) val biometricManager = BiometricManager.from(this) - when (biometricManager.canAuthenticate()) { + when (biometricManager.canAuthenticate(BiometricManager.Authenticators.BIOMETRIC_WEAK)) { BiometricManager.BIOMETRIC_SUCCESS -> Log.d("ChoiceSdkApp", "App can authenticate using biometrics.") BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE -> @@ -30,10 +30,14 @@ class BiometricsActivity : AppCompatActivity() { BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE -> Log.e("ChoiceSdkApp", "Biometric features are currently unavailable.") BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED -> - Log.e( - "ChoiceSdkApp", "The user hasn't associated " + - "any biometric credentials with their account." - ) + Log.e("ChoiceSdkApp", "The user hasn't associated any biometric credentials with their account.") + BiometricManager.BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED -> + Log.e("ChoiceSdkApp", "Biometric security update required.") + BiometricManager.BIOMETRIC_ERROR_UNSUPPORTED -> + Log.e("ChoiceSdkApp", "Biometric error unsupported.") + BiometricManager.BIOMETRIC_STATUS_UNKNOWN -> + Log.e("ChoiceSdkApp", "Biometric status unknown.") + } diff --git a/ChoiceSDK/choicesdk-core/build.gradle b/ChoiceSDK/choicesdk-core/build.gradle index fd7b626..bec63ad 100644 --- a/ChoiceSDK/choicesdk-core/build.gradle +++ b/ChoiceSDK/choicesdk-core/build.gradle @@ -15,12 +15,11 @@ android { minSdkVersion 19 targetSdkVersion 29 - versionName project.sdkVersionName - versionCode project.versionCode - consumerProguardFiles "consumer-rules.pro" } + resourcePrefix 'choicesdk' + buildTypes { release { minifyEnabled false @@ -47,7 +46,7 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.core:core-ktx:1.6.0' + implementation "androidx.core:core-ktx:$core_ktx_version" // GMS implementation 'com.google.android.gms:play-services-base:17.6.0' diff --git a/ChoiceSDK/choicesdk-location/build.gradle b/ChoiceSDK/choicesdk-location/build.gradle index 12af5c0..c5aebc1 100644 --- a/ChoiceSDK/choicesdk-location/build.gradle +++ b/ChoiceSDK/choicesdk-location/build.gradle @@ -15,12 +15,11 @@ android { minSdkVersion 19 targetSdkVersion 29 - versionName project.sdkVersionName - versionCode project.versionCode - consumerProguardFiles "consumer-rules.pro" } + resourcePrefix 'choicesdk' + buildTypes { release { minifyEnabled false @@ -47,14 +46,14 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.core:core-ktx:1.6.0' + implementation "androidx.core:core-ktx:$core_ktx_version" // RX - api 'io.reactivex.rxjava3:rxjava:3.0.13' - api 'io.reactivex.rxjava3:rxandroid:3.0.0' + api "io.reactivex.rxjava3:rxjava:$rxjava_version" + api "io.reactivex.rxjava3:rxandroid:$rxandroid_version" // RxRelay3 - implementation 'com.jakewharton.rxrelay3:rxrelay:3.0.0' + implementation "com.jakewharton.rxrelay3:rxrelay:$rxrelay_version" // ChoiceSDK Core api project(":choicesdk-core") diff --git a/ChoiceSDK/choicesdk-location/src/main/java/at/bluesource/choicesdk/location/factory/FusedLocationProviderFactory.kt b/ChoiceSDK/choicesdk-location/src/main/java/at/bluesource/choicesdk/location/factory/FusedLocationProviderFactory.kt index 0e30b49..066fe94 100644 --- a/ChoiceSDK/choicesdk-location/src/main/java/at/bluesource/choicesdk/location/factory/FusedLocationProviderFactory.kt +++ b/ChoiceSDK/choicesdk-location/src/main/java/at/bluesource/choicesdk/location/factory/FusedLocationProviderFactory.kt @@ -10,7 +10,7 @@ import at.bluesource.choicesdk.location.hms.HmsFusedLocationProviderClient /** * FusedLocationProvider factory, uses [MobileServicesDetector] to get instance of [FusedLocationProviderClient] - * Automatically decides if GMS or HMS should be used. GMS is always preferred first. + * Automatically decides if GMS or HMS should be used. * * Throws [UnsupportedOperationException] if no underlying api has been found. * diff --git a/ChoiceSDK/choicesdk-location/src/main/java/at/bluesource/choicesdk/location/factory/SettingsClientFactory.kt b/ChoiceSDK/choicesdk-location/src/main/java/at/bluesource/choicesdk/location/factory/SettingsClientFactory.kt index 7fe95f6..ba67b87 100644 --- a/ChoiceSDK/choicesdk-location/src/main/java/at/bluesource/choicesdk/location/factory/SettingsClientFactory.kt +++ b/ChoiceSDK/choicesdk-location/src/main/java/at/bluesource/choicesdk/location/factory/SettingsClientFactory.kt @@ -11,7 +11,7 @@ import com.google.android.gms.location.LocationServices /** * SettingsClient factory, uses [MobileServicesDetector] to get instance of [SettingsClient] - * Automatically decides if GMS or HMS should be used. GMS is always preferred first. + * Automatically decides if GMS or HMS should be used. * * Throws [UnsupportedOperationException] if no underlying api has been found. * diff --git a/ChoiceSDK/choicesdk-maps/build.gradle b/ChoiceSDK/choicesdk-maps/build.gradle index 7a173e3..95dc0f6 100644 --- a/ChoiceSDK/choicesdk-maps/build.gradle +++ b/ChoiceSDK/choicesdk-maps/build.gradle @@ -1,6 +1,7 @@ plugins { id 'com.android.library' id 'kotlin-android' + id 'kotlin-parcelize' id 'org.jetbrains.dokka' } @@ -15,12 +16,11 @@ android { minSdkVersion 19 targetSdkVersion 29 - versionName project.sdkVersionName - versionCode project.versionCode - consumerProguardFiles "consumer-rules.pro" } + resourcePrefix 'choicesdk' + buildTypes { release { minifyEnabled false @@ -47,14 +47,14 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.core:core-ktx:1.6.0' + implementation "androidx.core:core-ktx:$core_ktx_version" // RX - api 'io.reactivex.rxjava3:rxjava:3.0.13' - api 'io.reactivex.rxjava3:rxandroid:3.0.0' + api "io.reactivex.rxjava3:rxjava:$rxjava_version" + api "io.reactivex.rxjava3:rxandroid:$rxandroid_version" // RxRelay - implementation 'com.jakewharton.rxrelay3:rxrelay:3.0.0' + implementation "com.jakewharton.rxrelay3:rxrelay:$rxrelay_version" // ChoiceSDK Core api project(":choicesdk-core") diff --git a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/common/MapFragment.kt b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/common/MapFragment.kt index e3c3067..bfde3e1 100644 --- a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/common/MapFragment.kt +++ b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/common/MapFragment.kt @@ -23,9 +23,7 @@ import io.reactivex.rxjava3.disposables.CompositeDisposable * @see com.google.android.gms.maps.SupportMapFragment * @see com.huawei.hms.maps.SupportMapFragment */ -open class MapFragment( - private val options: MapOptions? -) : Fragment() { +open class MapFragment : Fragment() { private val disposables = CompositeDisposable() @@ -46,6 +44,8 @@ open class MapFragment( override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + val options: MapOptions? = arguments?.getParcelable(ARG_MAP_OPTIONS) + val mapFragment: Fragment = when (MobileServicesDetector.getAvailableMobileService()) { MobileService.GMS -> { val instance = if (options == null) { @@ -92,7 +92,7 @@ open class MapFragment( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { - return inflater.inflate(R.layout.fragment_map, container, false) + return inflater.inflate(R.layout.choicesdk_fragment_map, container, false) } override fun onDestroy() { @@ -102,6 +102,8 @@ open class MapFragment( companion object { + private const val ARG_MAP_OPTIONS = "ARG_MAP_OPTIONS" + @JvmStatic fun newInstance(): MapFragment { return newInstance(null) @@ -109,7 +111,11 @@ open class MapFragment( @JvmStatic fun newInstance(options: MapOptions? = null): MapFragment { - return MapFragment(options) + return MapFragment().apply { + arguments = Bundle().apply { + putParcelable(ARG_MAP_OPTIONS, options) + } + } } } } \ No newline at end of file diff --git a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/common/MapOptions.kt b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/common/MapOptions.kt index 144539c..a4990f6 100644 --- a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/common/MapOptions.kt +++ b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/common/MapOptions.kt @@ -1,5 +1,6 @@ package at.bluesource.choicesdk.maps.common +import android.os.Parcelable import at.bluesource.choicesdk.core.MobileService import at.bluesource.choicesdk.core.MobileServicesDetector import at.bluesource.choicesdk.maps.gms.GmsMapOptionsFactory @@ -7,7 +8,7 @@ import at.bluesource.choicesdk.maps.hms.HmsMapOptionsFactory import com.google.android.gms.maps.GoogleMapOptions import com.huawei.hms.maps.HuaweiMapOptions -interface MapOptions { +interface MapOptions : Parcelable { val liteMode: Boolean? val mapToolbarEnabled: Boolean? diff --git a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/common/TileProvider.kt b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/common/TileProvider.kt index dd2662a..522edd0 100644 --- a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/common/TileProvider.kt +++ b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/common/TileProvider.kt @@ -1,5 +1,6 @@ package at.bluesource.choicesdk.maps.common +import at.bluesource.choicesdk.maps.factory.TileProviderFactory import at.bluesource.choicesdk.maps.gms.GmsTileProvider import at.bluesource.choicesdk.maps.hms.HmsTileProvider @@ -20,6 +21,10 @@ fun interface TileProvider { @JvmStatic fun noTile(): Tile = Tile.getFactory().create(-1, -1, null) + fun create(getTile: (x: Int, y: Int, zoom: Int) -> Tile?): TileProvider { + return TileProviderFactory.getTileProvider(getTile) + } + @JvmStatic fun com.google.android.gms.maps.model.TileProvider.toChoiceTileProvider(): TileProvider { return GmsTileProvider(this@toChoiceTileProvider) diff --git a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/BitmapDescriptorFactory.kt b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/BitmapDescriptorFactory.kt index 7839f05..48eeaec 100644 --- a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/BitmapDescriptorFactory.kt +++ b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/BitmapDescriptorFactory.kt @@ -8,7 +8,7 @@ import at.bluesource.choicesdk.maps.hms.HmsBitmapDescriptorFactory /** * BitmapDescriptorFactory factory, uses [MobileServicesDetector] to get instance of [BitmapDescriptorFactory] - * Automatically decides if GMS or HMS should be used. GMS is always preferred first. + * Automatically decides if GMS or HMS should be used. * * Throws [UnsupportedOperationException] if no underlying api has been found. * diff --git a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/GroundOverlayOptionsFactory.kt b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/GroundOverlayOptionsFactory.kt index bf024f3..1237904 100644 --- a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/GroundOverlayOptionsFactory.kt +++ b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/GroundOverlayOptionsFactory.kt @@ -8,7 +8,7 @@ import at.bluesource.choicesdk.maps.hms.HmsGroundOverlayOptions /** * GroundOverlayOptions factory, uses [MobileServicesDetector] to get instance of [GroundOverlayOptions] - * Automatically decides if GMS or HMS should be used. GMS is always preferred first. + * Automatically decides if GMS or HMS should be used. * * Throws [UnsupportedOperationException] if no underlying api has been found. * diff --git a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/MarkerOptionsFactory.kt b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/MarkerOptionsFactory.kt index c04304e..e32c5ac 100644 --- a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/MarkerOptionsFactory.kt +++ b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/MarkerOptionsFactory.kt @@ -8,7 +8,7 @@ import at.bluesource.choicesdk.maps.hms.HmsMarkerOptions /** * MarkerOptions factory, uses [MobileServicesDetector] to get instance of [MarkerOptions] - * Automatically decides if GMS or HMS should be used. GMS is always preferred first. + * Automatically decides if GMS or HMS should be used. * * Throws [UnsupportedOperationException] if no underlying api has been found. * diff --git a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/TileOverlayOptionsFactory.kt b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/TileOverlayOptionsFactory.kt index 8f75c71..5fa54d6 100644 --- a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/TileOverlayOptionsFactory.kt +++ b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/TileOverlayOptionsFactory.kt @@ -8,7 +8,7 @@ import at.bluesource.choicesdk.maps.hms.HmsTileOverlayOptions /** * TileOverlayOptions factory, uses [MobileServicesDetector] to get instance of [TileOverlayOptions] - * Automatically decides if GMS or HMS should be used. GMS is always preferred first. + * Automatically decides if GMS or HMS should be used. * * Throws [UnsupportedOperationException] if no underlying api has been found. * diff --git a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/TileProviderFactory.kt b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/TileProviderFactory.kt new file mode 100644 index 0000000..72a442c --- /dev/null +++ b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/TileProviderFactory.kt @@ -0,0 +1,34 @@ +package at.bluesource.choicesdk.maps.factory + +import at.bluesource.choicesdk.core.MobileService +import at.bluesource.choicesdk.core.MobileServicesDetector +import at.bluesource.choicesdk.maps.common.Tile +import at.bluesource.choicesdk.maps.common.TileProvider +import at.bluesource.choicesdk.maps.gms.GmsTileProvider +import at.bluesource.choicesdk.maps.hms.HmsTileProvider + +/** + * TileProvider factory, uses [MobileServicesDetector] to get instance of [TileProvider] + * Automatically decides if GMS or HMS should be used. + * + * Throws [UnsupportedOperationException] if no underlying api has been found. + * + * @see GmsTileProvider + * @see HmsTileProvider + */ +internal class TileProviderFactory { + companion object { + @Throws(UnsupportedOperationException::class) + fun getTileProvider(getTile: (x: Int, y: Int, zoom: Int) -> Tile?): TileProvider { + return when (MobileServicesDetector.getAvailableMobileService()) { + MobileService.GMS -> GmsTileProvider { x, y, zoom -> + getTile.invoke(x, y, zoom)?.let { com.google.android.gms.maps.model.Tile(it.width, it.height, it.data) } + } + + MobileService.HMS -> HmsTileProvider { x, y, zoom -> + getTile.invoke(x, y, zoom)?.let { com.huawei.hms.maps.model.Tile(it.width, it.height, it.data) } + } + } + } + } +} \ No newline at end of file diff --git a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/gms/GmsMapOptions.kt b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/gms/GmsMapOptions.kt index a1750a9..590063e 100644 --- a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/gms/GmsMapOptions.kt +++ b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/gms/GmsMapOptions.kt @@ -1,11 +1,15 @@ package at.bluesource.choicesdk.maps.gms +import android.os.Parcelable import at.bluesource.choicesdk.maps.common.MapOptions import com.google.android.gms.maps.GoogleMapOptions +import kotlinx.parcelize.Parcelize -internal class GmsMapOptions : MapOptions { - private val mapOptions = GoogleMapOptions() +@Parcelize +internal class GmsMapOptions( + private val mapOptions: GoogleMapOptions = GoogleMapOptions() +) : MapOptions, Parcelable { override val liteMode: Boolean? get() = mapOptions.liteMode diff --git a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/gms/GmsTileProvider.kt b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/gms/GmsTileProvider.kt index c94fc29..6f4bcfa 100644 --- a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/gms/GmsTileProvider.kt +++ b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/gms/GmsTileProvider.kt @@ -10,8 +10,8 @@ import at.bluesource.choicesdk.maps.common.TileProvider * @property tileProvider gms TileProvider instance * @see com.google.android.gms.maps.model.TileProvider */ -internal class GmsTileProvider(private val tileProvider: com.google.android.gms.maps.model.TileProvider) : - TileProvider { +internal class GmsTileProvider(private val tileProvider: com.google.android.gms.maps.model.TileProvider) : TileProvider { + override fun getTile(x: Int, y: Int, zoom: Int): Tile? { return tileProvider.getTile(x, y, zoom)?.toChoiceTile() } diff --git a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/hms/HmsMapOptions.kt b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/hms/HmsMapOptions.kt index 1c73fc8..27e39ba 100644 --- a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/hms/HmsMapOptions.kt +++ b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/hms/HmsMapOptions.kt @@ -1,11 +1,15 @@ package at.bluesource.choicesdk.maps.hms +import android.os.Parcelable import at.bluesource.choicesdk.maps.common.MapOptions import com.huawei.hms.maps.HuaweiMapOptions +import kotlinx.parcelize.Parcelize -internal class HmsMapOptions : MapOptions { - private val mapOptions = HuaweiMapOptions() +@Parcelize +internal class HmsMapOptions( + private val mapOptions: HuaweiMapOptions = HuaweiMapOptions() +) : MapOptions, Parcelable { override val liteMode: Boolean? get() = mapOptions.liteMode diff --git a/ChoiceSDK/choicesdk-maps/src/main/res/layout/fragment_map.xml b/ChoiceSDK/choicesdk-maps/src/main/res/layout/choicesdk_fragment_map.xml similarity index 100% rename from ChoiceSDK/choicesdk-maps/src/main/res/layout/fragment_map.xml rename to ChoiceSDK/choicesdk-maps/src/main/res/layout/choicesdk_fragment_map.xml diff --git a/ChoiceSDK/choicesdk-messaging/build.gradle b/ChoiceSDK/choicesdk-messaging/build.gradle index ad1ae80..2ad0a71 100644 --- a/ChoiceSDK/choicesdk-messaging/build.gradle +++ b/ChoiceSDK/choicesdk-messaging/build.gradle @@ -15,12 +15,11 @@ android { minSdkVersion 19 targetSdkVersion 29 - versionName project.sdkVersionName - versionCode project.versionCode - consumerProguardFiles "consumer-rules.pro" } + resourcePrefix 'choicesdk' + buildTypes { release { minifyEnabled false @@ -47,25 +46,24 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.core:core-ktx:1.6.0' + implementation "androidx.core:core-ktx:$core_ktx_version" - def coroutines_version = "1.5.0" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-rx3:$coroutines_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$coroutines_version" // RX - api 'io.reactivex.rxjava3:rxjava:3.0.13' - api 'io.reactivex.rxjava3:rxandroid:3.0.0' + api "io.reactivex.rxjava3:rxjava:$rxjava_version" + api "io.reactivex.rxjava3:rxandroid:$rxandroid_version" // RxRelay3 - implementation 'com.jakewharton.rxrelay3:rxrelay:3.0.0' + implementation "com.jakewharton.rxrelay3:rxrelay:$rxrelay_version" // ChoiceSDK Core api project(":choicesdk-core") // GMS - implementation platform('com.google.firebase:firebase-bom:28.2.0') + implementation platform("com.google.firebase:firebase-bom:$firebase_bom_version") implementation 'com.google.firebase:firebase-messaging-ktx' // HMS diff --git a/ChoiceSDK/choicesdk-messaging/src/main/java/at/bluesource/choicesdk/messaging/factory/MessagingFactory.kt b/ChoiceSDK/choicesdk-messaging/src/main/java/at/bluesource/choicesdk/messaging/factory/MessagingFactory.kt index c87ce64..694e34b 100644 --- a/ChoiceSDK/choicesdk-messaging/src/main/java/at/bluesource/choicesdk/messaging/factory/MessagingFactory.kt +++ b/ChoiceSDK/choicesdk-messaging/src/main/java/at/bluesource/choicesdk/messaging/factory/MessagingFactory.kt @@ -9,7 +9,7 @@ import at.bluesource.choicesdk.messaging.hms.HmsMessaging /** * Messaging factory, uses [MobileServicesDetector] to get instance of [Messaging] - * Automatically decides if GMS or HMS should be used. GMS is always preferred first. + * Automatically decides if GMS or HMS should be used. * * Throws [UnsupportedOperationException] if no underlying api has been found. * diff --git a/ChoiceSDK/choicesdk-messaging/src/main/java/at/bluesource/choicesdk/messaging/factory/MessagingRepositoryFactory.kt b/ChoiceSDK/choicesdk-messaging/src/main/java/at/bluesource/choicesdk/messaging/factory/MessagingRepositoryFactory.kt index 7eaecbe..625a181 100644 --- a/ChoiceSDK/choicesdk-messaging/src/main/java/at/bluesource/choicesdk/messaging/factory/MessagingRepositoryFactory.kt +++ b/ChoiceSDK/choicesdk-messaging/src/main/java/at/bluesource/choicesdk/messaging/factory/MessagingRepositoryFactory.kt @@ -10,7 +10,7 @@ import at.bluesource.choicesdk.messaging.hms.HmsTokenProvider /** * MessagingRepository factory, uses [MobileServicesDetector] to get instance of [MessagingService] and [TokenProvider] (repository) - * Automatically decides if GMS or HMS should be used. GMS is always preferred first. + * Automatically decides if GMS or HMS should be used. * * Throws [UnsupportedOperationException] if no underlying api has been found. * diff --git a/ChoiceSDK/choicesdk-signin/build.gradle b/ChoiceSDK/choicesdk-signin/build.gradle index eb12c72..999d703 100644 --- a/ChoiceSDK/choicesdk-signin/build.gradle +++ b/ChoiceSDK/choicesdk-signin/build.gradle @@ -15,12 +15,11 @@ android { minSdkVersion 19 targetSdkVersion 29 - versionName project.sdkVersionName - versionCode project.versionCode - consumerProguardFiles "consumer-rules.pro" } + resourcePrefix 'choicesdk' + buildTypes { release { minifyEnabled false @@ -47,20 +46,20 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.core:core-ktx:1.6.0' + implementation "androidx.core:core-ktx:$core_ktx_version" // RX - api 'io.reactivex.rxjava3:rxjava:3.0.13' - api 'io.reactivex.rxjava3:rxandroid:3.0.0' + api "io.reactivex.rxjava3:rxjava:$rxjava_version" + api "io.reactivex.rxjava3:rxandroid:$rxandroid_version" // RxRelay3 - implementation 'com.jakewharton.rxrelay3:rxrelay:3.0.0' + implementation "com.jakewharton.rxrelay3:rxrelay:$rxrelay_version" // ChoiceSDK Core api project(":choicesdk-core") // GMS - implementation 'com.google.android.gms:play-services-auth:19.0.0' + implementation 'com.google.android.gms:play-services-auth:19.2.0' // HMS implementation 'com.huawei.hms:hwid:5.3.0.302' // account kit diff --git a/ChoiceSDK/choicesdk-signin/src/main/java/at/bluesource/choicesdk/signin/factory/SignInFactory.kt b/ChoiceSDK/choicesdk-signin/src/main/java/at/bluesource/choicesdk/signin/factory/SignInFactory.kt index 44092cd..f98a793 100644 --- a/ChoiceSDK/choicesdk-signin/src/main/java/at/bluesource/choicesdk/signin/factory/SignInFactory.kt +++ b/ChoiceSDK/choicesdk-signin/src/main/java/at/bluesource/choicesdk/signin/factory/SignInFactory.kt @@ -8,7 +8,7 @@ import at.bluesource.choicesdk.signin.hms.HmsSignInService /** * SignIn factory, uses [MobileServicesDetector] to get instance of [SignInService] - * Automatically decides if GMS or HMS should be used. GMS is always preferred first. + * Automatically decides if GMS or HMS should be used. * * Throws [UnsupportedOperationException] if no underlying api has been found. * diff --git a/ChoiceSDK/gradle/wrapper/gradle-wrapper.properties b/ChoiceSDK/gradle/wrapper/gradle-wrapper.properties index 31ca335..46bdc26 100644 --- a/ChoiceSDK/gradle/wrapper/gradle-wrapper.properties +++ b/ChoiceSDK/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip diff --git a/README.md b/README.md index 9de4fc3..595afa5 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ apply plugin: 'com.huawei.agconnect' Add the following dependencies as required to your app. GMS, Firebase and HMS dependencies are included, so they do not need to be declared in your app. ```gradle dependencies { - def choicesdk_version = '0.2.0' + def choicesdk_version = '0.3.0' implementation "at.bluesource.choicesdk:choicesdk-analytics:$choicesdk_version" implementation "at.bluesource.choicesdk:choicesdk-location:$choicesdk_version" implementation "at.bluesource.choicesdk:choicesdk-maps:$choicesdk_version" diff --git a/documentation/map.md b/documentation/map.md index a3ac8fd..f35ff18 100644 --- a/documentation/map.md +++ b/documentation/map.md @@ -109,6 +109,15 @@ map.addPolyline( ) ``` +Adding a tile provider: +```kotlin +val tileProvider = TileProvider.create { x, y, zoom -> + // TODO return a ChoiceSDK tile via Tile.getFactory().create(...) +} +val tileOverlayOptions = TileOverlayOptions.create().tileProvider(tileProvider) +map.addTileOverlay(tileOverlayOptions) +``` + The Google or Huawei map object can be retrieved for use-cases which ChoiceSDK does not provide, e.g. clustering. Please note that you need to add the corresponding GMS/HMS dependencies in your `build.gradle` file. ```kotlin val googleMap: com.google.android.gms.maps.GoogleMap? = map.getGoogleMap()