diff --git a/.gitignore b/.gitignore
index d664894e..65b536b6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,6 +14,7 @@ build/
local.properties
project.properties
app/src/debug/
+app/src/debug/*.xml
.idea/.name
.idea/*.xml
diff --git a/README.md b/README.md
index 63de58e0..efa9b3f1 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
[![Build Status](https://travis-ci.org/SchibstedSpain/Leku.svg?branch=master)](https://travis-ci.org/SchibstedSpain/Leku) [ ![Bintray](https://api.bintray.com/packages/schibstedspain/maven/leku/images/download.svg) ](https://bintray.com/schibstedspain/maven/leku/_latestVersion)
-Location picker component for Android that uses Google Maps and returns a latitude, longitude and an address based on the location picked in the LocationPickerActivity provided.
+Component library for Android that uses Google Maps and returns a latitude, longitude and an address based on the location picked with the Activity provided.
@@ -47,6 +47,7 @@ Location picker component for Android that uses Google Maps and returns a latitu
* Search by voice
* Search by text
* Geo Location by GPS, network
+* Google Places
* Pick locations using "touch" gestures on the map
* Customization (Theme and layout)
* Events Tracking
@@ -57,9 +58,9 @@ Location picker component for Android that uses Google Maps and returns a latitu
### Prerequisites
-minSdkVersion >= 15
-Google Play Services = 11.4.2
-Support Library = 26.1.0
+minSdkVersion >= 15
+Google Play Services = 11.8.0
+Support Library = 27.0.2
### Download
@@ -75,14 +76,14 @@ Include the dependency in your app `build.gradle`:
```groovy
dependencies {
- implementation 'com.schibstedspain.android:leku:3.7.0'
+ implementation 'com.schibstedspain.android:leku:4.0.0'
}
```
Alternatively, if you are using a different version of Google Play Services than `11.8.0` use this instead:
```groovy
-implementation ('com.schibstedspain.android:leku:3.6.2') {
+implementation ('com.schibstedspain.android:leku:4.0.0') {
exclude group: 'com.google.android.gms'
exclude group: 'com.android.support'
}
@@ -137,7 +138,7 @@ To use the LocationPickerActivity first you need to add these lines to your Andr
+ android:resource="@xml/leku_searchable" />
@@ -196,6 +197,38 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
That's all folks!
+#### Google Places
+
+Leku now supports Google Places queries using the search box. If you want to enable it these are the steps you need to follow:
+
+1. You need to replace your old `com.google.android.maps.v2.API_KEY` meta-data for the `com.google.android.geo.API_KEY`
+
+```xml
+
+
+
+```
+
+2. Enable Google Places API for Android on your [google developer console](https://console.developers.google.com/).
+
+3. Enable it when instantiating LocationPickerActivity by adding `.withGooglePlacesEnabled()`:
+
+```java
+Intent intent = new LocationPickerActivity.Builder()
+ **.withGooglePlacesEnabled()**
+ .build(getApplicationContext());
+```
+
+And you are good to go. :)
+
+
#### Localization
If you would like to add more language translations the only thing you have to do is:
@@ -358,8 +391,11 @@ private GeocoderPresenter geocoderPresenter;
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
***
- Geocoder geocoder = new Geocoder(this, Locale.getDefault());
- geocoderPresenter = new GeocoderPresenter(getApplicationContext(), new GeocoderInteractor(geocoder));
+ GooglePlacesDataSource placesDataSource = new GooglePlacesDataSource(Places.getGeoDataClient(this, null));
+ Geocoder geocoder = new Geocoder(this, Locale.getDefault());
+ apiInteractor = new GoogleGeocoderDataSource(new NetworkClient(), new AddressBuilder());
+ GeocoderRepository geocoderRepository = new GeocoderRepository(new AndroidGeocoderDataSource(geocoder), apiInteractor);
+ geocoderPresenter = new GeocoderPresenter(new ReactiveLocationProvider(getApplicationContext()), geocoderRepository, placesDataSource);
geocoderPresenter.setUI(this);
***
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index aba54c4f..693510ef 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -29,10 +29,16 @@
android:value="@integer/google_play_services_version"
/>
+
+
+
LAUNCH MAP LOCATION PICKER ACTIVITY
LAUNCH MAP WITH POIS
- version 3.7.0
+ version 4.0.0
diff --git a/leku/build.gradle b/leku/build.gradle
index db482525..9c6e5d8a 100644
--- a/leku/build.gradle
+++ b/leku/build.gradle
@@ -12,7 +12,7 @@ version = "${versionMajor}.${versionMinor}.${versionPatch}"
android {
compileSdkVersion 27
- buildToolsVersion '27.0.2'
+ buildToolsVersion '27.0.3'
resourcePrefix 'leku_'
defaultConfig {
@@ -56,6 +56,7 @@ dependencies {
def playServicesVersion = '11.8.0'
implementation "com.google.android.gms:play-services-maps:$playServicesVersion"
implementation "com.google.android.gms:play-services-location:$playServicesVersion"
+ implementation "com.google.android.gms:play-services-places:$playServicesVersion"
implementation 'pl.charmas.android:android-reactive-location2:2.0@aar'
@@ -86,7 +87,7 @@ twitterPlugin {
consumerSecret = System.getenv()['TWITTER_API_SECRET']
accessToken = System.getenv()['TWITTER_ACCESS_TOKEN']
accessTokenSecret = System.getenv()['TWITTER_ACCESS_TOKEN_SECRET']
- message = "New Leku version ${versionMajor}.${versionMinor}.${versionPatch} available for download. Check out the details at https://github.com/SchibstedSpain/Leku"
+ message = "New Leku version ${versionMajor}.${versionMinor}.${versionPatch} available for download. Check out the details at https://github.com/SchibstedSpain/Leku @SchibstedEng #Android #library #AndroidDev"
}
def getVersionMajor() {
diff --git a/leku/src/main/AndroidManifest.xml b/leku/src/main/AndroidManifest.xml
index 8d9c9172..e84d6d2f 100644
--- a/leku/src/main/AndroidManifest.xml
+++ b/leku/src/main/AndroidManifest.xml
@@ -14,7 +14,7 @@