Added depth contours

This commit is contained in:
Alexey Kulish 2017-03-20 20:04:34 +03:00
parent 2afd647daf
commit 35b1b4d1a3
12 changed files with 196 additions and 80 deletions

View file

@ -85,6 +85,7 @@
android:paddingRight="18dp"
android:background="@drawable/buy_btn_background_light"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/dashFavIconMargin"
android:layout_marginRight="8dp"
android:textColor="@color/buy_button_color"
android:text="@string/buy"

View file

@ -9,6 +9,12 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
<string name="sea_depth_thanks">Thank you for purchasing sea depth contours!</string>
<string name="index_item_depth_contours_osmand_ext">Depth contours</string>
<string name="index_item_depth_points_southern_hemisphere">Depth points southern hemisphere</string>
<string name="index_item_depth_points_northern_hemisphere">Depth points northern hemisphere</string>
<string name="download_depth_countours">Depth contours</string>
<string name="nautical_maps">Nautical maps</string>
<string name="analyze_on_map">Analyze on map</string>
<string name="shared_string_visible">Visible</string>
<string name="restore_purchases">Restore purchases</string>

View file

@ -919,6 +919,7 @@ public class OsmandSettings {
public final OsmandPreference<Boolean> BILLING_PURCHASE_TOKEN_SENT = new BooleanPreference("billing_purchase_token_sent", false).makeGlobal();
public final OsmandPreference<Boolean> LIVE_UPDATES_PURCHASED = new BooleanPreference("billing_live_updates_purchased", false).makeGlobal();
public final OsmandPreference<Boolean> FULL_VERSION_PURCHASED = new BooleanPreference("billing_full_version_purchased", false).makeGlobal();
public final OsmandPreference<Boolean> DEPTH_CONTOURS_PURCHASED = new BooleanPreference("billing_sea_depth_purchased", false).makeGlobal();
public final OsmandPreference<Integer> DISCOUNT_ID = new IntPreference("discount_id", 0).makeGlobal();
public final OsmandPreference<Integer> DISCOUNT_SHOW_NUMBER_OF_STARTS = new IntPreference("number_of_starts_on_discount_show", 0).makeGlobal();

View file

@ -229,6 +229,18 @@ public class DownloadActivity extends AbstractDownloadActivity implements Downlo
}
}
public void purchaseFullVersion() {
if (inAppHelper != null) {
inAppHelper.purchaseFullVersion(this);
}
}
public void purchaseDepthContours() {
if (inAppHelper != null) {
inAppHelper.purchaseDepthContours(this);
}
}
public DownloadIndexesThread getDownloadThread() {
return downloadThread;
}

View file

@ -39,6 +39,8 @@ public class DownloadActivityType {
new DownloadActivityType(R.string.download_roads_only_maps, "road_map", 30);
public static final DownloadActivityType SRTM_COUNTRY_FILE =
new DownloadActivityType(R.string.download_srtm_maps, R.drawable.ic_plugin_srtm, "srtm_map", 40);
public static final DownloadActivityType DEPTH_CONTOUR_FILE =
new DownloadActivityType(R.string.download_regular_maps, "depth", 45);
public static final DownloadActivityType HILLSHADE_FILE =
new DownloadActivityType(R.string.download_hillshade_maps, R.drawable.ic_action_hillshade_dark, "hillshade", 50);
public static final DownloadActivityType WIKIPEDIA_FILE =
@ -124,13 +126,15 @@ public class DownloadActivityType {
IndexConstants.BINARY_MAP_VERSION));
} else if (HILLSHADE_FILE == this) {
return fileName.endsWith(IndexConstants.SQLITE_EXT);
} else if (DEPTH_CONTOUR_FILE == this) {
return fileName.endsWith(addVersionToExt(IndexConstants.BINARY_MAP_INDEX_EXT_ZIP, IndexConstants.BINARY_MAP_VERSION));
}
return false;
}
public File getDownloadFolder(OsmandApplication ctx, IndexItem indexItem) {
if (NORMAL_FILE == this) {
if(indexItem.fileName.endsWith(IndexConstants.SQLITE_EXT)) {
if (indexItem.fileName.endsWith(IndexConstants.SQLITE_EXT)) {
return ctx.getAppPath(IndexConstants.TILES_INDEX_DIR);
}
return ctx.getAppPath(IndexConstants.MAPS_PATH);
@ -148,6 +152,8 @@ public class DownloadActivityType {
return ctx.getAppPath(IndexConstants.LIVE_INDEX_DIR);
} else if (HILLSHADE_FILE == this) {
return ctx.getAppPath(IndexConstants.TILES_INDEX_DIR);
} else if (DEPTH_CONTOUR_FILE == this) {
return ctx.getAppPath(IndexConstants.MAPS_PATH);
}
throw new UnsupportedOperationException();
}
@ -191,33 +197,34 @@ public class DownloadActivityType {
return BINARY_MAP_INDEX_EXT;
} else if (HILLSHADE_FILE == this) {
return IndexConstants.SQLITE_EXT;
} else if (DEPTH_CONTOUR_FILE == this) {
return BINARY_MAP_INDEX_EXT;
}
throw new UnsupportedOperationException();
}
public String getUrlSuffix(OsmandApplication ctx) {
if (this== DownloadActivityType.ROADS_FILE) {
if (this== ROADS_FILE) {
return "&road=yes";
} else if (this == DownloadActivityType.LIVE_UPDATES_FILE) {
} else if (this == LIVE_UPDATES_FILE) {
return "&aosmc=yes";
} else if (this == DownloadActivityType.SRTM_COUNTRY_FILE) {
} else if (this == SRTM_COUNTRY_FILE) {
return "&srtmcountry=yes";
} else if (this == DownloadActivityType.WIKIPEDIA_FILE) {
} else if (this == WIKIPEDIA_FILE) {
return "&wiki=yes";
}else if (this == DownloadActivityType.HILLSHADE_FILE) {
} else if (this == HILLSHADE_FILE) {
return "&hillshade=yes";
} else if (this == FONT_FILE) {
return "&fonts=yes";
} else if (this == DEPTH_CONTOUR_FILE) {
return "&inapp=depth";
}
return "";
}
public String getBaseUrl(OsmandApplication ctx, String fileName) {
if (this == FONT_FILE) {
return "http://" + IndexConstants.INDEX_DOWNLOAD_DOMAIN + "/download?event=2&fonts=yes&"
+ Version.getVersionAsURLParam(ctx) + "&file=" + encode(fileName);
} else {
return "http://" + IndexConstants.INDEX_DOWNLOAD_DOMAIN + "/download?event=2&"
+ Version.getVersionAsURLParam(ctx) + "&file=" + encode(fileName);
}
return "http://" + IndexConstants.INDEX_DOWNLOAD_DOMAIN + "/download?event=2&"
+ Version.getVersionAsURLParam(ctx) + "&file=" + encode(fileName);
}
@ -258,12 +265,16 @@ public class DownloadActivityType {
}
public String getVisibleDescription(IndexItem indexItem, Context ctx) {
if (this == DownloadActivityType.SRTM_COUNTRY_FILE) {
if (this == SRTM_COUNTRY_FILE) {
return ctx.getString(R.string.download_srtm_maps);
} else if (this == DownloadActivityType.WIKIPEDIA_FILE) {
} else if (this == WIKIPEDIA_FILE) {
return ctx.getString(R.string.shared_string_wikipedia);
} else if (this == DownloadActivityType.ROADS_FILE) {
} else if (this == ROADS_FILE) {
return ctx.getString(R.string.download_roads_only_item);
} else if (this == DEPTH_CONTOUR_FILE) {
return ctx.getString(R.string.download_depth_countours);
} else if (this == FONT_FILE) {
return ctx.getString(R.string.fonts_header);
}
return "";
}
@ -334,13 +345,13 @@ public class DownloadActivityType {
l = fileName.length();
}
String baseNameWithoutVersion = fileName.substring(0, l);
if (this == DownloadActivityType.SRTM_COUNTRY_FILE) {
if (this == SRTM_COUNTRY_FILE) {
return baseNameWithoutVersion + IndexConstants.BINARY_SRTM_MAP_INDEX_EXT;
}
if (this == DownloadActivityType.WIKIPEDIA_FILE) {
if (this == WIKIPEDIA_FILE) {
return baseNameWithoutVersion + IndexConstants.BINARY_WIKI_MAP_INDEX_EXT;
}
if (this == DownloadActivityType.ROADS_FILE) {
if (this == ROADS_FILE) {
return baseNameWithoutVersion + IndexConstants.BINARY_ROAD_MAP_INDEX_EXT;
}
baseNameWithoutVersion += IndexConstants.BINARY_MAP_INDEX_EXT;

View file

@ -34,6 +34,7 @@ public class DownloadResourceGroup {
SRTM_HEADER(R.string.download_srtm_maps),
HILLSHADE_HEADER(R.string.download_hillshade_maps),
OTHER_MAPS_HEADER(R.string.download_select_map_types),
NAUTICAL_MAPS_HEADER(R.string.nautical_maps),
// headers with voice items
VOICE_HEADER_TTS(R.string.index_name_tts_voice),
VOICE_HEADER_REC(R.string.index_name_voice),
@ -79,7 +80,7 @@ public class DownloadResourceGroup {
|| this == WORLD_MAPS || this == REGION_MAPS || this == OTHER_GROUP
|| this == HILLSHADE_HEADER || this == SRTM_HEADER
|| this == OTHER_MAPS_HEADER || this == OTHER_MAPS_GROUP
|| this == FONTS_HEADER;
|| this == FONTS_HEADER || this == NAUTICAL_MAPS_HEADER;
}
public static String getVoiceTTSId() {

View file

@ -255,6 +255,8 @@ public class DownloadResources extends DownloadResourceGroup {
DownloadResourceGroup fonts = new DownloadResourceGroup(otherGroup, DownloadResourceGroupType.FONTS_HEADER);
DownloadResourceGroup worldMaps = new DownloadResourceGroup(this, DownloadResourceGroupType.WORLD_MAPS);
DownloadResourceGroup nauticalMaps = new DownloadResourceGroup(this, DownloadResourceGroupType.NAUTICAL_MAPS_HEADER);
Map<WorldRegion, List<IndexItem> > groupByRegion = new LinkedHashMap<WorldRegion, List<IndexItem>>();
OsmandRegions regs = app.getRegions();
for (IndexItem ii : resources) {
@ -270,6 +272,12 @@ public class DownloadResources extends DownloadResourceGroup {
fonts.addItem(ii);
continue;
}
if (ii.getType() == DownloadActivityType.DEPTH_CONTOUR_FILE) {
if (app.getSettings().DEPTH_CONTOURS_PURCHASED.get() || nauticalMaps.size() == 0) {
nauticalMaps.addItem(ii);
}
continue;
}
String basename = ii.getBasename().toLowerCase();
WorldRegion wg = regs.getRegionDataByDownloadName(basename);
if (wg != null) {
@ -279,7 +287,11 @@ public class DownloadResources extends DownloadResourceGroup {
groupByRegion.get(wg).add(ii);
} else {
if (ii.getFileName().startsWith("World_")) {
worldMaps.addItem(ii);
if (ii.getFileName().toLowerCase().startsWith(WORLD_SEAMARKS_KEY)) {
nauticalMaps.addItem(ii);
} else {
worldMaps.addItem(ii);
}
} else {
otherMaps.addItem(ii);
}
@ -324,6 +336,7 @@ public class DownloadResources extends DownloadResourceGroup {
// 2. if there is no subregions and there only 1 index item it could be merged to the level up - objection there is no such maps
// 3. if hillshade/srtm is disabled, all maps from inner level could be combined into 1
addGroup(worldMaps);
addGroup(nauticalMaps);
if (otherMaps.size() > 0) {
addGroup(otherMapsGroup);
}

View file

@ -190,6 +190,8 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
@Override
public void onItemPurchased(String sku) {
getMyApplication().getDownloadThread().runReloadIndexFilesSilent();
//reloadData();
}
@Override

View file

@ -1,7 +1,6 @@
package net.osmand.plus.download.ui;
import android.annotation.SuppressLint;
import android.content.ActivityNotFoundException;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Resources;
@ -23,7 +22,6 @@ import android.widget.Toast;
import net.osmand.map.WorldRegion;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.Version;
import net.osmand.plus.activities.LocalIndexHelper.LocalIndexType;
import net.osmand.plus.activities.LocalIndexInfo;
import net.osmand.plus.download.CityItem;
@ -53,6 +51,7 @@ public class ItemViewHolder {
private boolean srtmNeedsInstallation;
private boolean nauticalPluginDisabled;
private boolean freeVersion;
private boolean depthContoursPurchased;
protected final DownloadActivity context;
@ -74,7 +73,8 @@ public class ItemViewHolder {
ASK_FOR_SEAMARKS_PLUGIN,
ASK_FOR_SRTM_PLUGIN_PURCHASE,
ASK_FOR_SRTM_PLUGIN_ENABLE,
ASK_FOR_FULL_VERSION_PURCHASE
ASK_FOR_FULL_VERSION_PURCHASE,
ASK_FOR_DEPTH_CONTOURS_PURCHASE
}
@ -130,6 +130,7 @@ public class ItemViewHolder {
nauticalPluginDisabled = context.isNauticalPluginDisabled();
freeVersion = context.isFreeVersion();
srtmNeedsInstallation = context.isSrtmNeedsInstallation();
depthContoursPurchased = context.getMyApplication().getSettings().DEPTH_CONTOURS_PURCHASED.get();
}
public void bindIndexItem(final IndexItem indexItem) {
@ -177,7 +178,9 @@ public class ItemViewHolder {
if (!isDownloading) {
progressBar.setVisibility(View.GONE);
descrTextView.setVisibility(View.VISIBLE);
if ((indexItem.getType() == DownloadActivityType.SRTM_COUNTRY_FILE ||
if (indexItem.getType() == DownloadActivityType.DEPTH_CONTOUR_FILE && !depthContoursPurchased) {
descrTextView.setVisibility(View.GONE);
} else if ((indexItem.getType() == DownloadActivityType.SRTM_COUNTRY_FILE ||
indexItem.getType() == DownloadActivityType.HILLSHADE_FILE) && srtmDisabled) {
if(showTypeInName) {
descrTextView.setText("");
@ -311,8 +314,12 @@ public class ItemViewHolder {
clickAction = RightButtonAction.ASK_FOR_SRTM_PLUGIN_ENABLE;
}
} else if (indexItem.getType() == DownloadActivityType.WIKIPEDIA_FILE && freeVersion) {
} else if (indexItem.getType() == DownloadActivityType.WIKIPEDIA_FILE && freeVersion
&& !context.getMyApplication().getSettings().FULL_VERSION_PURCHASED.get()) {
clickAction = RightButtonAction.ASK_FOR_FULL_VERSION_PURCHASE;
} else if (indexItem.getType() == DownloadActivityType.DEPTH_CONTOUR_FILE
&& !context.getMyApplication().getSettings().DEPTH_CONTOURS_PURCHASED.get()) {
clickAction = RightButtonAction.ASK_FOR_DEPTH_CONTOURS_PURCHASE;
}
return clickAction;
}
@ -323,39 +330,37 @@ public class ItemViewHolder {
@Override
public void onClick(View v) {
switch (clickAction) {
case ASK_FOR_FULL_VERSION_PURCHASE:
context.getMyApplication().logEvent(context, "click_buy_plus");
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Version.marketPrefix(context
.getMyApplication()) + "net.osmand.plus"));
try {
context.startActivity(intent);
} catch (ActivityNotFoundException e) {
//ignore
}
break;
case ASK_FOR_SEAMARKS_PLUGIN:
context.startActivity(new Intent(context, context.getMyApplication().getAppCustomization()
.getPluginsActivity()));
Toast.makeText(context.getApplicationContext(),
context.getString(R.string.activate_seamarks_plugin), Toast.LENGTH_SHORT).show();
break;
case ASK_FOR_SRTM_PLUGIN_PURCHASE:
OsmandPlugin plugin = OsmandPlugin.getPlugin(SRTMPlugin.class);
if(plugin == null || plugin.getInstallURL() == null) {
case ASK_FOR_FULL_VERSION_PURCHASE:
context.getMyApplication().logEvent(context, "click_buy_plus_inapp");
context.purchaseFullVersion();
break;
case ASK_FOR_DEPTH_CONTOURS_PURCHASE:
context.getMyApplication().logEvent(context, "click_buy_depth_contours_inapp");
context.purchaseDepthContours();
break;
case ASK_FOR_SEAMARKS_PLUGIN:
context.startActivity(new Intent(context, context.getMyApplication().getAppCustomization()
.getPluginsActivity()));
Toast.makeText(context.getApplicationContext(),
context.getString(R.string.activate_srtm_plugin), Toast.LENGTH_LONG).show();
} else {
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(plugin.getInstallURL())));
}
break;
case ASK_FOR_SRTM_PLUGIN_ENABLE:
context.startActivity(new Intent(context, context.getMyApplication().getAppCustomization()
.getPluginsActivity()));
Toast.makeText(context, context.getString(R.string.activate_srtm_plugin),
Toast.LENGTH_SHORT).show();
break;
case DOWNLOAD:
break;
context.getString(R.string.activate_seamarks_plugin), Toast.LENGTH_SHORT).show();
break;
case ASK_FOR_SRTM_PLUGIN_PURCHASE:
OsmandPlugin plugin = OsmandPlugin.getPlugin(SRTMPlugin.class);
if(plugin == null || plugin.getInstallURL() == null) {
Toast.makeText(context.getApplicationContext(),
context.getString(R.string.activate_srtm_plugin), Toast.LENGTH_LONG).show();
} else {
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(plugin.getInstallURL())));
}
break;
case ASK_FOR_SRTM_PLUGIN_ENABLE:
context.startActivity(new Intent(context, context.getMyApplication().getAppCustomization()
.getPluginsActivity()));
Toast.makeText(context, context.getString(R.string.activate_srtm_plugin),
Toast.LENGTH_SHORT).show();
break;
case DOWNLOAD:
break;
}
}
};

View file

@ -218,6 +218,12 @@ public class FileNameTranslationHelper {
return ctx.getString(R.string.index_item_world_bitcoin_payments);
} else if (basename.equals("world_seamarks_basemap")) {
return ctx.getString(R.string.index_item_world_seamarks);
} else if (basename.equals("depth_contours_osmand_ext")) {
return ctx.getString(R.string.index_item_depth_contours_osmand_ext);
} else if (basename.equals("depth_points_southern_hemisphere_osmand_ext")) {
return ctx.getString(R.string.index_item_depth_points_southern_hemisphere);
} else if (basename.equals("depth_points_northern_hemisphere_osmand_ext")) {
return ctx.getString(R.string.index_item_depth_points_northern_hemisphere);
}
return null;
}

View file

@ -38,14 +38,19 @@ public class InAppHelper {
private static boolean mSubscribedToLiveUpdates = false;
private static boolean mFullVersionPurchased = false;
private static boolean mDepthContoursPurchased = false;
private static String mLiveUpdatesPrice;
private static long lastValidationCheckTime;
private static String mFullVersionPrice;
private static String mDepthContoursPrice;
public static final String SKU_FULL_VERSION_PRICE = "osmand_full_version_price";
private static final String SKU_LIVE_UPDATES_FULL = "osm_live_subscription_2";
private static final String SKU_LIVE_UPDATES_FREE = "osm_free_live_subscription_2";
private static final String SKU_DEPTH_CONTOURS_FULL = "net.osmand.seadepth_plus";
private static final String SKU_DEPTH_CONTOURS_FREE = "net.osmand.seadepth";
public static String SKU_LIVE_UPDATES;
public static String SKU_DEPTH_CONTOURS;
private static final long PURCHASE_VALIDATION_PERIOD_MSEC = 1000 * 60 * 60 * 24; // daily
// (arbitrary) request code for the purchase flow
@ -107,10 +112,18 @@ public class InAppHelper {
return mFullVersionPurchased;
}
public static boolean isDepthContoursPurchased() {
return mDepthContoursPurchased;
}
public static String getLiveUpdatesPrice() {
return mLiveUpdatesPrice;
}
public static String getDepthContoursPrice() {
return mDepthContoursPrice;
}
public static String getFullVersionPrice() {
return mFullVersionPrice;
}
@ -132,6 +145,13 @@ public class InAppHelper {
SKU_LIVE_UPDATES = SKU_LIVE_UPDATES_FULL;
}
}
if (SKU_DEPTH_CONTOURS == null) {
if (Version.isFreeVersion(ctx)) {
SKU_DEPTH_CONTOURS = SKU_DEPTH_CONTOURS_FREE;
} else {
SKU_DEPTH_CONTOURS = SKU_DEPTH_CONTOURS_FULL;
}
}
}
public InAppHelper(OsmandApplication ctx, boolean forceRequestInventory) {
@ -142,8 +162,10 @@ public class InAppHelper {
if (isDeveloperVersion) {
mSubscribedToLiveUpdates = true;
mFullVersionPurchased = true;
mDepthContoursPurchased = true;
ctx.getSettings().LIVE_UPDATES_PURCHASED.set(true);
ctx.getSettings().FULL_VERSION_PURCHASED.set(true);
ctx.getSettings().DEPTH_CONTOURS_PURCHASED.set(true);
}
}
@ -225,9 +247,8 @@ public class InAppHelper {
logDebug("Setup successful. Querying inventory.");
List<String> skus = new ArrayList<>();
skus.add(SKU_LIVE_UPDATES);
if (forceRequestInventory) {
skus.add(SKU_FULL_VERSION_PRICE);
}
skus.add(SKU_DEPTH_CONTOURS);
skus.add(SKU_FULL_VERSION_PRICE);
mHelper.queryInventoryAsync(true, skus, mGotInventoryListener);
} else {
notifyDismissProgress();
@ -278,6 +299,12 @@ public class InAppHelper {
ctx.getSettings().FULL_VERSION_PURCHASED.set(true);
}
Purchase depthContoursPurchase = inventory.getPurchase(SKU_DEPTH_CONTOURS);
mDepthContoursPurchased = isDeveloperVersion || (depthContoursPurchase != null && depthContoursPurchase.getPurchaseState() == 0);
if (mDepthContoursPurchased) {
ctx.getSettings().DEPTH_CONTOURS_PURCHASED.set(true);
}
lastValidationCheckTime = System.currentTimeMillis();
logDebug("User " + (mSubscribedToLiveUpdates ? "HAS" : "DOES NOT HAVE")
+ " live updates purchased.");
@ -287,6 +314,11 @@ public class InAppHelper {
mLiveUpdatesPrice = liveUpdatesDetails.getPrice();
}
if (inventory.hasDetails(SKU_DEPTH_CONTOURS)) {
SkuDetails depthContoursDetails = inventory.getSkuDetails(SKU_DEPTH_CONTOURS);
mDepthContoursPrice = depthContoursDetails.getPrice();
}
if (inventory.hasDetails(SKU_FULL_VERSION_PRICE)) {
SkuDetails fullPriceDetails = inventory.getSkuDetails(SKU_FULL_VERSION_PRICE);
mFullVersionPrice = fullPriceDetails.getPrice();
@ -335,9 +367,9 @@ public class InAppHelper {
};
public void purchaseFullVersion(final Activity activity) {
if (mHelper == null || !mHelper.subscriptionsSupported()) {
complain("Subscriptions not supported on your device yet. Sorry!");
notifyError("Subscriptions not supported on your device yet. Sorry!");
if (mHelper == null) {
complain("In-app hepler is not initialized!");
notifyError("In-app hepler is not initialized!");
if (stopAfterResult) {
stop();
}
@ -351,6 +383,23 @@ public class InAppHelper {
}
}
public void purchaseDepthContours(final Activity activity) {
if (mHelper == null) {
complain("In-app hepler is not initialized!");
notifyError("In-app hepler is not initialized!");
if (stopAfterResult) {
stop();
}
return;
}
logDebug("Launching purchase flow for sea depth contours");
if (mHelper != null) {
mHelper.launchPurchaseFlow(activity,
SKU_DEPTH_CONTOURS, RC_REQUEST, mPurchaseFinishedListener);
}
}
public void purchaseLiveUpdates(final Activity activity, final String email, final String userName,
final String countryDownloadName, final boolean hideUserName) {
if (mHelper == null || !mHelper.subscriptionsSupported()) {
@ -504,20 +553,29 @@ public class InAppHelper {
if (purchase.getSku().equals(SKU_FULL_VERSION_PRICE)) {
// bought full version
logDebug("Full version purchased.");
sendToken(purchase.getToken(), new OnRequestResultListener() {
@Override
public void onResult(String result) {
showToast(ctx.getString(R.string.full_version_thanks));
mFullVersionPurchased = true;
ctx.getSettings().FULL_VERSION_PURCHASED.set(true);
showToast(ctx.getString(R.string.full_version_thanks));
mFullVersionPurchased = true;
ctx.getSettings().FULL_VERSION_PURCHASED.set(true);
notifyDismissProgress();
notifyItemPurchased(SKU_FULL_VERSION_PRICE);
if (stopAfterResult) {
stop();
}
}
});
notifyDismissProgress();
notifyItemPurchased(SKU_FULL_VERSION_PRICE);
if (stopAfterResult) {
stop();
}
}
if (purchase.getSku().equals(SKU_DEPTH_CONTOURS)) {
// bought sea depth contours
logDebug("Sea depth contours purchased.");
showToast(ctx.getString(R.string.sea_depth_thanks));
mDepthContoursPurchased = true;
ctx.getSettings().DEPTH_CONTOURS_PURCHASED.set(true);
ctx.getSettings().getCustomRenderBooleanProperty("depthContours").set(true);
notifyDismissProgress();
notifyItemPurchased(SKU_DEPTH_CONTOURS);
if (stopAfterResult) {
stop();
}
}
}
};

View file

@ -723,10 +723,10 @@ public class ResourceManager {
collectFiles(appPath, IndexConstants.BINARY_MAP_INDEX_EXT, files);
renameRoadsFiles(files, roadsPath);
collectFiles(roadsPath, IndexConstants.BINARY_MAP_INDEX_EXT, files);
if(!Version.isFreeVersion(context)) {
if (!Version.isFreeVersion(context) || context.getSettings().FULL_VERSION_PURCHASED.get()) {
collectFiles(context.getAppPath(IndexConstants.WIKI_INDEX_DIR), IndexConstants.BINARY_MAP_INDEX_EXT, files);
}
if(OsmandPlugin.getEnabledPlugin(SRTMPlugin.class) != null) {
if (OsmandPlugin.getEnabledPlugin(SRTMPlugin.class) != null) {
collectFiles(context.getAppPath(IndexConstants.SRTM_INDEX_DIR), IndexConstants.BINARY_MAP_INDEX_EXT, files);
}