Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2018-04-25 15:16:49 +02:00
commit 4fcf5cd34f
13 changed files with 244 additions and 26 deletions

View file

@ -6,6 +6,8 @@
<!-- Not translatable --> <!-- Not translatable -->
<string name="full_version_price">€7,99</string> <string name="full_version_price">€7,99</string>
<string name="srtm_plugin_price">€2,99</string>
<string name="sea_depth_maps_price">€1,39</string>
<string name="osm_live">OsmAnd Live</string> <string name="osm_live">OsmAnd Live</string>
<string name="ga_api_key">UA-28342846-2</string> <string name="ga_api_key">UA-28342846-2</string>
<string name="ga_dispatchPeriod">10</string> <string name="ga_dispatchPeriod">10</string>

View file

@ -831,7 +831,11 @@ public class OsmandApplication extends MultiDexApplication {
} }
serviceIntent.putExtra(NavigationService.USAGE_INTENT, intent); serviceIntent.putExtra(NavigationService.USAGE_INTENT, intent);
serviceIntent.putExtra(NavigationService.USAGE_OFF_INTERVAL, interval); serviceIntent.putExtra(NavigationService.USAGE_OFF_INTERVAL, interval);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startForegroundService(serviceIntent);
} else {
startService(serviceIntent); startService(serviceIntent);
}
//getNotificationHelper().showNotifications(); //getNotificationHelper().showNotifications();
} }

View file

@ -9,13 +9,17 @@ import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;
import net.osmand.PlatformUtil; import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.Version; import net.osmand.plus.Version;
import net.osmand.plus.inapp.InAppPurchaseHelper; import net.osmand.plus.inapp.InAppPurchaseHelper;
import net.osmand.plus.inapp.InAppPurchaseHelper.InAppPurchaseListener; import net.osmand.plus.inapp.InAppPurchaseHelper.InAppPurchaseListener;
import net.osmand.plus.inapp.InAppPurchaseHelper.InAppPurchaseTaskType; import net.osmand.plus.inapp.InAppPurchaseHelper.InAppPurchaseTaskType;
import net.osmand.plus.srtmplugin.SRTMPlugin;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@ -107,6 +111,16 @@ public class OsmandInAppPurchaseActivity extends AppCompatActivity implements In
} }
} }
public static void purchaseSrtmPlugin(@NonNull final Activity activity) {
OsmandPlugin plugin = OsmandPlugin.getPlugin(SRTMPlugin.class);
if(plugin == null || plugin.getInstallURL() == null) {
Toast.makeText(activity.getApplicationContext(),
activity.getString(R.string.activate_srtm_plugin), Toast.LENGTH_LONG).show();
} else {
activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(plugin.getInstallURL())));
}
}
public OsmandApplication getMyApplication() { public OsmandApplication getMyApplication() {
return (OsmandApplication) getApplication(); return (OsmandApplication) getApplication();
} }

View file

@ -173,8 +173,14 @@ public abstract class ChoosePlanDialogFragment extends BaseOsmAndDialogFragment
if (!TextUtils.isEmpty(getInfoDescription())) { if (!TextUtils.isEmpty(getInfoDescription())) {
infoDescription.setText(getInfoDescription()); infoDescription.setText(getInfoDescription());
} }
cardsContainer.addView(buildOsmLiveCard(ctx, cardsContainer)); ViewGroup osmLiveCard = buildOsmLiveCard(ctx, cardsContainer);
cardsContainer.addView(buildPlanTypeCard(ctx, cardsContainer)); if (osmLiveCard != null) {
cardsContainer.addView(osmLiveCard);
}
ViewGroup planTypeCard = buildPlanTypeCard(ctx, cardsContainer);
if (planTypeCard != null) {
cardsContainer.addView(planTypeCard);
}
return view; return view;
} }
@ -204,6 +210,10 @@ public abstract class ChoosePlanDialogFragment extends BaseOsmAndDialogFragment
public abstract String getPlanTypeHeaderDescription(); public abstract String getPlanTypeHeaderDescription();
public abstract String getPlanTypeButtonTitle();
public abstract String getPlanTypeButtonDescription();
public abstract void setPlanTypeButtonClickListener(View button); public abstract void setPlanTypeButtonClickListener(View button);
private View inflate(@LayoutRes int layoutId, @Nullable ViewGroup container) { private View inflate(@LayoutRes int layoutId, @Nullable ViewGroup container) {
@ -289,6 +299,9 @@ public abstract class ChoosePlanDialogFragment extends BaseOsmAndDialogFragment
} }
private ViewGroup buildPlanTypeCard(@NonNull Context ctx, ViewGroup container) { private ViewGroup buildPlanTypeCard(@NonNull Context ctx, ViewGroup container) {
if (getPlanTypeFeatures().length == 0) {
return null;
}
ViewGroup cardView = (ViewGroup) inflate(R.layout.purchase_dialog_card, container); ViewGroup cardView = (ViewGroup) inflate(R.layout.purchase_dialog_card, container);
AppCompatImageView headerImageView = (AppCompatImageView) cardView.findViewById(R.id.header_img); AppCompatImageView headerImageView = (AppCompatImageView) cardView.findViewById(R.id.header_img);
TextView headerTitleView = (TextView) cardView.findViewById(R.id.header_title); TextView headerTitleView = (TextView) cardView.findViewById(R.id.header_title);
@ -335,12 +348,8 @@ public abstract class ChoosePlanDialogFragment extends BaseOsmAndDialogFragment
ProgressBar progressBar = (ProgressBar) planTypeCardButton.findViewById(R.id.card_button_progress); ProgressBar progressBar = (ProgressBar) planTypeCardButton.findViewById(R.id.card_button_progress);
TextViewEx buttonTitle = (TextViewEx) planTypeCardButton.findViewById(R.id.card_button_title); TextViewEx buttonTitle = (TextViewEx) planTypeCardButton.findViewById(R.id.card_button_title);
TextViewEx buttonSubtitle = (TextViewEx) planTypeCardButton.findViewById(R.id.card_button_subtitle); TextViewEx buttonSubtitle = (TextViewEx) planTypeCardButton.findViewById(R.id.card_button_subtitle);
if (!purchaseHelper.hasPrices()) { buttonTitle.setText(getPlanTypeButtonTitle());
buttonTitle.setText(getString(R.string.purchase_unlim_title, getString(R.string.full_version_price))); buttonSubtitle.setText(getPlanTypeButtonDescription());
} else {
buttonTitle.setText(getString(R.string.purchase_unlim_title, purchaseHelper.getFullVersionPrice()));
}
buttonSubtitle.setText(R.string.in_app_purchase_desc);
if (progress) { if (progress) {
buttonTitle.setVisibility(View.GONE); buttonTitle.setVisibility(View.GONE);
buttonSubtitle.setVisibility(View.GONE); buttonSubtitle.setVisibility(View.GONE);
@ -434,6 +443,15 @@ public abstract class ChoosePlanDialogFragment extends BaseOsmAndDialogFragment
} }
} }
public static void showWikivoyageInstance(@NonNull FragmentManager fm) {
try {
ChoosePlanWikivoyageDialogFragment fragment = new ChoosePlanWikivoyageDialogFragment();
fragment.show(fm, ChoosePlanWikivoyageDialogFragment.TAG);
} catch (RuntimeException e) {
LOG.error("showWikivoyageInstance", e);
}
}
public static void showSeaDepthMapsInstance(@NonNull FragmentManager fm) { public static void showSeaDepthMapsInstance(@NonNull FragmentManager fm) {
try { try {
ChoosePlanSeaDepthMapsDialogFragment fragment = new ChoosePlanSeaDepthMapsDialogFragment(); ChoosePlanSeaDepthMapsDialogFragment fragment = new ChoosePlanSeaDepthMapsDialogFragment();
@ -442,4 +460,22 @@ public abstract class ChoosePlanDialogFragment extends BaseOsmAndDialogFragment
LOG.error("showSeaDepthMapsInstance", e); LOG.error("showSeaDepthMapsInstance", e);
} }
} }
public static void showHillshadeSrtmPluginInstance(@NonNull FragmentManager fm) {
try {
ChoosePlanHillshadeSrtmDialogFragment fragment = new ChoosePlanHillshadeSrtmDialogFragment();
fragment.show(fm, ChoosePlanHillshadeSrtmDialogFragment.TAG);
} catch (RuntimeException e) {
LOG.error("showHillshadeSrtmPluginInstance", e);
}
}
public static void showOsmLiveInstance(@NonNull FragmentManager fm) {
try {
ChoosePlanOsmLiveBannerDialogFragment fragment = new ChoosePlanOsmLiveBannerDialogFragment();
fragment.show(fm, ChoosePlanOsmLiveBannerDialogFragment.TAG);
} catch (RuntimeException e) {
LOG.error("showOsmLiveInstance", e);
}
}
} }

View file

@ -7,6 +7,7 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.OsmandInAppPurchaseActivity; import net.osmand.plus.activities.OsmandInAppPurchaseActivity;
import net.osmand.plus.download.DownloadValidationManager; import net.osmand.plus.download.DownloadValidationManager;
import net.osmand.plus.inapp.InAppPurchaseHelper;
public class ChoosePlanFreeBannerDialogFragment extends ChoosePlanDialogFragment { public class ChoosePlanFreeBannerDialogFragment extends ChoosePlanDialogFragment {
public static final String TAG = ChoosePlanFreeBannerDialogFragment.class.getSimpleName(); public static final String TAG = ChoosePlanFreeBannerDialogFragment.class.getSimpleName();
@ -79,6 +80,21 @@ public class ChoosePlanFreeBannerDialogFragment extends ChoosePlanDialogFragment
} }
} }
@Override
public String getPlanTypeButtonTitle() {
InAppPurchaseHelper purchaseHelper = getOsmandApplication().getInAppPurchaseHelper();
if (purchaseHelper == null || !purchaseHelper.hasPrices()) {
return getString(R.string.purchase_unlim_title, getString(R.string.full_version_price));
} else {
return getString(R.string.purchase_unlim_title, purchaseHelper.getFullVersionPrice());
}
}
@Override
public String getPlanTypeButtonDescription() {
return getString(R.string.in_app_purchase_desc);
}
@Override @Override
public void setPlanTypeButtonClickListener(View button) { public void setPlanTypeButtonClickListener(View button) {
button.setOnClickListener(new View.OnClickListener() { button.setOnClickListener(new View.OnClickListener() {

View file

@ -0,0 +1,100 @@
package net.osmand.plus.chooseplan;
import android.app.Activity;
import android.view.View;
import net.osmand.plus.R;
import net.osmand.plus.activities.OsmandInAppPurchaseActivity;
import net.osmand.plus.inapp.InAppPurchaseHelper;
public class ChoosePlanHillshadeSrtmDialogFragment extends ChoosePlanDialogFragment {
public static final String TAG = ChoosePlanHillshadeSrtmDialogFragment.class.getSimpleName();
private final OsmAndFeature[] osmLiveFeatures = {
OsmAndFeature.CONTOUR_LINES_HILLSHADE_MAPS,
OsmAndFeature.SEA_DEPTH_MAPS,
OsmAndFeature.DAILY_MAP_UPDATES,
OsmAndFeature.UNLIMITED_DOWNLOADS,
OsmAndFeature.WIKIPEDIA_OFFLINE,
OsmAndFeature.WIKIVOYAGE_OFFLINE,
OsmAndFeature.UNLOCK_ALL_FEATURES,
OsmAndFeature.DONATION_TO_OSM,
};
private final OsmAndFeature[] selectedOsmLiveFeatures = {
OsmAndFeature.CONTOUR_LINES_HILLSHADE_MAPS,
OsmAndFeature.SEA_DEPTH_MAPS,
};
private final OsmAndFeature[] planTypeFeatures = {
OsmAndFeature.CONTOUR_LINES_HILLSHADE_MAPS,
};
private final OsmAndFeature[] selectedPlanTypeFeatures = {};
@Override
public OsmAndFeature[] getOsmLiveFeatures() {
return osmLiveFeatures;
}
@Override
public OsmAndFeature[] getPlanTypeFeatures() {
return planTypeFeatures;
}
@Override
public OsmAndFeature[] getSelectedOsmLiveFeatures() {
return selectedOsmLiveFeatures;
}
@Override
public OsmAndFeature[] getSelectedPlanTypeFeatures() {
return selectedPlanTypeFeatures;
}
@Override
public String getInfoDescription() {
return "";
}
@Override
public int getPlanTypeHeaderImageId() {
return R.drawable.img_logo_38dp_contour_lines;
}
@Override
public String getPlanTypeHeaderTitle() {
return getString(R.string.srtm_plugin_name);
}
@Override
public String getPlanTypeHeaderDescription() {
return getString(R.string.paid_plugin);
}
@Override
public String getPlanTypeButtonTitle() {
InAppPurchaseHelper purchaseHelper = getOsmandApplication().getInAppPurchaseHelper();
if (purchaseHelper == null || !purchaseHelper.hasPrices()) {
return getString(R.string.purchase_unlim_title, getString(R.string.srtm_plugin_price));
} else {
return getString(R.string.purchase_unlim_title, purchaseHelper.getContourLinesPrice());
}
}
@Override
public String getPlanTypeButtonDescription() {
return getString(R.string.in_app_purchase_desc);
}
@Override
public void setPlanTypeButtonClickListener(View button) {
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Activity activity = getActivity();
if (activity != null) {
OsmandInAppPurchaseActivity.purchaseSrtmPlugin(activity);
}
}
});
}
}

View file

@ -0,0 +1,14 @@
package net.osmand.plus.chooseplan;
public class ChoosePlanOsmLiveBannerDialogFragment extends ChoosePlanFreeBannerDialogFragment {
public static final String TAG = ChoosePlanOsmLiveBannerDialogFragment.class.getSimpleName();
@Override
public OsmAndFeature[] getPlanTypeFeatures() {
return new OsmAndFeature[] {};
}
@Override
public OsmAndFeature[] getSelectedPlanTypeFeatures() {
return new OsmAndFeature[] {};
}
}

View file

@ -5,6 +5,7 @@ import android.view.View;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.OsmandInAppPurchaseActivity; import net.osmand.plus.activities.OsmandInAppPurchaseActivity;
import net.osmand.plus.inapp.InAppPurchaseHelper;
public class ChoosePlanSeaDepthMapsDialogFragment extends ChoosePlanDialogFragment { public class ChoosePlanSeaDepthMapsDialogFragment extends ChoosePlanDialogFragment {
public static final String TAG = ChoosePlanSeaDepthMapsDialogFragment.class.getSimpleName(); public static final String TAG = ChoosePlanSeaDepthMapsDialogFragment.class.getSimpleName();
@ -69,6 +70,21 @@ public class ChoosePlanSeaDepthMapsDialogFragment extends ChoosePlanDialogFragme
return getString(R.string.in_app_purchase); return getString(R.string.in_app_purchase);
} }
@Override
public String getPlanTypeButtonTitle() {
InAppPurchaseHelper purchaseHelper = getOsmandApplication().getInAppPurchaseHelper();
if (purchaseHelper == null || !purchaseHelper.hasPrices()) {
return getString(R.string.purchase_unlim_title, getString(R.string.sea_depth_maps_price));
} else {
return getString(R.string.purchase_unlim_title, purchaseHelper.getDepthContoursPrice());
}
}
@Override
public String getPlanTypeButtonDescription() {
return getString(R.string.in_app_purchase_desc);
}
@Override @Override
public void setPlanTypeButtonClickListener(View button) { public void setPlanTypeButtonClickListener(View button) {
button.setOnClickListener(new View.OnClickListener() { button.setOnClickListener(new View.OnClickListener() {

View file

@ -0,0 +1,6 @@
package net.osmand.plus.chooseplan;
public class ChoosePlanWikivoyageDialogFragment extends ChoosePlanWikipediaDialogFragment {
public static final String TAG = ChoosePlanWikivoyageDialogFragment.class.getSimpleName();
}

View file

@ -5,7 +5,6 @@ import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.support.v4.view.ViewCompat; import android.support.v4.view.ViewCompat;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
@ -21,7 +20,6 @@ import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import net.osmand.map.WorldRegion; import net.osmand.map.WorldRegion;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.LocalIndexHelper.LocalIndexType; import net.osmand.plus.activities.LocalIndexHelper.LocalIndexType;
import net.osmand.plus.activities.LocalIndexInfo; import net.osmand.plus.activities.LocalIndexInfo;
@ -34,7 +32,6 @@ import net.osmand.plus.download.DownloadResources;
import net.osmand.plus.download.IndexItem; import net.osmand.plus.download.IndexItem;
import net.osmand.plus.download.ui.LocalIndexesFragment.LocalIndexOperationTask; import net.osmand.plus.download.ui.LocalIndexesFragment.LocalIndexOperationTask;
import net.osmand.plus.helpers.FileNameTranslationHelper; import net.osmand.plus.helpers.FileNameTranslationHelper;
import net.osmand.plus.srtmplugin.SRTMPlugin;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import java.io.File; import java.io.File;
@ -346,13 +343,7 @@ public class ItemViewHolder {
context.getString(R.string.activate_seamarks_plugin), Toast.LENGTH_SHORT).show(); context.getString(R.string.activate_seamarks_plugin), Toast.LENGTH_SHORT).show();
break; break;
case ASK_FOR_SRTM_PLUGIN_PURCHASE: case ASK_FOR_SRTM_PLUGIN_PURCHASE:
OsmandPlugin plugin = OsmandPlugin.getPlugin(SRTMPlugin.class); ChoosePlanDialogFragment.showHillshadeSrtmPluginInstance(context.getSupportFragmentManager());
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; break;
case ASK_FOR_SRTM_PLUGIN_ENABLE: case ASK_FOR_SRTM_PLUGIN_ENABLE:
context.startActivity(new Intent(context, context.getMyApplication().getAppCustomization() context.startActivity(new Intent(context, context.getMyApplication().getAppCustomization()

View file

@ -2,7 +2,6 @@ package net.osmand.plus.download.ui;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.view.MenuItemCompat; import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
@ -22,11 +21,11 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.base.OsmAndListFragment; import net.osmand.plus.base.OsmAndListFragment;
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
import net.osmand.plus.download.DownloadActivity; import net.osmand.plus.download.DownloadActivity;
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents; import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
import net.osmand.plus.download.DownloadResources; import net.osmand.plus.download.DownloadResources;
import net.osmand.plus.download.IndexItem; import net.osmand.plus.download.IndexItem;
import net.osmand.plus.liveupdates.OsmLiveActivity;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import java.util.Comparator; import java.util.Comparator;
@ -166,10 +165,10 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download
@Override @Override
public void onListItemClick(ListView l, View v, int position, long id) { public void onListItemClick(ListView l, View v, int position, long id) {
if (listAdapter.isShowOsmLiveBanner() && position == 0) { if (listAdapter.isShowOsmLiveBanner() && position == 0) {
Intent intent = new Intent(getMyActivity(), OsmLiveActivity.class); DownloadActivity activity = getMyActivity();
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); if (activity != null) {
intent.putExtra(OsmLiveActivity.OPEN_SUBSCRIPTION_INTENT_PARAM, true); ChoosePlanDialogFragment.showOsmLiveInstance(activity.getSupportFragmentManager());
getMyActivity().startActivity(intent); }
} else { } else {
final IndexItem e = (IndexItem) getListAdapter().getItem(position); final IndexItem e = (IndexItem) getListAdapter().getItem(position);
ItemViewHolder vh = (ItemViewHolder) v.getTag(); ItemViewHolder vh = (ItemViewHolder) v.getTag();

View file

@ -42,6 +42,7 @@ public class InAppPurchaseHelper {
private String liveUpdatesPrice; private String liveUpdatesPrice;
private String fullVersionPrice; private String fullVersionPrice;
private String depthContoursPrice; private String depthContoursPrice;
private String contourLinesPrice;
public static final String SKU_FULL_VERSION_PRICE = "osmand_full_version_price"; public static final String SKU_FULL_VERSION_PRICE = "osmand_full_version_price";
@ -49,9 +50,12 @@ public class InAppPurchaseHelper {
private static final String SKU_LIVE_UPDATES_FREE = "osm_free_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_FULL = "net.osmand.seadepth_plus";
private static final String SKU_DEPTH_CONTOURS_FREE = "net.osmand.seadepth"; private static final String SKU_DEPTH_CONTOURS_FREE = "net.osmand.seadepth";
private static final String SKU_CONTOUR_LINES_FULL = "net.osmand.contourlines_plus";
private static final String SKU_CONTOUR_LINES_FREE = "net.osmand.contourlines";
public static String SKU_LIVE_UPDATES; public static String SKU_LIVE_UPDATES;
public static String SKU_DEPTH_CONTOURS; public static String SKU_DEPTH_CONTOURS;
public static String SKU_CONTOUR_LINES;
private static final long PURCHASE_VALIDATION_PERIOD_MSEC = 1000 * 60 * 60 * 24; // daily private static final long PURCHASE_VALIDATION_PERIOD_MSEC = 1000 * 60 * 60 * 24; // daily
// (arbitrary) request code for the purchase flow // (arbitrary) request code for the purchase flow
@ -133,6 +137,10 @@ public class InAppPurchaseHelper {
return depthContoursPrice; return depthContoursPrice;
} }
public String getContourLinesPrice() {
return contourLinesPrice;
}
public String getSkuLiveUpdates() { public String getSkuLiveUpdates() {
return SKU_LIVE_UPDATES; return SKU_LIVE_UPDATES;
} }
@ -157,6 +165,13 @@ public class InAppPurchaseHelper {
SKU_DEPTH_CONTOURS = SKU_DEPTH_CONTOURS_FULL; SKU_DEPTH_CONTOURS = SKU_DEPTH_CONTOURS_FULL;
} }
} }
if (SKU_CONTOUR_LINES == null) {
if (Version.isFreeVersion(ctx)) {
SKU_CONTOUR_LINES = SKU_CONTOUR_LINES_FREE;
} else {
SKU_CONTOUR_LINES = SKU_CONTOUR_LINES_FULL;
}
}
} }
public InAppPurchaseHelper(OsmandApplication ctx) { public InAppPurchaseHelper(OsmandApplication ctx) {
@ -250,6 +265,7 @@ public class InAppPurchaseHelper {
List<String> skus = new ArrayList<>(); List<String> skus = new ArrayList<>();
skus.add(SKU_LIVE_UPDATES); skus.add(SKU_LIVE_UPDATES);
skus.add(SKU_DEPTH_CONTOURS); skus.add(SKU_DEPTH_CONTOURS);
skus.add(SKU_CONTOUR_LINES);
skus.add(SKU_FULL_VERSION_PRICE); skus.add(SKU_FULL_VERSION_PRICE);
try { try {
mHelper.queryInventoryAsync(true, skus, mGotInventoryListener); mHelper.queryInventoryAsync(true, skus, mGotInventoryListener);
@ -370,6 +386,10 @@ public class InAppPurchaseHelper {
SkuDetails depthContoursDetails = inventory.getSkuDetails(SKU_DEPTH_CONTOURS); SkuDetails depthContoursDetails = inventory.getSkuDetails(SKU_DEPTH_CONTOURS);
depthContoursPrice = depthContoursDetails.getPrice(); depthContoursPrice = depthContoursDetails.getPrice();
} }
if (inventory.hasDetails(SKU_CONTOUR_LINES)) {
SkuDetails contourLinesDetails = inventory.getSkuDetails(SKU_CONTOUR_LINES);
contourLinesPrice = contourLinesDetails.getPrice();
}
OsmandSettings settings = ctx.getSettings(); OsmandSettings settings = ctx.getSettings();
settings.INAPPS_READ.set(true); settings.INAPPS_READ.set(true);

View file

@ -33,7 +33,7 @@ public class OpenBetaTravelCard extends BaseTravelCard {
holder.button.setOnClickListener(new View.OnClickListener() { holder.button.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
ChoosePlanDialogFragment.showFreeVersionInstance(fragmentManager); ChoosePlanDialogFragment.showWikivoyageInstance(fragmentManager);
} }
}); });
} }