diff --git a/README.md b/README.md index a80d9c3e..c3269514 100644 --- a/README.md +++ b/README.md @@ -83,22 +83,19 @@ Include the dependency in your app `build.gradle`: ```groovy dependencies { - implementation 'com.schibstedspain.android:leku:7.0.1' + implementation 'com.schibstedspain.android:leku:7.1.0' } ``` Alternatively, if you are using a different version of Google Play Services and AndroidX use this instead: ```groovy -implementation ('com.schibstedspain.android:leku:7.0.1') { +implementation ('com.schibstedspain.android:leku:7.1.0') { exclude group: 'com.google.android.gms' exclude group: 'androidx.appcompat' } ``` -Note that Places on Google Play services is deprecated and this library currently uses the Compat Places SDK, that is a transition version. - - For the legacy versions of Leku that does not use AndroidX and want to use the latest Places SDK, you could use it in this way: ```groovy diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 07df4ecf..07ce977b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -5,5 +5,5 @@ LAUNCH LEGACY MAP LOCATION ACTIVITY LAUNCH MAP WITH POIS LAUNCH MAP WITH STYLE - version 7.0.1 + version 7.1.0 diff --git a/docs/getting_started.md b/docs/getting_started.md index fc909073..a1bd7751 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -18,22 +18,19 @@ Include the dependency in your app `build.gradle`: ```groovy dependencies { - implementation 'com.schibstedspain.android:leku:7.0.1' + implementation 'com.schibstedspain.android:leku:7.1.0' } ``` Alternatively, if you are using a different version of Google Play Services and AndroidX use this instead: ```groovy -implementation ('com.schibstedspain.android:leku:7.0.1') { +implementation ('com.schibstedspain.android:leku:7.1.0') { exclude group: 'com.google.android.gms' exclude group: 'androidx.appcompat' } ``` -Note that Places on Google Play services is deprecated and this library currently uses the Compat Places SDK, that is a transition version. - - For the legacy versions of Leku that does not use AndroidX and want to use the latest Places SDK, you could use it in this way: ```groovy diff --git a/leku/src/androidTest/java/com/schibsted/leku/LocationPickerActivityShould.kt b/leku/src/androidTest/java/com/schibsted/leku/LocationPickerActivityShould.kt index cfc37357..722bdfa5 100644 --- a/leku/src/androidTest/java/com/schibsted/leku/LocationPickerActivityShould.kt +++ b/leku/src/androidTest/java/com/schibsted/leku/LocationPickerActivityShould.kt @@ -154,7 +154,7 @@ class LocationPickerActivityShould { launchActivityWithoutLocationAndPermissions() wait300millis() - onView(withId(R.id.btnFloatingAction)).perform(click()) + onView(withId(R.id.btnMyLocation)).perform(click()) } @Test @@ -182,7 +182,7 @@ class LocationPickerActivityShould { private fun assertLocationInfoIsShown() { onView(withId(R.id.location_info)).check(matches(isDisplayed())) onView(withId(R.id.btnAccept)).check(matches(isDisplayed())) - onView(withId(R.id.btnFloatingAction)).check(matches(isDisplayed())) + onView(withId(R.id.btnMyLocation)).check(matches(isDisplayed())) } private fun launchActivity() { diff --git a/leku/src/main/java/com/schibstedspain/leku/LocationPickerActivity.kt b/leku/src/main/java/com/schibstedspain/leku/LocationPickerActivity.kt index 3df1cf3a..5e6d9b78 100644 --- a/leku/src/main/java/com/schibstedspain/leku/LocationPickerActivity.kt +++ b/leku/src/main/java/com/schibstedspain/leku/LocationPickerActivity.kt @@ -284,16 +284,18 @@ class LocationPickerActivity : AppCompatActivity(), @SuppressLint("InlinedApi") private fun moveGoogleLogoToTopRight() { val contentView: View = findViewById(android.R.id.content) - val googleLogo: View = contentView.findViewWithTag("GoogleWatermark") - val glLayoutParams: RelativeLayout.LayoutParams = googleLogo.layoutParams as RelativeLayout.LayoutParams - glLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0) - glLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, 0) - glLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_START, 0) - glLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE) - glLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_END, RelativeLayout.TRUE) - val paddingTopInPixels = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24.0f, resources.displayMetrics).toInt() - googleLogo.setPadding(0, paddingTopInPixels, 0, 0) - googleLogo.layoutParams = glLayoutParams + val googleLogo: View? = contentView.findViewWithTag("GoogleWatermark") + googleLogo?.let { + val glLayoutParams: RelativeLayout.LayoutParams = it.layoutParams as RelativeLayout.LayoutParams + glLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0) + glLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, 0) + glLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_START, 0) + glLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE) + glLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_END, RelativeLayout.TRUE) + val paddingTopInPixels = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24.0f, resources.displayMetrics).toInt() + it.setPadding(0, paddingTopInPixels, 0, 0) + it.layoutParams = glLayoutParams + } } private fun checkLocationPermission() { @@ -415,13 +417,10 @@ class LocationPickerActivity : AppCompatActivity(), searchView = findViewById(R.id.leku_search) searchView?.setOnEditorActionListener { v, actionId, _ -> var handled = false - if (actionId == EditorInfo.IME_ACTION_SEARCH) { + if (actionId == EditorInfo.IME_ACTION_SEARCH && v.text.toString().isNotEmpty()) { retrieveLocationFrom(v.text.toString()) closeKeyboard() handled = true - if (!isLegacyLayoutEnabled) { - hideSearchLayout() - } } handled } @@ -470,7 +469,7 @@ class LocationPickerActivity : AppCompatActivity(), } private fun setUpFloatingButtons() { - val btnMyLocation = findViewById(R.id.btnFloatingAction) + val btnMyLocation = findViewById(R.id.btnMyLocation) btnMyLocation.setOnClickListener { checkLocationPermission() geocoderPresenter?.getLastKnownLocation() @@ -835,6 +834,7 @@ class LocationPickerActivity : AppCompatActivity(), override fun showLastLocation(location: Location) { currentLocation = location + didGetLastLocation() } override fun didGetLastLocation() { diff --git a/leku/src/main/res/layout-land/leku_activity_location_picker_legacy.xml b/leku/src/main/res/layout-land/leku_activity_location_picker_legacy.xml index bdb51417..60c42796 100644 --- a/leku/src/main/res/layout-land/leku_activity_location_picker_legacy.xml +++ b/leku/src/main/res/layout-land/leku_activity_location_picker_legacy.xml @@ -71,7 +71,7 @@ /> - +