From 607a32ad46f8a3d7bedce57f22ffb0ac2231861c Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Wed, 25 Apr 2018 18:46:36 +0300 Subject: [PATCH] Added choose plan dialog to configure map srtm/hillshade settings --- .../net/osmand/plus/inapp/InAppPurchaseHelper.java | 2 +- .../net/osmand/plus/srtmplugin/ContourLinesMenu.java | 6 ++++-- .../src/net/osmand/plus/srtmplugin/HillshadeMenu.java | 11 +++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/inapp/InAppPurchaseHelper.java b/OsmAnd/src/net/osmand/plus/inapp/InAppPurchaseHelper.java index d30665dfc7..1a74139640 100644 --- a/OsmAnd/src/net/osmand/plus/inapp/InAppPurchaseHelper.java +++ b/OsmAnd/src/net/osmand/plus/inapp/InAppPurchaseHelper.java @@ -252,7 +252,7 @@ public class InAppPurchaseHelper { } public boolean needRequestInventory() { - return !ctx.getSettings().BILLING_PURCHASE_TOKEN_SENT.get() + return (ctx.getSettings().LIVE_UPDATES_PURCHASED.get() && !ctx.getSettings().BILLING_PURCHASE_TOKEN_SENT.get()) || System.currentTimeMillis() - lastValidationCheckTime > PURCHASE_VALIDATION_PERIOD_MSEC; } diff --git a/OsmAnd/src/net/osmand/plus/srtmplugin/ContourLinesMenu.java b/OsmAnd/src/net/osmand/plus/srtmplugin/ContourLinesMenu.java index f7e5099b9f..bcf8804b92 100644 --- a/OsmAnd/src/net/osmand/plus/srtmplugin/ContourLinesMenu.java +++ b/OsmAnd/src/net/osmand/plus/srtmplugin/ContourLinesMenu.java @@ -1,6 +1,5 @@ package net.osmand.plus.srtmplugin; -import android.content.Intent; import android.view.View; import android.widget.ArrayAdapter; @@ -11,8 +10,8 @@ import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; -import net.osmand.plus.activities.PluginActivity; import net.osmand.plus.activities.SettingsActivity; +import net.osmand.plus.chooseplan.ChoosePlanDialogFragment; import net.osmand.plus.download.DownloadActivityType; import net.osmand.plus.download.DownloadIndexesThread; import net.osmand.plus.download.DownloadResources; @@ -135,9 +134,12 @@ public class ContourLinesMenu { } }); } else if (itemId == R.string.srtm_plugin_name) { + ChoosePlanDialogFragment.showHillshadeSrtmPluginInstance(mapActivity.getSupportFragmentManager()); + /* Intent intent = new Intent(mapActivity, PluginActivity.class); intent.putExtra(PluginActivity.EXTRA_PLUGIN_ID, plugin.getId()); mapActivity.startActivity(intent); + */ closeDashboard(mapActivity); } else if (contourWidthProp != null && itemId == contourWidthName.hashCode()) { plugin.selectPropertyValue(mapActivity, contourWidthProp, widthPref, new Runnable() { diff --git a/OsmAnd/src/net/osmand/plus/srtmplugin/HillshadeMenu.java b/OsmAnd/src/net/osmand/plus/srtmplugin/HillshadeMenu.java index 2a1979fefc..821def2866 100644 --- a/OsmAnd/src/net/osmand/plus/srtmplugin/HillshadeMenu.java +++ b/OsmAnd/src/net/osmand/plus/srtmplugin/HillshadeMenu.java @@ -10,6 +10,7 @@ import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.chooseplan.ChoosePlanDialogFragment; import net.osmand.plus.download.DownloadActivityType; import net.osmand.plus.download.DownloadIndexesThread; import net.osmand.plus.download.DownloadResources; @@ -19,6 +20,8 @@ import net.osmand.plus.download.IndexItem; import java.io.IOException; import java.util.List; +import static net.osmand.plus.srtmplugin.ContourLinesMenu.closeDashboard; + public class HillshadeMenu { private static final String TAG = "HillshadeMenu"; @@ -71,6 +74,14 @@ public class HillshadeMenu { }); } }); + } else if (itemId == R.string.srtm_plugin_name) { + ChoosePlanDialogFragment.showHillshadeSrtmPluginInstance(mapActivity.getSupportFragmentManager()); + /* + Intent intent = new Intent(mapActivity, PluginActivity.class); + intent.putExtra(PluginActivity.EXTRA_PLUGIN_ID, plugin.getId()); + mapActivity.startActivity(intent); + */ + closeDashboard(mapActivity); } return false; }