Skip to content

Commit

Permalink
[NO ISSUE] Corrections behavior issues (#303)
Browse files Browse the repository at this point in the history
* [NO ISSUE] Corrected some issues

* Solved issue that prevents showing current location

* updated version
  • Loading branch information
ferranpons authored May 28, 2020
1 parent de9d4f3 commit e21d909
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 38 deletions.
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <b>legacy versions of Leku</b> that does not use AndroidX and want to use the latest Places SDK, you could use it in this way:

```groovy
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
<string name="launch_legacy_map_picker" translatable="false">LAUNCH LEGACY MAP LOCATION ACTIVITY</string>
<string name="launch_map_picker_with_pois" translatable="false">LAUNCH MAP WITH POIS</string>
<string name="launch_map_picker_with_style" translatable="false">LAUNCH MAP WITH STYLE</string>
<string name="leku_lib_version" translatable="false">version 7.0.1</string>
<string name="leku_lib_version" translatable="false">version 7.1.0</string>
</resources>
7 changes: 2 additions & 5 deletions docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <b>legacy versions of Leku</b> that does not use AndroidX and want to use the latest Places SDK, you could use it in this way:

```groovy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class LocationPickerActivityShould {
launchActivityWithoutLocationAndPermissions()
wait300millis()

onView(withId(R.id.btnFloatingAction)).perform(click())
onView(withId(R.id.btnMyLocation)).perform(click())
}

@Test
Expand Down Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -470,7 +469,7 @@ class LocationPickerActivity : AppCompatActivity(),
}

private fun setUpFloatingButtons() {
val btnMyLocation = findViewById<FloatingActionButton>(R.id.btnFloatingAction)
val btnMyLocation = findViewById<FloatingActionButton>(R.id.btnMyLocation)
btnMyLocation.setOnClickListener {
checkLocationPermission()
geocoderPresenter?.getLastKnownLocation()
Expand Down Expand Up @@ -835,6 +834,7 @@ class LocationPickerActivity : AppCompatActivity(),

override fun showLastLocation(location: Location) {
currentLocation = location
didGetLastLocation()
}

override fun didGetLastLocation() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
/>

<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/btnFloatingAction"
android:id="@+id/btnMyLocation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
/>

<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/btnFloatingAction"
android:id="@+id/btnMyLocation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
/>

<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/btnFloatingAction"
android:id="@+id/btnMyLocation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
/>

<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/btnFloatingAction"
android:id="@+id/btnMyLocation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
/>

<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/btnFloatingAction"
android:id="@+id/btnMyLocation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
Expand Down
11 changes: 9 additions & 2 deletions leku/src/main/res/layout/leku_activity_location_picker.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
/>

<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/btnFloatingAction"
android:id="@+id/btnMyLocation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
Expand Down Expand Up @@ -102,7 +102,9 @@
android:baselineAligned="false"
android:paddingBottom="62dp"
android:paddingStart="24dp"
android:paddingLeft="24dp"
android:paddingEnd="24dp"
android:paddingRight="24dp"
>

<LinearLayout
Expand All @@ -128,7 +130,12 @@
tools:ignore="UnusedAttribute" />

<include layout="@layout/leku_layout_coordinates" />
<include layout="@layout/leku_layout_address" />
<include layout="@layout/leku_layout_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="22dp"
android:layout_marginRight="22dp"
/>

<Button
android:id="@+id/btnAccept"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
/>

<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/btnFloatingAction"
android:id="@+id/btnMyLocation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
Expand Down
4 changes: 2 additions & 2 deletions version.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
MAJOR=7
MINOR=0
PATCH=1
MINOR=1
PATCH=0

0 comments on commit e21d909

Please sign in to comment.