Skip to content

Commit

Permalink
Merge pull request #70 from SchibstedSpain/satelliteFAB
Browse files Browse the repository at this point in the history
Added FAB for changing map type to satellite
  • Loading branch information
ferranpons authored Mar 17, 2017
2 parents 4c3db0a + e4bdfcc commit a7af046
Show file tree
Hide file tree
Showing 14 changed files with 140 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Include the dependency in your app `build.gradle`:

```groovy
dependencies {
compile 'com.schibstedspain.android:leku:3.0.0'
compile 'com.schibstedspain.android:leku:3.1.0'
}
```

Expand Down
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ android {
targetSdkVersion 25
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.android.tools.build:gradle:2.3.0'

classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.1.1"
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Aug 30 11:45:10 CEST 2016
#Fri Mar 17 11:33:48 CET 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
5 changes: 3 additions & 2 deletions leku/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apply plugin: 'com.novoda.bintray-release'
apply from: '../quality.gradle'

group = 'com.schibstedspain.android'
version = '3.0.0'
version = '3.1.0'

android {
compileSdkVersion 25
Expand All @@ -17,6 +17,7 @@ android {
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'lib-proguard-rules.txt'
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
Expand Down Expand Up @@ -68,7 +69,7 @@ publish {
userOrg = 'schibstedspain'
groupId = 'com.schibstedspain.android'
artifactId = 'leku'
publishVersion = '3.0.0'
publishVersion = '3.1.0'
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'
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
import java.util.Map;
import pl.charmas.android.reactivelocation.ReactiveLocationProvider;

import static com.google.android.gms.maps.GoogleMap.MAP_TYPE_NORMAL;
import static com.google.android.gms.maps.GoogleMap.MAP_TYPE_SATELLITE;

public class LocationPickerActivity extends AppCompatActivity
implements OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener, LocationListener, GoogleMap.OnMapLongClickListener,
Expand Down Expand Up @@ -245,6 +248,12 @@ private void setUpFloatingButtons() {
});
FloatingActionButton btnAcceptLocation = (FloatingActionButton) findViewById(R.id.btnAccept);
btnAcceptLocation.setOnClickListener(v -> returnCurrentPosition());

FloatingActionButton btnSatellite = (FloatingActionButton) 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);
});
}

private void updateValuesFromBundle(Bundle savedInstanceState) {
Expand Down Expand Up @@ -876,7 +885,7 @@ private String getFullAddressString(Address address) {

private void setDefaultMapSettings() {
if (map != null) {
map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
map.setMapType(MAP_TYPE_NORMAL);
map.setOnMapLongClickListener(this);
map.setOnMapClickListener(this);
map.getUiSettings().setCompassEnabled(false);
Expand Down
15 changes: 15 additions & 0 deletions leku/src/main/res/drawable/ic_satellite_off.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M21.7,16.2c0.3,0.4 0.2,0.9 -0.1,1.3c-0.4,0.4 -1,0.4 -1.4,0l-1.4,-1.4l-0.5,0.5c-0.4,0.4 -1,0.4 -1.4,0l-0.7,-0.7c-0.4,-0.4 -0.4,-1 0,-1.4l0.5,-0.5l-1.4,-1.4l-0.7,0.7c-0.4,0.4 -1,0.4 -1.4,0l-0.5,-0.5l-0.5,0.4c0.4,0.9 0.3,2.1 -0.5,2.8l-3.5,-3.5C9,11.8 10.1,11.6 11,12l0.5,-0.5L11,11.1c-0.4,-0.4 -0.4,-1 0,-1.4L11.8,9l-1.4,-1.4L9.8,8.1c-0.4,0.4 -1,0.4 -1.4,0L7.7,7.4C7.3,7 7.3,6.4 7.7,6l0.5,-0.5L6.9,4.1c-0.4,-0.4 -0.4,-1 0,-1.4c0.4,-0.4 0.9,-0.4 1.3,-0.1c0,0 0.1,0.1 0.1,0.1L21.7,16.2zM21.7,13.2l-2.1,-2.1l0.9,-0.9c0.4,-0.4 1,-0.4 1.4,0l0.7,0.7c0.4,0.4 0.4,1 0,1.4L21.7,13.2zM18.1,9.7l-3.5,-3.5l2.3,-2.3c0.8,-0.8 2,-0.8 2.8,0l0.7,0.7c0.8,0.8 0.8,2 0,2.8L18.1,9.7zM13.2,4.8L11,2.6L12,1.7c0.4,-0.4 1,-0.4 1.4,0l0.7,0.7c0.4,0.4 0.4,1 0,1.4L13.2,4.8z"/>
<path
android:fillColor="#FF000000"
android:pathData="M1.5,14.5c0,4.4 3.6,8 8,8c0.6,0 1,-0.4 1,-1s-0.4,-1 -1,-1c-3.3,0 -6,-2.7 -6,-6c0,-0.6 -0.4,-1 -1,-1S1.5,13.9 1.5,14.5z"/>
<path
android:fillColor="#FF000000"
android:pathData="M5.5,14.5c0,2.2 1.8,4 4,4c0.6,0 1,-0.4 1,-1s-0.4,-1 -1,-1c-1.1,0 -2,-0.9 -2,-2c0,-0.6 -0.4,-1 -1,-1S5.5,13.9 5.5,14.5z"/>
</vector>
9 changes: 9 additions & 0 deletions leku/src/main/res/drawable/ic_satellite_on.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M5.5,14.5c0,-0.6 0.4,-1 1,-1s1,0.4 1,1c0,1.1 0.9,2 2,2c0.6,0 1,0.4 1,1s-0.4,1 -1,1C7.3,18.5 5.5,16.7 5.5,14.5zM1.5,14.5c0,-0.6 0.4,-1 1,-1s1,0.4 1,1c0,3.3 2.7,6 6,6c0.6,0 1,0.4 1,1s-0.4,1 -1,1C5.1,22.5 1.5,18.9 1.5,14.5zM7.7,6L12,1.7c0.4,-0.4 1,-0.4 1.4,0l0.7,0.7c0.4,0.4 0.4,1 0,1.4l-1.4,1.4l1.4,1.4l2.8,-2.8c0.8,-0.8 2,-0.8 2.8,0l0.7,0.7c0.8,0.8 0.8,2 0,2.8l-2.8,2.8l1.4,1.4l1.4,-1.4c0.4,-0.4 1,-0.4 1.4,0l0.7,0.7c0.4,0.4 0.4,1 0,1.4l-4.3,4.2c-0.4,0.4 -1,0.4 -1.4,0l-0.7,-0.7c-0.4,-0.4 -0.4,-1 0,-1.4l1.4,-1.4l-1.4,-1.4l-1.6,1.6c-0.4,0.4 -1,0.4 -1.4,0l-0.5,-0.5l-0.5,0.4c0.4,0.9 0.3,2.1 -0.5,2.8l-3.5,-3.5C9,11.8 10.1,11.6 11,12l0.5,-0.5L11,11.1c-0.4,-0.4 -0.4,-1 0,-1.4l1.6,-1.6l-1.4,-1.4L9.8,8.1c-0.4,0.4 -1,0.4 -1.4,0L7.7,7.4C7.3,7 7.3,6.4 7.7,6z"/>
</vector>
16 changes: 16 additions & 0 deletions leku/src/main/res/layout-land/activity_location_picker.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,22 @@
android:animateLayoutChanges="true"
>

<android.support.design.widget.FloatingActionButton
android:id="@+id/btnSatellite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"
app:srcCompat="@drawable/ic_satellite_on"
app:fabSize="normal"
android:tint="?colorPrimary"
app:backgroundTint="@color/white"
app:rippleColor="@color/soft_grey"
app:elevation="2dp"
tools:background="@color/white"
/>

<android.support.design.widget.FloatingActionButton
android:id="@+id/btnFloatingAction"
android:layout_width="wrap_content"
Expand Down
17 changes: 17 additions & 0 deletions leku/src/main/res/layout-normal-v21/activity_location_picker.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,23 @@
android:animateLayoutChanges="true"
>

<android.support.design.widget.FloatingActionButton
android:id="@+id/btnSatellite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="8dp"
app:srcCompat="@drawable/ic_satellite_on"
app:fabSize="normal"
android:tint="?colorPrimary"
app:backgroundTint="@color/white"
app:rippleColor="@color/soft_grey"
app:elevation="2dp"
tools:background="@color/white"
/>

<android.support.design.widget.FloatingActionButton
android:id="@+id/btnFloatingAction"
android:layout_width="wrap_content"
Expand Down
16 changes: 16 additions & 0 deletions leku/src/main/res/layout-normal/activity_location_picker.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,22 @@
android:animateLayoutChanges="true"
>

<android.support.design.widget.FloatingActionButton
android:id="@+id/btnSatellite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"
app:srcCompat="@drawable/ic_satellite_on"
app:fabSize="normal"
android:tint="?colorPrimary"
app:backgroundTint="@color/white"
app:rippleColor="@color/soft_grey"
app:elevation="2dp"
tools:background="@color/white"
/>

<android.support.design.widget.FloatingActionButton
android:id="@+id/btnFloatingAction"
android:layout_width="wrap_content"
Expand Down
17 changes: 17 additions & 0 deletions leku/src/main/res/layout-xlarge-v21/activity_location_picker.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,23 @@
android:animateLayoutChanges="true"
>

<android.support.design.widget.FloatingActionButton
android:id="@+id/btnSatellite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="8dp"
app:srcCompat="@drawable/ic_satellite_on"
app:fabSize="normal"
android:tint="?colorPrimary"
app:backgroundTint="@color/white"
app:rippleColor="@color/soft_grey"
app:elevation="2dp"
tools:background="@color/white"
/>

<android.support.design.widget.FloatingActionButton
android:id="@+id/btnFloatingAction"
android:layout_width="wrap_content"
Expand Down
16 changes: 16 additions & 0 deletions leku/src/main/res/layout-xlarge/activity_location_picker.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,22 @@
android:animateLayoutChanges="true"
>

<android.support.design.widget.FloatingActionButton
android:id="@+id/btnSatellite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"
app:srcCompat="@drawable/ic_satellite_on"
app:fabSize="normal"
android:tint="?colorPrimary"
app:backgroundTint="@color/white"
app:rippleColor="@color/soft_grey"
app:elevation="2dp"
tools:background="@color/white"
/>

<android.support.design.widget.FloatingActionButton
android:id="@+id/btnFloatingAction"
android:layout_width="wrap_content"
Expand Down
16 changes: 16 additions & 0 deletions leku/src/main/res/layout/activity_location_picker.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,22 @@
android:animateLayoutChanges="true"
>

<android.support.design.widget.FloatingActionButton
android:id="@+id/btnSatellite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"
app:srcCompat="@drawable/ic_satellite_on"
app:fabSize="normal"
android:tint="?colorPrimary"
app:backgroundTint="@color/white"
app:rippleColor="@color/soft_grey"
app:elevation="2dp"
tools:background="@color/white"
/>

<android.support.design.widget.FloatingActionButton
android:id="@+id/btnFloatingAction"
android:layout_width="wrap_content"
Expand Down

0 comments on commit a7af046

Please sign in to comment.