diff --git a/plugins/Osmand-Nautical/AndroidManifest.xml b/plugins/Osmand-Nautical/AndroidManifest.xml index 69b47a7196..c32db38c58 100644 --- a/plugins/Osmand-Nautical/AndroidManifest.xml +++ b/plugins/Osmand-Nautical/AndroidManifest.xml @@ -12,7 +12,7 @@ android:icon="@drawable/icon" android:label="OsmAnd Nautical" > + + + + diff --git a/plugins/Osmand-Skimaps/build.gradle b/plugins/Osmand-Skimaps/build.gradle new file mode 100644 index 0000000000..9d9cc05dd9 --- /dev/null +++ b/plugins/Osmand-Skimaps/build.gradle @@ -0,0 +1,67 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 21 + buildToolsVersion "21.1.2" + + signingConfigs { + development { + storeFile file("../../keystores/debug.keystore") + storePassword "android" + keyAlias "androiddebugkey" + keyPassword "android" + } + + publishing { + storeFile file("../../osmand_key") + storePassword System.getenv("OSMAND_APK_PASSWORD") + keyAlias "androiddebugkey" + keyPassword System.getenv("OSMAND_APK_PASSWORD") + } + } + + defaultConfig { + minSdkVersion 9 + targetSdkVersion 21 + } + + lintOptions { + abortOnError false + } + + sourceSets { + main { + manifest.srcFile "AndroidManifest.xml" + jni.srcDirs = [] + jniLibs.srcDirs = [] + aidl.srcDirs = ["src"] + java.srcDirs = ["src"] + resources.srcDirs = ["src"] + renderscript.srcDirs = ["src"] + res.srcDirs = ["res"] + assets.srcDirs = ["assets"] + } + } + + buildTypes { + debug { + signingConfig signingConfigs.development + } + release { + signingConfig signingConfigs.publishing + } + } +} + +repositories { + ivy { + name = "OsmAndBinariesIvy" + url = "http://builder.osmand.net" + layout "pattern", { + artifact "ivy/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" + } + } +} + +dependencies { +} diff --git a/plugins/Osmand-Skimaps/proguard-project.txt b/plugins/Osmand-Skimaps/proguard-project.txt new file mode 100644 index 0000000000..f2fe1559a2 --- /dev/null +++ b/plugins/Osmand-Skimaps/proguard-project.txt @@ -0,0 +1,20 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/plugins/Osmand-Skimaps/project.properties b/plugins/Osmand-Skimaps/project.properties new file mode 100644 index 0000000000..4ab125693c --- /dev/null +++ b/plugins/Osmand-Skimaps/project.properties @@ -0,0 +1,14 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-19 diff --git a/plugins/Osmand-Skimaps/res/drawable-hdpi/ic_launcher.png b/plugins/Osmand-Skimaps/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000000..96a442e5b8 Binary files /dev/null and b/plugins/Osmand-Skimaps/res/drawable-hdpi/ic_launcher.png differ diff --git a/plugins/Osmand-Skimaps/res/drawable-hdpi/icon.png b/plugins/Osmand-Skimaps/res/drawable-hdpi/icon.png new file mode 100644 index 0000000000..03515c4279 Binary files /dev/null and b/plugins/Osmand-Skimaps/res/drawable-hdpi/icon.png differ diff --git a/plugins/Osmand-Skimaps/res/drawable-ldpi/ic_launcher.png b/plugins/Osmand-Skimaps/res/drawable-ldpi/ic_launcher.png new file mode 100644 index 0000000000..99238729d8 Binary files /dev/null and b/plugins/Osmand-Skimaps/res/drawable-ldpi/ic_launcher.png differ diff --git a/plugins/Osmand-Skimaps/res/drawable-ldpi/icon.png b/plugins/Osmand-Skimaps/res/drawable-ldpi/icon.png new file mode 100644 index 0000000000..c99e8a25f7 Binary files /dev/null and b/plugins/Osmand-Skimaps/res/drawable-ldpi/icon.png differ diff --git a/plugins/Osmand-Skimaps/res/drawable-mdpi/ic_launcher.png b/plugins/Osmand-Skimaps/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000000..359047dfa4 Binary files /dev/null and b/plugins/Osmand-Skimaps/res/drawable-mdpi/ic_launcher.png differ diff --git a/plugins/Osmand-Skimaps/res/drawable-mdpi/icon.png b/plugins/Osmand-Skimaps/res/drawable-mdpi/icon.png new file mode 100644 index 0000000000..4af917296f Binary files /dev/null and b/plugins/Osmand-Skimaps/res/drawable-mdpi/icon.png differ diff --git a/plugins/Osmand-Skimaps/res/drawable-xhdpi/ic_launcher.png b/plugins/Osmand-Skimaps/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000000..71c6d760f0 Binary files /dev/null and b/plugins/Osmand-Skimaps/res/drawable-xhdpi/ic_launcher.png differ diff --git a/plugins/Osmand-Skimaps/res/drawable-xhdpi/icon.png b/plugins/Osmand-Skimaps/res/drawable-xhdpi/icon.png new file mode 100644 index 0000000000..655980e952 Binary files /dev/null and b/plugins/Osmand-Skimaps/res/drawable-xhdpi/icon.png differ diff --git a/plugins/Osmand-Skimaps/res/drawable-xxhdpi/icon.png b/plugins/Osmand-Skimaps/res/drawable-xxhdpi/icon.png new file mode 100644 index 0000000000..a5f82c59aa Binary files /dev/null and b/plugins/Osmand-Skimaps/res/drawable-xxhdpi/icon.png differ diff --git a/plugins/Osmand-Skimaps/res/drawable-xxxhdpi/icon.png b/plugins/Osmand-Skimaps/res/drawable-xxxhdpi/icon.png new file mode 100644 index 0000000000..9a554aeef5 Binary files /dev/null and b/plugins/Osmand-Skimaps/res/drawable-xxxhdpi/icon.png differ diff --git a/plugins/Osmand-Skimaps/res/layout/main.xml b/plugins/Osmand-Skimaps/res/layout/main.xml new file mode 100644 index 0000000000..35e8b132cc --- /dev/null +++ b/plugins/Osmand-Skimaps/res/layout/main.xml @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/plugins/Osmand-Skimaps/res/values/strings.xml b/plugins/Osmand-Skimaps/res/values/strings.xml new file mode 100644 index 0000000000..1ac4c0dcad --- /dev/null +++ b/plugins/Osmand-Skimaps/res/values/strings.xml @@ -0,0 +1,8 @@ + + + No + Yes + OsmAnd is not installed + OsmAnd Ski Maps + OsmAnd Ski Maps Plugin is installed and enabled in OsmAnd settings. + \ No newline at end of file diff --git a/plugins/Osmand-Skimaps/src/net/osmand/skimaps/SkiMapsActivity.java b/plugins/Osmand-Skimaps/src/net/osmand/skimaps/SkiMapsActivity.java new file mode 100644 index 0000000000..ba6cb48380 --- /dev/null +++ b/plugins/Osmand-Skimaps/src/net/osmand/skimaps/SkiMapsActivity.java @@ -0,0 +1,61 @@ +package net.osmand.skimaps; + +import net.osmand.skimapsPlugin.R; +import android.app.Activity; +import android.app.AlertDialog; +import android.content.ActivityNotFoundException; +import android.content.ComponentName; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; +import android.net.Uri; +import android.os.Bundle; + +public class SkiMapsActivity extends Activity { + private static final String OSMAND_COMPONENT = "net.osmand"; //$NON-NLS-1$ + private static final String OSMAND_COMPONENT_PLUS = "net.osmand.plus"; //$NON-NLS-1$ + private static final String OSMAND_ACTIVITY = "net.osmand.plus.activities.MapActivity"; //$NON-NLS-1$ + + /** Called when the activity is first created. */ + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.main); + + Intent intentPlus = new Intent(); + intentPlus.setComponent(new ComponentName(OSMAND_COMPONENT_PLUS, OSMAND_ACTIVITY)); + intentPlus.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); + ResolveInfo resolved = getPackageManager().resolveActivity(intentPlus, PackageManager.MATCH_DEFAULT_ONLY); + if(resolved != null) { + stopService(intentPlus); + startActivity(intentPlus); + } else { + Intent intentNormal = new Intent(); + intentNormal.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); + intentNormal.setComponent(new ComponentName(OSMAND_COMPONENT, OSMAND_ACTIVITY)); + resolved = getPackageManager().resolveActivity(intentNormal, PackageManager.MATCH_DEFAULT_ONLY); + if (resolved != null) { + stopService(intentNormal); + startActivity(intentNormal); + } else { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setMessage(getString(R.string.osmand_app_not_found)); + builder.setPositiveButton(getString(R.string.shared_string_yes), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:" + OSMAND_COMPONENT_PLUS)); + try { + stopService(intent); + startActivity(intent); + } catch (ActivityNotFoundException e) { + } + } + }); + builder.setNegativeButton(getString(R.string.shared_string_no), null); + builder.show(); + } + } + } + +} \ No newline at end of file