Skip to content

Commit

Permalink
Added resource prefix to avoid name clashes (#135)
Browse files Browse the repository at this point in the history
* Added resource prefix to avoid name clashes

* upgraded lib version

* renamed all resources

* upgraded to api 27

* documentation updated

* checkstyle issue
  • Loading branch information
ferranpons authored Jan 9, 2018
1 parent 2bf0323 commit 976d7c3
Show file tree
Hide file tree
Showing 56 changed files with 196 additions and 187 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ env:
- DX_HEAP_SIZE=1536
- secure: "XcGPMdYdcDCrWZNWJKZDmmUX2BKkpaInTWF/OqInDHSAP8Qib/xw69YZvHGBUP9GBQ+C+9OzrCT0Kmg+d0SyS+uz8W6Yc9FzgDLs07lVyCGDpQKaTpcyct2nmh8+3iZiMYnlSYjgpZqwXKOC1cvrVcX8jA/NtwXhVVJHsaVKP0mV8Hw0hibxNTU+V+vl1rICePcLNe8WZnIe/ESn1cuFb/o2aUjENmIVD74hJIgjRph+YeZXerKbnjHU5IvNoSHnp25exUoH3COUwPabpt142EXKXOIqHs5OiqmlrnjuFrSe7/WKVgjKpAN/daVhKut0JlAMviU05Naj/sv/J+Zsqa6RkW4va/GP+qlmkSjgz7qJLp8OZfknxim1VhaOCdgoWi6fHSN5LeVXu4COjUg5G3hyfVSBRIydVOj68KulUBSvnxmC5NszdUaprivENy8FGkxqImZM2GeqlqlYtPis7GZQsmXjyva9IDWVaNy7XEl5w4fpW3Y5XEX0ITOUwcUmQ7D41CelYlg5gFXRdUn/5Xyl5obb58GkxJ5TNAp84cjqAubjpB0lVuhqK7izrRYq7bQLwY2M5VZSuDxX9liJK0SztjAs63MYeuZz/fgKDn7rqRKCUzM9kA1hOAcXyx1KpBKL9cVFIltswSgDyBTYl6OqpygVjHiNOLdEPuO3kSs="
- secure: "biJ1oYHr0J7wMouHbUbJ95zBDs63WzdmRwMjY3vydZGPn6brKsQNCvI+/bIjGqg7U03u06WRRQmuPO9bTjNbKj3H3pLn68nubAqz8YTNJvXdGZNowp8SoaTKeVBqVZXNTpcYmK3EBgAukSFGztC76TIg5+U7pO+X3Rc/ds/QMV3cJkgflcVndnwrCbN05szszUMD3n4s5MHtQ+KHyWwQXs3hl/i7wD6Yq8qUITmn1gHqzc6SxebiNo/kAF19+yQp2L6n0+JKPYlUSe88z1W8JEyNM1j4ohUM5OV7UtgYpJ9OqWIPBluV64ky5RMZBKA1mVxo3rLJ0SGTvZKAmQTiznnxKOxorfsQbRFt3DI8Bt1PoGcZsfTMVoE2vv7ycbCxaLQEZjf+DP44nFRDvdlwLuQlYTauYWDXsyQaeg7m0KfDhXJKH4cn2lSjDOMbR1Ym7xPMkoilAf7LhDG4PQ/RzM0L/ic97VZqnLAZAw+Sf62BDjHhoHANsjDqBNI/1LpVQ1QGII4wjU9J7b7ktmyc3+fjcqIKCpWchEZ3V+F1gjIem1UbLJekkbiFnrtMdOn8HiCwulglnxejrt6PBXvXr6hA5qy6tYDMbLI+j/RP/4Z0MvQ8Irt9xM3tupd0dSnqzTwUtTVYB4jFpcANaL3KxfTktxu478urIrf1d57okVU="
- ANDROID_API=26
- ANDROID_API=27
- EMULATOR_API=24
- ANDROID_BUILD_TOOLS=26.0.2
- ANDROID_BUILD_TOOLS=27.0.2
- ADB_INSTALL_TIMEOUT=5

before_cache:
Expand Down
29 changes: 18 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,18 @@ Include the dependency in your app `build.gradle`:

```groovy
dependencies {
compile 'com.schibstedspain.android:leku:3.6.2'
implementation 'com.schibstedspain.android:leku:3.7.0'
}
```

**IMPORTANT**: If you want support for Google Play Services version '8.4.0', and support library version '23.1.1' use version '1.0.0'. Beware that **version '1.0.0' is going not be maintained**. Also, if you want to use a version below 10.0.1 for Play Services you can use the version '2.3.1'.
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') {
exclude group: 'com.google.android.gms'
exclude group: 'com.android.support'
}
```


### Permissions
Expand Down Expand Up @@ -123,7 +130,7 @@ To use the LocationPickerActivity first you need to add these lines to your Andr
```xml
<activity
android:name="com.schibstedspain.leku.LocationPickerActivity"
android:label="@string/title_activity_location_picker"
android:label="@string/leku_title_activity_location_picker"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
android:windowSoftInputMode="adjustPan"
android:parentActivityName=".MainActivity">
Expand Down Expand Up @@ -198,14 +205,14 @@ If you would like to add more language translations the only thing you have to d
2. Add all text translations for those strings:

```xml
<string name="title_activity_location_picker">Location Picker</string>
<string name="load_location_error">Something went wrong. Please try again.</string>
<string name="no_search_results">There are no results for your search</string>
<string name="unknown_location">unknown location</string>
<string name="voice_search_promp">Search by voice…</string>
<string name="voice_search_extra_language">en-EN</string>
<string name="toolbar_action_voice_title">Voice</string>
<string name="search_hint">Search</string>
<string name="leku_title_activity_location_picker">Location Picker</string>
<string name="leku_load_location_error">Something went wrong. Please try again.</string>
<string name="leku_no_search_results">There are no results for your search</string>
<string name="leku_unknown_location">unknown location</string>
<string name="leku_voice_search_promp">Search by voice…</string>
<string name="leku_voice_search_extra_language">en-EN</string>
<string name="leku_toolbar_action_voice_title">Voice</string>
<string name="leku_search_hint">Search</string>
```

Note that you have the **voice_search_extra_language** that is used for the language of the voice recognition.
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
android:allowBackup="true"
android:fullBackupContent="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:label="@string/leku_app_name"
android:theme="@style/AppTheme"
android:supportsRtl="true"
tools:ignore="GoogleAppIndexingWarning"
Expand All @@ -36,7 +36,7 @@

<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:label="@string/leku_app_name"
>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
Expand All @@ -47,7 +47,7 @@

<activity
android:name="com.schibstedspain.leku.LocationPickerActivity"
android:label="@string/title_activity_location_picker"
android:label="@string/leku_title_activity_location_picker"
android:windowSoftInputMode="adjustPan"
android:theme="@style/AppTheme.Map"
>
Expand All @@ -57,7 +57,7 @@

<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable"
android:resource="@xml/leku_searchable"
/>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
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
@@ -1,5 +1,5 @@
<resources>
<string name="app_name" translatable="false">Leku Demo</string>
<string name="leku_app_name" translatable="false">Leku Demo</string>
<string name="google_maps_key"></string>
<string name="launch_map_picker" translatable="false">LAUNCH MAP LOCATION PICKER ACTIVITY</string>
<string name="launch_map_picker_with_pois" translatable="false">LAUNCH MAP WITH POIS</string>
Expand Down
1 change: 1 addition & 0 deletions leku/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ version = "${versionMajor}.${versionMinor}.${versionPatch}"
android {
compileSdkVersion 27
buildToolsVersion '27.0.2'
resourcePrefix 'leku_'

defaultConfig {
minSdkVersion 15
Expand Down
4 changes: 2 additions & 2 deletions leku/src/androidTest/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@

<activity
android:name="com.schibstedspain.leku.LocationPickerActivity"
android:label="@string/title_activity_location_picker"
android:label="@string/leku_title_activity_location_picker"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustPan"
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data android:name="android.app.searchable"
android:resource="@xml/searchable" />
android:resource="@xml/leku_searchable" />
</activity>
</application>

Expand Down
4 changes: 2 additions & 2 deletions leku/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data android:name="android.app.searchable"
android:resource="@xml/searchable" />
<meta-data android:name="android.leku_searchableable"
android:resource="@leku_searchableable" />
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public class LocationPickerActivity extends AppCompatActivity
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_location_picker);
setContentView(R.layout.leku_activity_location_picker);
setUpMainVariables();
setUpResultsList();
setUpToolBar();
Expand Down Expand Up @@ -236,7 +236,7 @@ public void onTextChanged(CharSequence charSequence, int start, int count, int a
clearSearchButton.setVisibility(View.INVISIBLE);
}
if (searchOption != null) {
searchOption.setIcon(R.drawable.ic_mic);
searchOption.setIcon(R.drawable.leku_ic_mic);
}
} else {
if (charSequence.length() > MIN_CHARACTERS) {
Expand All @@ -246,7 +246,7 @@ public void onTextChanged(CharSequence charSequence, int start, int count, int a
clearSearchButton.setVisibility(View.VISIBLE);
}
if (searchOption != null) {
searchOption.setIcon(R.drawable.ic_search);
searchOption.setIcon(R.drawable.leku_ic_search);
}
}
}
Expand All @@ -271,7 +271,8 @@ private void setUpFloatingButtons() {
btnSatellite.setOnClickListener(view -> {
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.setImageResource(
map.getMapType() == MAP_TYPE_SATELLITE ? R.drawable.leku_ic_satellite_off : R.drawable.leku_ic_satellite_on);
}
});
btnSatellite.setVisibility(enableSatelliteView ? View.VISIBLE : View.GONE);
Expand All @@ -297,7 +298,7 @@ private void setUpMapIfNeeded() {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.toolbar_menu, menu);
inflater.inflate(R.menu.leku_toolbar_menu, menu);
searchOption = menu.findItem(R.id.action_voice);
return true;
}
Expand Down Expand Up @@ -487,7 +488,7 @@ public void onMapClick(LatLng latLng) {

private void setNewPosition(LatLng latLng) {
if (currentLocation == null) {
currentLocation = new Location(getString(R.string.network_resource));
currentLocation = new Location(getString(R.string.leku_network_resource));
}
currentLocation.setLatitude(latLng.latitude);
currentLocation.setLongitude(latLng.longitude);
Expand All @@ -505,7 +506,7 @@ public void showLocations(List<Address> addresses) {
if (addresses != null) {
fillLocationList(addresses);
if (addresses.isEmpty()) {
Toast.makeText(getApplicationContext(), R.string.no_search_results, Toast.LENGTH_LONG)
Toast.makeText(getApplicationContext(), R.string.leku_no_search_results, Toast.LENGTH_LONG)
.show();
} else {
updateLocationNameList(addresses);
Expand Down Expand Up @@ -592,7 +593,7 @@ private void updateAddressLayoutVisibility() {
public void showLoadLocationError() {
progressBar.setVisibility(View.GONE);
changeListResultVisibility(View.GONE);
Toast.makeText(this, R.string.load_location_error, Toast.LENGTH_LONG).show();
Toast.makeText(this, R.string.leku_load_location_error, Toast.LENGTH_LONG).show();
}

@Override
Expand All @@ -610,7 +611,7 @@ public void showLastLocation(Location location) {
public void didGetLastLocation() {
if (currentLocation != null) {
if (!Geocoder.isPresent()) {
Toast.makeText(this, R.string.no_geocoder_available, Toast.LENGTH_LONG).show();
Toast.makeText(this, R.string.leku_no_geocoder_available, Toast.LENGTH_LONG).show();
return;
}
setUpMapIfNeeded();
Expand Down Expand Up @@ -725,7 +726,7 @@ private void setLayoutVisibilityFromBundle(Bundle transitionBundle) {

private void setLocationFromBundle(Bundle transitionBundle) {
if (currentLocation == null) {
currentLocation = new Location(getString(R.string.network_resource));
currentLocation = new Location(getString(R.string.leku_network_resource));
}
currentLocation.setLatitude(transitionBundle.getDouble(LATITUDE));
currentLocation.setLongitude(transitionBundle.getDouble(LONGITUDE));
Expand All @@ -737,9 +738,9 @@ private void startVoiceRecognitionActivity() {
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_PROMPT, getString(R.string.voice_search_promp));
intent.putExtra(RecognizerIntent.EXTRA_PROMPT, getString(R.string.leku_voice_search_promp));
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE,
getString(R.string.voice_search_extra_language));
getString(R.string.leku_voice_search_extra_language));

if (checkPlayServices()) {
try {
Expand All @@ -763,8 +764,8 @@ private boolean checkPlayServices() {
}

private void setCoordinatesInfo(LatLng latLng) {
this.latitude.setText(String.format("%s: %s", getString(R.string.latitude), latLng.latitude));
this.longitude.setText(String.format("%s: %s", getString(R.string.longitude), latLng.longitude));
this.latitude.setText(String.format("%s: %s", getString(R.string.leku_latitude), latLng.latitude));
this.longitude.setText(String.format("%s: %s", getString(R.string.leku_longitude), latLng.longitude));
showCoordinatesLayout();
}

Expand Down Expand Up @@ -812,7 +813,7 @@ public void onMarkerDrag(Marker marker) {
@Override
public void onMarkerDragEnd(Marker marker) {
if (currentLocation == null) {
currentLocation = new Location(getString(R.string.network_resource));
currentLocation = new Location(getString(R.string.leku_network_resource));
}
currentLekuPoi = null;
currentLocation.setLongitude(marker.getPosition().longitude);
Expand Down Expand Up @@ -938,7 +939,7 @@ private void updateLocationNameList(List<Address> addresses) {
locationNameList.clear();
for (Address address : addresses) {
if (address.getFeatureName() == null) {
locationNameList.add(getString(R.string.unknown_location));
locationNameList.add(getString(R.string.leku_unknown_location));
} else {
locationNameList.add(getFullAddressString(address));
}
Expand Down Expand Up @@ -1047,7 +1048,7 @@ private Marker addPoiMarker(LatLng latLng, String title, String address) {
private void setNewLocation(Address address) {
this.selectedAddress = address;
if (currentLocation == null) {
currentLocation = new Location(getString(R.string.network_resource));
currentLocation = new Location(getString(R.string.leku_network_resource));
}

currentLocation.setLatitude(address.getLatitude());
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
>
<solid android:color="@color/white_alpha"/>
<solid android:color="@color/leku_white_alpha"/>
<corners android:radius="4dp"/>
</shape>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
>
<solid android:color="@color/white"/>
<solid android:color="@color/leku_white"/>
<corners android:radius="4dp"/>
</shape>
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@
android:headerDividersEnabled="true"
android:elevation="2dp"
android:minWidth="296dp"
android:background="@drawable/toolbar_custom_background"
android:background="@drawable/leku_toolbar_custom_background"
tools:visibility="gone"
tools:ignore="UnusedAttribute,elevation"
/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/information_bottom_margin"
android:paddingBottom="@dimen/leku_information_bottom_margin"
android:orientation="vertical"
android:layout_gravity="bottom|end"
android:animateLayoutChanges="true"
Expand All @@ -61,13 +61,13 @@
android:layout_gravity="bottom|end"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
app:srcCompat="@drawable/ic_satellite_on"
app:srcCompat="@drawable/leku_ic_satellite_on"
app:fabSize="normal"
android:tint="?colorPrimary"
app:backgroundTint="@color/white"
app:rippleColor="@color/soft_grey"
app:backgroundTint="@color/leku_white"
app:rippleColor="@color/leku_soft_grey"
app:elevation="2dp"
tools:background="@color/white"
tools:background="@color/leku_white"
/>

<android.support.design.widget.FloatingActionButton
Expand All @@ -77,13 +77,13 @@
android:layout_gravity="bottom|end"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:src="@drawable/ic_gps_lime"
android:src="@drawable/leku_ic_gps_lime"
app:fabSize="normal"
android:tint="?colorPrimary"
app:backgroundTint="@color/white"
app:rippleColor="@color/soft_grey"
app:backgroundTint="@color/leku_white"
app:rippleColor="@color/leku_soft_grey"
app:elevation="2dp"
tools:background="@color/white"
tools:background="@color/leku_white"
/>

<FrameLayout
Expand All @@ -102,7 +102,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:background="@drawable/adress_custom_background"
android:background="@drawable/leku_adress_custom_background"
android:orientation="horizontal"
tools:ignore="UselessParent"
>
Expand All @@ -114,8 +114,8 @@
android:layout_weight="1"
>

<include layout="@layout/layout_coordinates" />
<include layout="@layout/layout_address" />
<include layout="@layout/leku_layout_coordinates" />
<include layout="@layout/leku_layout_address" />

</LinearLayout>

Expand All @@ -124,7 +124,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|end"
android:src="@drawable/ic_check_light"
android:src="@drawable/leku_ic_check_light"
app:fabSize="normal"
app:backgroundTint="?colorPrimary"
app:rippleColor="?colorPrimaryDark"
Expand All @@ -136,5 +136,5 @@
</FrameLayout>
</LinearLayout>

<include layout="@layout/toolbar_search" />
<include layout="@layout/leku_toolbar_search" />
</merge>
Loading

0 comments on commit 976d7c3

Please sign in to comment.