From 29961967608ac1342f60bc4d40b407f9ee6a6710 Mon Sep 17 00:00:00 2001 From: Ferran Pons Date: Mon, 4 Dec 2017 12:34:10 +0100 Subject: [PATCH] Solved issue where map is null after on click of the satellite button (#126) --- README.md | 2 +- leku/build.gradle | 6 +++--- .../com/schibstedspain/leku/LocationPickerActivity.java | 6 ++++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 35c86fb9..2293bdd1 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ Include the dependency in your app `build.gradle`: ```groovy dependencies { - compile 'com.schibstedspain.android:leku:3.6.0' + compile 'com.schibstedspain.android:leku:3.6.1' } ``` diff --git a/leku/build.gradle b/leku/build.gradle index b8635da1..a22fa7ae 100644 --- a/leku/build.gradle +++ b/leku/build.gradle @@ -3,7 +3,7 @@ apply plugin: 'com.novoda.bintray-release' apply from: '../quality.gradle' group = 'com.schibstedspain.android' -version = '3.6.0' +version = '3.6.1' android { compileSdkVersion 26 @@ -54,7 +54,7 @@ dependencies { implementation 'pl.charmas.android:android-reactive-location2:2.0@aar' implementation "io.reactivex:rxandroid:1.2.1" - implementation 'io.reactivex.rxjava2:rxjava:2.1.6' + implementation 'io.reactivex.rxjava2:rxjava:2.1.7' implementation 'io.reactivex.rxjava2:rxandroid:2.0.1' implementation 'nl.littlerobots.rxlint:rxlint:1.6' @@ -70,7 +70,7 @@ publish { userOrg = 'schibstedspain' groupId = 'com.schibstedspain.android' artifactId = 'leku' - publishVersion = '3.6.0' + publishVersion = '3.6.1' desc = 'Location picker component for Android. It returns a latitude,longitude and an address based on the location picked in the LocationPickerActivity provided.' website = 'https://github.com/SchibstedSpain/leku' } diff --git a/leku/src/main/java/com/schibstedspain/leku/LocationPickerActivity.java b/leku/src/main/java/com/schibstedspain/leku/LocationPickerActivity.java index e5f0309f..6b3fb71f 100644 --- a/leku/src/main/java/com/schibstedspain/leku/LocationPickerActivity.java +++ b/leku/src/main/java/com/schibstedspain/leku/LocationPickerActivity.java @@ -269,8 +269,10 @@ private void setUpFloatingButtons() { FloatingActionButton btnSatellite = findViewById(R.id.btnSatellite); btnSatellite.setOnClickListener(view -> { - map.setMapType(map.getMapType() == MAP_TYPE_SATELLITE ? MAP_TYPE_NORMAL : MAP_TYPE_SATELLITE); - btnSatellite.setImageResource(map.getMapType() == MAP_TYPE_SATELLITE ? R.drawable.ic_satellite_off : R.drawable.ic_satellite_on); + if (map != null && btnSatellite != null) { + map.setMapType(map.getMapType() == MAP_TYPE_SATELLITE ? MAP_TYPE_NORMAL : MAP_TYPE_SATELLITE); + btnSatellite.setImageResource(map.getMapType() == MAP_TYPE_SATELLITE ? R.drawable.ic_satellite_off : R.drawable.ic_satellite_on); + } }); btnSatellite.setVisibility(enableSatelliteView ? View.VISIBLE : View.GONE); }