Merge branch 'master' of github.com:osmandapp/Osmand

This commit is contained in:
Victor Shcherb 2018-05-16 19:18:33 +02:00
commit 1c2893bdc2
2 changed files with 3 additions and 8 deletions

View file

@ -361,19 +361,18 @@ public class InAppPurchaseHelper {
Purchase liveUpdatesPurchase = inventory.getPurchase(SKU_LIVE_UPDATES); Purchase liveUpdatesPurchase = inventory.getPurchase(SKU_LIVE_UPDATES);
boolean subscribedToLiveUpdates = (liveUpdatesPurchase != null && liveUpdatesPurchase.getPurchaseState() == 0); boolean subscribedToLiveUpdates = (liveUpdatesPurchase != null && liveUpdatesPurchase.getPurchaseState() == 0);
OsmandPreference<Long> subscriptionCancelledTime = ctx.getSettings().LIVE_UPDATES_PURCHASE_CANCELLED_TIME; OsmandPreference<Long> subscriptionCancelledTime = ctx.getSettings().LIVE_UPDATES_PURCHASE_CANCELLED_TIME;
if (!subscribedToLiveUpdates) { if (!subscribedToLiveUpdates && ctx.getSettings().LIVE_UPDATES_PURCHASED.get()) {
if (subscriptionCancelledTime.get() == 0) { if (subscriptionCancelledTime.get() == 0) {
subscriptionCancelledTime.set(System.currentTimeMillis()); subscriptionCancelledTime.set(System.currentTimeMillis());
ctx.getSettings().LIVE_UPDATES_PURCHASE_CANCELLED_FIRST_DLG_SHOWN.set(false); ctx.getSettings().LIVE_UPDATES_PURCHASE_CANCELLED_FIRST_DLG_SHOWN.set(false);
ctx.getSettings().LIVE_UPDATES_PURCHASE_CANCELLED_SECOND_DLG_SHOWN.set(false); ctx.getSettings().LIVE_UPDATES_PURCHASE_CANCELLED_SECOND_DLG_SHOWN.set(false);
} else if (System.currentTimeMillis() - subscriptionCancelledTime.get() > SUBSCRIPTION_HOLDING_TIME_MSEC } else if (System.currentTimeMillis() - subscriptionCancelledTime.get() > SUBSCRIPTION_HOLDING_TIME_MSEC) {
&& ctx.getSettings().LIVE_UPDATES_PURCHASED.get()) {
ctx.getSettings().LIVE_UPDATES_PURCHASED.set(false); ctx.getSettings().LIVE_UPDATES_PURCHASED.set(false);
if (!isDepthContoursPurchased(ctx)) { if (!isDepthContoursPurchased(ctx)) {
ctx.getSettings().getCustomRenderBooleanProperty("depthContours").set(false); ctx.getSettings().getCustomRenderBooleanProperty("depthContours").set(false);
} }
} }
} else { } else if (subscribedToLiveUpdates) {
subscriptionCancelledTime.set(0L); subscriptionCancelledTime.set(0L);
ctx.getSettings().LIVE_UPDATES_PURCHASED.set(true); ctx.getSettings().LIVE_UPDATES_PURCHASED.set(true);
} }

View file

@ -260,10 +260,6 @@ public class RouteInfoWidgetsFactory {
public TextInfoWidget createTimeControl(final MapActivity map, final boolean intermediate){ public TextInfoWidget createTimeControl(final MapActivity map, final boolean intermediate){
final RoutingHelper routingHelper = map.getRoutingHelper(); final RoutingHelper routingHelper = map.getRoutingHelper();
final int time = R.drawable.widget_time_day;
final int timeN = R.drawable.widget_time_night;
final int timeToGo = R.drawable.widget_time_to_distance_day;
final int timeToGoN = R.drawable.widget_time_to_distance_night;
final OsmandApplication ctx = map.getMyApplication(); final OsmandApplication ctx = map.getMyApplication();
final OsmandPreference<Boolean> showArrival = intermediate final OsmandPreference<Boolean> showArrival = intermediate
? ctx.getSettings().SHOW_INTERMEDIATE_ARRIVAL_TIME_OTHERWISE_EXPECTED_TIME ? ctx.getSettings().SHOW_INTERMEDIATE_ARRIVAL_TIME_OTHERWISE_EXPECTED_TIME