diff --git a/OsmAnd/build.xml b/OsmAnd/build.xml index d4055eabbf..fb6a33464b 100644 --- a/OsmAnd/build.xml +++ b/OsmAnd/build.xml @@ -128,6 +128,14 @@ + + + + + + + + diff --git a/OsmAnd/res/values/no_translate.xml b/OsmAnd/res/values/no_translate.xml index 58a2de04a3..e6881f73b4 100644 --- a/OsmAnd/res/values/no_translate.xml +++ b/OsmAnd/res/values/no_translate.xml @@ -6,5 +6,5 @@ UA-28342846-2 10 true - + +play_market +gps_status -parking_plugin \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/Version.java b/OsmAnd/src/net/osmand/Version.java index 712c9b6f06..7fd8172686 100644 --- a/OsmAnd/src/net/osmand/Version.java +++ b/OsmAnd/src/net/osmand/Version.java @@ -12,6 +12,19 @@ public class Version { private final String appName; private final static String FREE_VERSION_NAME = "net.osmand"; + + public static boolean isGpsStatusEnabled(Context ctx) { + return ctx.getString(R.string.versionFeatures).contains("+gps_status"); + } + + public static boolean isGooglePlayEnabled(Context ctx) { + return ctx.getString(R.string.versionFeatures).contains("+play_market"); + } + + public static boolean isParkingPluginInlined(Context ctx) { + return ctx.getString(R.string.versionFeatures).contains("+parking_plugin"); + } + private Version(Context ctx) { appVersion = ctx.getString(R.string.app_version); appName = ctx.getString(R.string.app_name); diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index 10d41ebba1..245976acc9 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -15,6 +15,7 @@ import net.osmand.FavouritePoint; import net.osmand.GPXUtilities; import net.osmand.GPXUtilities.GPXFile; import net.osmand.LogUtil; +import net.osmand.Version; import net.osmand.access.AccessibleAlertBuilder; import net.osmand.access.AccessibleToast; import net.osmand.data.Amenity; @@ -972,16 +973,20 @@ public class MapActivityActions implements DialogProvider { return true; } }); - optionsMenuHelper.registerOptionsMenuItem(R.string.show_gps_status, R.string.show_gps_status, android.R.drawable.ic_menu_compass, new OnOptionsMenuClick() { - @Override - public void prepareOptionsMenu(Menu menu, MenuItem item) { - } - @Override - public boolean onClick(MenuItem item) { - startGpsStatusIntent(); - return false; - } - }); + if (Version.isGpsStatusEnabled(mapActivity)) { + optionsMenuHelper.registerOptionsMenuItem(R.string.show_gps_status, R.string.show_gps_status, + android.R.drawable.ic_menu_compass, new OnOptionsMenuClick() { + @Override + public void prepareOptionsMenu(Menu menu, MenuItem item) { + } + + @Override + public boolean onClick(MenuItem item) { + startGpsStatusIntent(); + return false; + } + }); + } optionsMenuHelper.registerOptionsMenuItem(R.string.show_point_options, R.string.show_point_options, new OnOptionsMenuClick() { @Override public void prepareOptionsMenu(Menu menu, MenuItem item) { @@ -1015,21 +1020,24 @@ public class MapActivityActions implements DialogProvider { if (resolved != null) { mapActivity.startActivity(intent); } else { - AlertDialog.Builder builder = new AccessibleAlertBuilder(mapActivity); - builder.setMessage(getString(R.string.gps_status_app_not_found)); - builder.setPositiveButton(getString(R.string.default_buttons_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:" + GPS_STATUS_COMPONENT)); - try { - mapActivity.startActivity(intent); - } catch (ActivityNotFoundException e) { + if (Version.isGooglePlayEnabled(mapActivity)) { + AlertDialog.Builder builder = new AccessibleAlertBuilder(mapActivity); + builder.setMessage(getString(R.string.gps_status_app_not_found)); + builder.setPositiveButton(getString(R.string.default_buttons_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:" + GPS_STATUS_COMPONENT)); + try { + mapActivity.startActivity(intent); + } catch (ActivityNotFoundException e) { + } } - } - }); - builder.setNegativeButton( - getString(R.string.default_buttons_no), null); - builder.show(); + }); + builder.setNegativeButton(getString(R.string.default_buttons_no), null); + builder.show(); + } else { + Toast.makeText(mapActivity, R.string.gps_status_app_not_found, Toast.LENGTH_LONG).show(); + } } }