diff --git a/build.gradle b/build.gradle index 6453cee..d3542b0 100644 --- a/build.gradle +++ b/build.gradle @@ -4,6 +4,13 @@ plugins { id 'com.android.library' version '7.2.1' apply false } +project.ext { + minSdkVersion = 21 + targetSdkVersion = 31 + buildToolsVersion = '32.0.0' + javaVersion = JavaVersion.VERSION_11 +} + task clean(type: Delete) { delete rootProject.buildDir } \ No newline at end of file diff --git a/lib/build.gradle b/lib/build.gradle index 55b6d8a..146a15c 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -3,13 +3,13 @@ plugins { } android { - compileSdk 32 + compileSdk project.targetSdkVersion defaultConfig { - minSdk 21 - targetSdk 32 + minSdk project.minSdkVersion + targetSdk project.targetSdkVersion + buildToolsVersion project.buildToolsVersion - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" } @@ -20,8 +20,8 @@ android { } } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility project.javaVersion + targetCompatibility project.javaVersion } } diff --git a/sample-app-capitals/build.gradle b/sample-app-capitals/build.gradle index 71f05a8..4ba03e1 100644 --- a/sample-app-capitals/build.gradle +++ b/sample-app-capitals/build.gradle @@ -3,12 +3,13 @@ plugins { } android { - compileSdk 32 + compileSdk project.targetSdkVersion defaultConfig { applicationId "app.organicmaps.api.sample.capitals" - minSdk 21 - targetSdk 32 + minSdk project.minSdkVersion + targetSdk project.targetSdkVersion + buildToolsVersion project.buildToolsVersion versionCode 1 versionName "1.0" } @@ -20,13 +21,12 @@ android { } } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility project.javaVersion + targetCompatibility project.javaVersion } } dependencies { - implementation 'androidx.appcompat:appcompat:1.4.2' implementation 'com.google.android.material:material:1.6.1' implementation project(path: ':lib') diff --git a/sample-app-capitals/src/main/java/app/organicmaps/api/sample/capitals/CapitalsListActivity.java b/sample-app-capitals/src/main/java/app/organicmaps/api/sample/capitals/CapitalsListActivity.java index 2e1ee3f..c416b84 100644 --- a/sample-app-capitals/src/main/java/app/organicmaps/api/sample/capitals/CapitalsListActivity.java +++ b/sample-app-capitals/src/main/java/app/organicmaps/api/sample/capitals/CapitalsListActivity.java @@ -65,9 +65,9 @@ public class CapitalsListActivity extends ListActivity private void showCityOnOMMap(City ... cities) { - ArrayList points = new ArrayList<>(cities.length); - for (int i = 0; i < cities.length; i++) - points.add(cities[i].toPoint()); + final ArrayList points = new ArrayList<>(cities.length); + for (City city : cities) + points.add(city.toPoint()); final String title = cities.length == 1 ? cities[0].getName() : "Capitals of the World"; final Intent intent = new MapRequest() @@ -84,7 +84,7 @@ public class CapitalsListActivity extends ListActivity if (requestCode != REQ_CODE_CITY || resultCode != RESULT_OK) return; - Intent intent = new Intent(this, CityDetailsActivity.class); + final Intent intent = new Intent(this, CityDetailsActivity.class); intent.putExtra(CityDetailsActivity.EXTRA_POINT, data); } diff --git a/sample-app-capitals/src/main/java/app/organicmaps/api/sample/capitals/City.java b/sample-app-capitals/src/main/java/app/organicmaps/api/sample/capitals/City.java index 0e612eb..34b3e4a 100644 --- a/sample-app-capitals/src/main/java/app/organicmaps/api/sample/capitals/City.java +++ b/sample-app-capitals/src/main/java/app/organicmaps/api/sample/capitals/City.java @@ -55,9 +55,8 @@ public class City this.altNames = altNames; } - @Override - public String toString() { return name; } - public Point toPoint() { return new Point(lat, lon, name, id); } + public String toString() { return name; } + public Point toPoint() { return new Point(lat, lon, name, id); } public String getId() { return id; } public String getName() { return name; } diff --git a/sample-app-capitals/src/main/java/app/organicmaps/api/sample/capitals/CityDetailsActivity.java b/sample-app-capitals/src/main/java/app/organicmaps/api/sample/capitals/CityDetailsActivity.java index 528675e..2ae5374 100644 --- a/sample-app-capitals/src/main/java/app/organicmaps/api/sample/capitals/CityDetailsActivity.java +++ b/sample-app-capitals/src/main/java/app/organicmaps/api/sample/capitals/CityDetailsActivity.java @@ -92,13 +92,13 @@ public class CityDetailsActivity extends Activity mAltNames.setText(mCity.getAltNames()); mCountry.setText(mCity.getCountryCode()); - mLat.setText(mCity.getLat() + ""); - mLon.setText(mCity.getLon() + ""); - final String evel = mCity.getElevation() != -9999 ? String.valueOf(mCity.getElevation()) : "No Data"; - mElev.setText(evel); + mLat.setText(String.valueOf(mCity.getLat())); + mLon.setText(String.valueOf(mCity.getLon())); + final String level = mCity.getElevation() != -9999 ? String.valueOf(mCity.getElevation()) : "No Data"; + mElev.setText(level); - final String popul = mCity.getPopulation() != -1 ? String.valueOf(mCity.getPopulation()) : "No Data"; - mPopulation.setText(popul); + final String population = mCity.getPopulation() != -1 ? String.valueOf(mCity.getPopulation()) : "No Data"; + mPopulation.setText(population); mTimeZone.setText(mCity.getTimeZone()); } } diff --git a/sample-pick-point/build.gradle b/sample-pick-point/build.gradle index 8ca2fda..0db6b58 100644 --- a/sample-pick-point/build.gradle +++ b/sample-pick-point/build.gradle @@ -3,12 +3,13 @@ plugins { } android { - compileSdk 32 + compileSdk project.targetSdkVersion defaultConfig { applicationId "app.organicmaps.api.sample.pick_point" - minSdk 21 - targetSdk 32 + minSdk project.minSdkVersion + targetSdk project.targetSdkVersion + buildToolsVersion project.buildToolsVersion versionCode 1 versionName "1.0" } @@ -20,8 +21,8 @@ android { } } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility project.javaVersion + targetCompatibility project.javaVersion } } diff --git a/sample-pick-point/src/main/java/app/organicmaps/api/sample/pick_point/MainActivity.java b/sample-pick-point/src/main/java/app/organicmaps/api/sample/pick_point/MainActivity.java index 90e87bf..e5d223d 100644 --- a/sample-pick-point/src/main/java/app/organicmaps/api/sample/pick_point/MainActivity.java +++ b/sample-pick-point/src/main/java/app/organicmaps/api/sample/pick_point/MainActivity.java @@ -1,3 +1,26 @@ +/****************************************************************************** + Copyright (c) 2022, Organic Maps OÜ. All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this list + of conditions and the following disclaimer. Redistributions in binary form must + reproduce the above copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + OF SUCH DAMAGE. + ******************************************************************************/ + package app.organicmaps.api.sample.pick_point; import android.content.Intent; diff --git a/settings.gradle b/settings.gradle index 062b962..7b9d100 100644 --- a/settings.gradle +++ b/settings.gradle @@ -14,5 +14,5 @@ dependencyResolutionManagement { } rootProject.name = "Organic Maps API" include ':sample-app-capitals' -include ':lib' include ':sample-pick-point' +include ':lib'