Done 405. Fix Live subscription Inapp (added token). Few other fixes
This commit is contained in:
parent
919d700cbe
commit
b14853a09e
19 changed files with 636 additions and 60 deletions
121
OsmAnd/res/layout-land/dest_reached_menu_fragment.xml
Normal file
121
OsmAnd/res/layout-land/dest_reached_menu_fragment.xml
Normal file
|
@ -0,0 +1,121 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout android:id="@+id/share_fragment_layout"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="true"
|
||||
android:background="@android:color/transparent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/main_view"
|
||||
android:layout_width="350dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="?attr/left_menu_view_bg"
|
||||
android:clickable="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/titleIconImageView"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/list_destination"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/titleTextView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginTop="16dp"
|
||||
android:paddingRight="8dp"
|
||||
android:text="@string/arrived_at_destination"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/dialog_header_text_size"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/closeImageButton"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_gravity="top"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:src="@drawable/ic_action_remove_dark"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/removeDestButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:drawableLeft="@drawable/ic_action_delete_dark"
|
||||
android:drawablePadding="12dp"
|
||||
android:gravity="left|center_vertical"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:text="@string/delete_target_point"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/findParkingButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:drawableLeft="@drawable/ic_action_parking_dark"
|
||||
android:drawablePadding="12dp"
|
||||
android:gravity="left|center_vertical"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:text="@string/find_parking"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
121
OsmAnd/res/layout/dest_reached_menu_fragment.xml
Normal file
121
OsmAnd/res/layout/dest_reached_menu_fragment.xml
Normal file
|
@ -0,0 +1,121 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout android:id="@+id/share_fragment_layout"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="true"
|
||||
android:background="@android:color/transparent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/main_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="?attr/bottom_menu_view_bg"
|
||||
android:clickable="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/titleIconImageView"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/list_destination"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/titleTextView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginTop="16dp"
|
||||
android:paddingRight="8dp"
|
||||
android:text="@string/arrived_at_destination"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/dialog_header_text_size"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/closeImageButton"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_gravity="top"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:src="@drawable/ic_action_remove_dark"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/removeDestButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:drawableLeft="@drawable/ic_action_delete_dark"
|
||||
android:drawablePadding="12dp"
|
||||
android:gravity="left|center_vertical"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:text="@string/delete_target_point"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/findParkingButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:drawableLeft="@drawable/ic_action_parking_dark"
|
||||
android:drawablePadding="12dp"
|
||||
android:gravity="left|center_vertical"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:text="@string/find_parking"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
|
@ -9,6 +9,7 @@
|
|||
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="find_parking">Find a parking</string>
|
||||
<string name="shared_string_status">Status</string>
|
||||
<string name="shared_string_save_changes">Save changes</string>
|
||||
<string name="shared_string_email_address">E-mail address</string>
|
||||
|
|
|
@ -35,6 +35,7 @@ import android.widget.Toast;
|
|||
import net.osmand.Location;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.StateChangedListener;
|
||||
import net.osmand.ValueHolder;
|
||||
import net.osmand.access.AccessibilityPlugin;
|
||||
import net.osmand.access.AccessibleActivity;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
|
@ -72,9 +73,11 @@ import net.osmand.plus.helpers.GpxImportHelper;
|
|||
import net.osmand.plus.helpers.WakeLockHelper;
|
||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||
import net.osmand.plus.mapcontextmenu.MapContextMenuFragment;
|
||||
import net.osmand.plus.mapcontextmenu.other.DestinationReachedMenu;
|
||||
import net.osmand.plus.render.RendererRegistry;
|
||||
import net.osmand.plus.resources.ResourceManager;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.routing.RoutingHelper.IRouteInformationListener;
|
||||
import net.osmand.plus.routing.RoutingHelper.RouteCalculationProgressCallback;
|
||||
import net.osmand.plus.views.AnimateDraggingMapThread;
|
||||
import net.osmand.plus.views.MapControlsLayer;
|
||||
|
@ -98,7 +101,7 @@ import java.util.regex.Matcher;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
public class MapActivity extends AccessibleActivity implements DownloadEvents,
|
||||
ActivityCompat.OnRequestPermissionsResultCallback {
|
||||
ActivityCompat.OnRequestPermissionsResultCallback, IRouteInformationListener {
|
||||
private static final int SHOW_POSITION_MSG_ID = OsmAndConstants.UI_HANDLER_MAP_VIEW + 1;
|
||||
private static final int LONG_KEYPRESS_MSG_ID = OsmAndConstants.UI_HANDLER_MAP_VIEW + 2;
|
||||
private static final int LONG_KEYPRESS_DELAY = 500;
|
||||
|
@ -525,6 +528,13 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents,
|
|||
|
||||
app.getDownloadThread().setUiActivity(this);
|
||||
|
||||
if (mapViewTrackingUtilities.getShowRouteFinishDialog()) {
|
||||
DestinationReachedMenu.show(this);
|
||||
mapViewTrackingUtilities.setShowRouteFinishDialog(false);
|
||||
}
|
||||
|
||||
routingHelper.addListener(this);
|
||||
|
||||
getMyApplication().getAppCustomization().resumeActivity(MapActivity.class, this);
|
||||
if (System.currentTimeMillis() - tm > 50) {
|
||||
System.err.println("OnCreate for MapActivity took " + (System.currentTimeMillis() - tm) + " ms");
|
||||
|
@ -757,6 +767,7 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents,
|
|||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
app.getRoutingHelper().removeListener(this);
|
||||
app.getDownloadThread().resetUiActivity(this);
|
||||
if (atlasMapRendererView != null) {
|
||||
atlasMapRendererView.handleOnPause();
|
||||
|
@ -1112,4 +1123,17 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents,
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void newRouteIsCalculated(boolean newRoute, ValueHolder<Boolean> showToast) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void routeWasCancelled() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void routeWasFinished() {
|
||||
DestinationReachedMenu.show(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,8 +17,10 @@ import net.osmand.plus.OsmandSettings;
|
|||
import net.osmand.plus.OsmandSettings.AutoZoomMap;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dashboard.DashboardOnMap;
|
||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||
import net.osmand.plus.mapcontextmenu.other.DestinationReachedMenu;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.routing.RoutingHelper.IRouteInformationListener;
|
||||
import net.osmand.plus.views.AnimateDraggingMapThread;
|
||||
|
@ -43,6 +45,7 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
|
|||
private boolean showViewAngle = false;
|
||||
private boolean isUserZoomed = false;
|
||||
private String locationProvider;
|
||||
private boolean showRouteFinishDialog = false;
|
||||
|
||||
public MapViewTrackingUtilities(OsmandApplication app){
|
||||
this.app = app;
|
||||
|
@ -363,6 +366,19 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
|
|||
public void routeWasCancelled() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void routeWasFinished() {
|
||||
showRouteFinishDialog = (mapView == null);
|
||||
}
|
||||
|
||||
public boolean getShowRouteFinishDialog() {
|
||||
return showRouteFinishDialog;
|
||||
}
|
||||
|
||||
public void setShowRouteFinishDialog(boolean showRouteFinishDialog) {
|
||||
this.showRouteFinishDialog = showRouteFinishDialog;
|
||||
}
|
||||
|
||||
public void setZoomTime(long time) {
|
||||
lastTimeAutoZooming = time;
|
||||
isUserZoomed = true;
|
||||
|
|
|
@ -1233,6 +1233,10 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
public void routeWasCancelled() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void routeWasFinished() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowVisibilityChanged(int visibility) {
|
||||
if (visibility != View.VISIBLE && swipeDismissListener != null) {
|
||||
|
|
|
@ -349,7 +349,8 @@ public class DownloadActivity extends AbstractDownloadActivity implements Downlo
|
|||
laterButton = freeVersionBanner.findViewById(R.id.laterButton);
|
||||
freeVersionBannerTitle = freeVersionBanner.findViewById(R.id.freeVersionBannerTitle);
|
||||
|
||||
shouldShowFreeVersionBanner = Version.isFreeVersion(application)
|
||||
shouldShowFreeVersionBanner =
|
||||
(Version.isFreeVersion(application) && !application.getSettings().LIVE_UPDATES_PURCHASED.get())
|
||||
|| application.getSettings().SHOULD_SHOW_FREE_VERSION_BANNER.get();
|
||||
|
||||
initFreeVersionBanner();
|
||||
|
|
|
@ -519,7 +519,7 @@ public class DownloadIndexesThread {
|
|||
}
|
||||
|
||||
private boolean validateNotExceedsFreeLimit(IndexItem item) {
|
||||
boolean exceed = Version.isFreeVersion(app) &&
|
||||
boolean exceed = Version.isFreeVersion(app) && !app.getSettings().LIVE_UPDATES_PURCHASED.get() &&
|
||||
DownloadActivityType.isCountedInDownloads(item) && downloads.get() >= DownloadValidationManager.MAXIMUM_AVAILABLE_FREE_DOWNLOADS;
|
||||
if(exceed) {
|
||||
String breakDownloadMessage = app.getString(R.string.free_version_message,
|
||||
|
|
|
@ -89,7 +89,7 @@ public class DownloadValidationManager {
|
|||
}
|
||||
|
||||
protected void downloadFilesCheck_1_FreeVersion(FragmentActivity context, IndexItem[] items) {
|
||||
if (Version.isFreeVersion(getMyApplication())) {
|
||||
if (Version.isFreeVersion(getMyApplication()) && !app.getSettings().LIVE_UPDATES_PURCHASED.get()) {
|
||||
int total = settings.NUMBER_OF_FREE_DOWNLOADS.get();
|
||||
if (total > MAXIMUM_AVAILABLE_FREE_DOWNLOADS) {
|
||||
if (context instanceof FragmentActivity) {
|
||||
|
|
|
@ -8,13 +8,18 @@ import android.util.Log;
|
|||
import net.osmand.AndroidNetworkUtils;
|
||||
import net.osmand.AndroidNetworkUtils.OnRequestResultListener;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.inapp.util.IabHelper;
|
||||
import net.osmand.plus.inapp.util.IabHelper.OnIabPurchaseFinishedListener;
|
||||
import net.osmand.plus.inapp.util.IabHelper.QueryInventoryFinishedListener;
|
||||
import net.osmand.plus.inapp.util.IabResult;
|
||||
import net.osmand.plus.inapp.util.Inventory;
|
||||
import net.osmand.plus.inapp.util.Purchase;
|
||||
import net.osmand.plus.inapp.util.SkuDetails;
|
||||
import net.osmand.plus.liveupdates.CountrySelectionFragment;
|
||||
import net.osmand.plus.liveupdates.CountrySelectionFragment.CountryItem;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import org.json.JSONException;
|
||||
|
@ -45,6 +50,8 @@ public class InAppHelper {
|
|||
// The helper object
|
||||
private IabHelper mHelper;
|
||||
private boolean stopAfterResult = false;
|
||||
private boolean isDeveloperVersion = false;
|
||||
private String token = "";
|
||||
|
||||
private OsmandApplication ctx;
|
||||
private List<InAppListener> listeners = new ArrayList<>();
|
||||
|
@ -61,6 +68,10 @@ public class InAppHelper {
|
|||
void dismissProgress();
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public static boolean isSubscribedToLiveUpdates() {
|
||||
return mSubscribedToLiveUpdates;
|
||||
}
|
||||
|
@ -82,7 +93,8 @@ public class InAppHelper {
|
|||
SKU_LIVE_UPDATES = SKU_LIVE_UPDATES_FULL;
|
||||
}
|
||||
}
|
||||
if (Version.isDeveloperVersion(ctx)) {
|
||||
isDeveloperVersion = Version.isDeveloperVersion(ctx);
|
||||
if (isDeveloperVersion) {
|
||||
mSubscribedToLiveUpdates = true;
|
||||
ctx.getSettings().LIVE_UPDATES_PURCHASED.set(true);
|
||||
}
|
||||
|
@ -136,21 +148,27 @@ public class InAppHelper {
|
|||
if (mHelper == null) return;
|
||||
|
||||
// IAB is fully set up. Now, let's get an inventory of stuff we own if needed.
|
||||
if (!mSubscribedToLiveUpdates
|
||||
if (!isDeveloperVersion &&
|
||||
(!mSubscribedToLiveUpdates
|
||||
|| !ctx.getSettings().BILLING_PURCHASE_TOKEN_SENT.get()
|
||||
|| System.currentTimeMillis() - lastValidationCheckTime > PURCHASE_VALIDATION_PERIOD_MSEC) {
|
||||
|| System.currentTimeMillis() - lastValidationCheckTime > PURCHASE_VALIDATION_PERIOD_MSEC)) {
|
||||
|
||||
logDebug("Setup successful. Querying inventory.");
|
||||
List<String> skus = new ArrayList<>();
|
||||
skus.add(SKU_LIVE_UPDATES);
|
||||
mHelper.queryInventoryAsync(true, skus, mGotInventoryListener);
|
||||
} else {
|
||||
notifyDismissProgress();
|
||||
if (stopAfterResult) {
|
||||
stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Listener that's called when we finish querying the items and subscriptions we own
|
||||
private IabHelper.QueryInventoryFinishedListener mGotInventoryListener = new IabHelper.QueryInventoryFinishedListener() {
|
||||
private QueryInventoryFinishedListener mGotInventoryListener = new QueryInventoryFinishedListener() {
|
||||
public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
|
||||
logDebug("Query inventory finished.");
|
||||
|
||||
|
@ -177,7 +195,7 @@ public class InAppHelper {
|
|||
|
||||
// Do we have the live updates?
|
||||
Purchase liveUpdatesPurchase = inventory.getPurchase(SKU_LIVE_UPDATES);
|
||||
mSubscribedToLiveUpdates = (liveUpdatesPurchase != null) || Version.isDeveloperVersion(ctx);
|
||||
mSubscribedToLiveUpdates = (liveUpdatesPurchase != null && liveUpdatesPurchase.getPurchaseState() == 0);
|
||||
if (mSubscribedToLiveUpdates) {
|
||||
ctx.getSettings().LIVE_UPDATES_PURCHASED.set(true);
|
||||
}
|
||||
|
@ -190,20 +208,47 @@ public class InAppHelper {
|
|||
mLiveUpdatesPrice = liveUpdatesDetails.getPrice();
|
||||
}
|
||||
|
||||
if (liveUpdatesPurchase != null && !ctx.getSettings().BILLING_PURCHASE_TOKEN_SENT.get()) {
|
||||
sendToken(liveUpdatesPurchase.getToken());
|
||||
boolean needSendToken = false;
|
||||
if (liveUpdatesPurchase != null) {
|
||||
OsmandSettings settings = ctx.getSettings();
|
||||
if (Algorithms.isEmpty(settings.BILLING_USER_ID.get())
|
||||
&& !Algorithms.isEmpty(liveUpdatesPurchase.getDeveloperPayload())) {
|
||||
String payload = liveUpdatesPurchase.getDeveloperPayload();
|
||||
if (!Algorithms.isEmpty(payload)) {
|
||||
String[] arr = payload.split(" ");
|
||||
if (arr.length > 0) {
|
||||
settings.BILLING_USER_ID.set(arr[0]);
|
||||
}
|
||||
if (arr.length > 1) {
|
||||
token = arr[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!settings.BILLING_PURCHASE_TOKEN_SENT.get()) {
|
||||
needSendToken = true;
|
||||
}
|
||||
}
|
||||
|
||||
final OnRequestResultListener listener = new OnRequestResultListener() {
|
||||
@Override
|
||||
public void onResult(String result) {
|
||||
notifyDismissProgress();
|
||||
notifyGetItems();
|
||||
if (stopAfterResult) {
|
||||
stop();
|
||||
}
|
||||
|
||||
logDebug("Initial inapp query finished");
|
||||
}
|
||||
};
|
||||
|
||||
if (needSendToken) {
|
||||
sendToken(liveUpdatesPurchase.getToken(), listener);
|
||||
} else {
|
||||
listener.onResult("OK");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public void purchaseLiveUpdates(final Activity activity, final String email, final String userName,
|
||||
final String countryDownloadName, final boolean hideUserName) {
|
||||
if (!mHelper.subscriptionsSupported()) {
|
||||
|
@ -259,6 +304,7 @@ public class InAppHelper {
|
|||
try {
|
||||
JSONObject obj = new JSONObject(response);
|
||||
userId = obj.getString("userid");
|
||||
token = obj.getString("token");
|
||||
ctx.getSettings().BILLING_USER_ID.set(userId);
|
||||
logDebug("UserId=" + userId);
|
||||
} catch (JSONException e) {
|
||||
|
@ -276,7 +322,7 @@ public class InAppHelper {
|
|||
notifyDismissProgress();
|
||||
if (!Algorithms.isEmpty(userId)) {
|
||||
logDebug("Launching purchase flow for live updates subscription for userId=" + userId);
|
||||
String payload = userId;
|
||||
String payload = userId + " " + token;
|
||||
if (mHelper != null) {
|
||||
mHelper.launchPurchaseFlow(activity,
|
||||
SKU_LIVE_UPDATES, IabHelper.ITEM_TYPE_SUBS,
|
||||
|
@ -315,7 +361,7 @@ public class InAppHelper {
|
|||
}
|
||||
|
||||
// Callback for when a purchase is finished
|
||||
private IabHelper.OnIabPurchaseFinishedListener mPurchaseFinishedListener = new IabHelper.OnIabPurchaseFinishedListener() {
|
||||
private OnIabPurchaseFinishedListener mPurchaseFinishedListener = new OnIabPurchaseFinishedListener() {
|
||||
public void onIabPurchaseFinished(IabResult result, Purchase purchase) {
|
||||
logDebug("Purchase finished: " + result + ", purchase: " + purchase);
|
||||
|
||||
|
@ -336,9 +382,10 @@ public class InAppHelper {
|
|||
|
||||
if (purchase.getSku().equals(SKU_LIVE_UPDATES)) {
|
||||
// bought live updates
|
||||
sendToken(purchase.getToken());
|
||||
|
||||
logDebug("Live updates subscription purchased.");
|
||||
sendToken(purchase.getToken(), new OnRequestResultListener() {
|
||||
@Override
|
||||
public void onResult(String result) {
|
||||
showToast(ctx.getString(R.string.osm_live_thanks));
|
||||
mSubscribedToLiveUpdates = true;
|
||||
ctx.getSettings().LIVE_UPDATES_PURCHASED.set(true);
|
||||
|
@ -349,6 +396,8 @@ public class InAppHelper {
|
|||
stop();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -361,15 +410,16 @@ public class InAppHelper {
|
|||
}
|
||||
}
|
||||
|
||||
private void sendToken(String token) {
|
||||
private void sendToken(String purchaseToken, final OnRequestResultListener listener) {
|
||||
String userId = ctx.getSettings().BILLING_USER_ID.get();
|
||||
String email = ctx.getSettings().BILLING_USER_EMAIL.get();
|
||||
try {
|
||||
Map<String, String> parameters = new HashMap<>();
|
||||
parameters.put("userid", userId);
|
||||
parameters.put("sku", SKU_LIVE_UPDATES);
|
||||
parameters.put("purchaseToken", token);
|
||||
parameters.put("purchaseToken", purchaseToken);
|
||||
parameters.put("email", email);
|
||||
parameters.put("token", token);
|
||||
|
||||
AndroidNetworkUtils.sendRequestAsync(ctx,
|
||||
"http://download.osmand.net/subscription/purchased.php",
|
||||
|
@ -381,18 +431,50 @@ public class InAppHelper {
|
|||
JSONObject obj = new JSONObject(result);
|
||||
if (!obj.has("error")) {
|
||||
ctx.getSettings().BILLING_PURCHASE_TOKEN_SENT.set(true);
|
||||
if (obj.has("visibleName") && !Algorithms.isEmpty(obj.getString("visibleName"))) {
|
||||
ctx.getSettings().BILLING_USER_NAME.set(obj.getString("visibleName"));
|
||||
ctx.getSettings().BILLING_HIDE_USER_NAME.set(false);
|
||||
} else {
|
||||
ctx.getSettings().BILLING_HIDE_USER_NAME.set(true);
|
||||
}
|
||||
if (obj.has("preferredCountry")) {
|
||||
String prefferedCountry = obj.getString("preferredCountry");
|
||||
if (!ctx.getSettings().BILLING_USER_COUNTRY_DOWNLOAD_NAME.get().equals(prefferedCountry)) {
|
||||
ctx.getSettings().BILLING_USER_COUNTRY_DOWNLOAD_NAME.set(prefferedCountry);
|
||||
CountrySelectionFragment countrySelectionFragment = new CountrySelectionFragment();
|
||||
countrySelectionFragment.initCountries(ctx);
|
||||
CountryItem countryItem;
|
||||
if (Algorithms.isEmpty(prefferedCountry)) {
|
||||
countryItem = countrySelectionFragment.getCountryItems().get(0);
|
||||
} else {
|
||||
countryItem = countrySelectionFragment.getCountryItem(prefferedCountry);
|
||||
}
|
||||
if (countryItem != null) {
|
||||
ctx.getSettings().BILLING_USER_COUNTRY.set(countryItem.getLocalName());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (obj.has("email")) {
|
||||
ctx.getSettings().BILLING_USER_EMAIL.set(obj.getString("email"));
|
||||
}
|
||||
} else {
|
||||
complain("SendToken Error: " + obj.getString("error"));
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
logError("sendToken", e);
|
||||
logError("SendToken", e);
|
||||
complain("SendToken Error: " + (e.getMessage() != null ? e.getMessage() : "JSONException"));
|
||||
}
|
||||
}
|
||||
if (listener != null) {
|
||||
listener.onResult("OK");
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
logError("sendToken Error", e);
|
||||
logError("SendToken Error", e);
|
||||
if (listener != null) {
|
||||
listener.onResult("Error");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -119,11 +119,15 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList
|
|||
listView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
|
||||
@Override
|
||||
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
|
||||
if (!processing && InAppHelper.isSubscribedToLiveUpdates()) {
|
||||
final FragmentManager fragmentManager = getChildFragmentManager();
|
||||
LiveUpdatesSettingsDialogFragment
|
||||
.createInstance(adapter.getChild(groupPosition, childPosition))
|
||||
.show(fragmentManager, "settings");
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -236,7 +240,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList
|
|||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == SUBSCRIPTION_SETTINGS) {
|
||||
if (item.getItemId() == SUBSCRIPTION_SETTINGS && !processing) {
|
||||
SubscriptionFragment subscriptionFragment = new SubscriptionFragment();
|
||||
subscriptionFragment.setEditMode(true);
|
||||
subscriptionFragment.show(getChildFragmentManager(), SubscriptionFragment.TAG);
|
||||
|
@ -518,6 +522,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList
|
|||
lastCheck != DEFAULT_LAST_CHECK ? lastCheck : timestamp);
|
||||
descriptionTextView.setText(context.getString(R.string.last_update, lastCheckString));
|
||||
|
||||
if (!fragment.isProcessing() && InAppHelper.isSubscribedToLiveUpdates()) {
|
||||
final View.OnClickListener clickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -525,8 +530,11 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList
|
|||
LiveUpdatesSettingsDialogFragment.createInstance(item).show(fragmentManager, "settings");
|
||||
}
|
||||
};
|
||||
options.setEnabled(!fragment.isProcessing());
|
||||
options.setOnClickListener(clickListener);
|
||||
options.setEnabled(true);
|
||||
} else {
|
||||
options.setEnabled(false);
|
||||
}
|
||||
|
||||
if (isLastChild) {
|
||||
divider.setVisibility(View.GONE);
|
||||
|
@ -591,7 +599,6 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList
|
|||
progressBar.setVisibility(View.VISIBLE);
|
||||
updateSubscriptionHeader();
|
||||
adapter.notifyDataSetChanged();
|
||||
listView.setEnabled(false);
|
||||
}
|
||||
|
||||
private void disableProgress() {
|
||||
|
@ -599,7 +606,6 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList
|
|||
progressBar.setVisibility(View.INVISIBLE);
|
||||
updateSubscriptionHeader();
|
||||
adapter.notifyDataSetChanged();
|
||||
listView.setEnabled(true);
|
||||
}
|
||||
|
||||
public static float dpToPx(final Context context, final float dp) {
|
||||
|
|
|
@ -200,6 +200,7 @@ public class SubscriptionFragment extends BaseOsmAndDialogFragment implements In
|
|||
parameters.put("email", settings.BILLING_USER_EMAIL.get());
|
||||
parameters.put("cemail", prevEmail);
|
||||
parameters.put("userid", settings.BILLING_USER_ID.get());
|
||||
parameters.put("token", getInAppHelper().getToken());
|
||||
|
||||
showProgress();
|
||||
|
||||
|
|
|
@ -730,17 +730,25 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
|||
if (!menu.isLandscapeLayout()) {
|
||||
TextView line1 = (TextView) view.findViewById(R.id.context_menu_line1);
|
||||
TextView line2 = (TextView) view.findViewById(R.id.context_menu_line2);
|
||||
int line2LineCount = 0;
|
||||
int line2LineHeight = 0;
|
||||
int line2MeasuredHeight = 0;
|
||||
if (line2 != null) {
|
||||
line2LineCount = line2.getLineCount();
|
||||
line2LineHeight = line2.getLineHeight();
|
||||
line2MeasuredHeight = line2.getMeasuredHeight();
|
||||
}
|
||||
if (menuTopViewHeight != 0) {
|
||||
int titleHeight = line1.getLineCount() * line1.getLineHeight() + line2.getLineCount() * line2.getLineHeight() + menuTitleTopBottomPadding;
|
||||
if (titleHeight < line1.getMeasuredHeight() + line2.getMeasuredHeight()) {
|
||||
titleHeight = line1.getMeasuredHeight() + line2.getMeasuredHeight();
|
||||
int titleHeight = line1.getLineCount() * line1.getLineHeight() + line2LineCount * line2LineHeight + menuTitleTopBottomPadding;
|
||||
if (titleHeight < line1.getMeasuredHeight() + line2MeasuredHeight) {
|
||||
titleHeight = line1.getMeasuredHeight() + line2MeasuredHeight;
|
||||
}
|
||||
newMenuTopViewHeight = menuTopViewHeightExcludingTitle + titleHeight;
|
||||
dy = Math.max(0, newMenuTopViewHeight - menuTopViewHeight - (newMenuTopShadowAllHeight - menuTopShadowAllHeight));
|
||||
} else {
|
||||
menuTopViewHeightExcludingTitle = newMenuTopViewHeight - line1.getMeasuredHeight() - line2.getMeasuredHeight();
|
||||
menuTopViewHeightExcludingTitle = newMenuTopViewHeight - line1.getMeasuredHeight() - line2MeasuredHeight;
|
||||
menuTitleTopBottomPadding = (line1.getMeasuredHeight() - line1.getLineCount() * line1.getLineHeight())
|
||||
+ (line2.getMeasuredHeight() - line2.getLineCount() * line2.getLineHeight());
|
||||
+ (line2MeasuredHeight - line2LineCount * line2LineHeight);
|
||||
}
|
||||
}
|
||||
menuTopViewHeight = newMenuTopViewHeight;
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package net.osmand.plus.mapcontextmenu.other;
|
||||
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.mapcontextmenu.BaseMenuController;
|
||||
|
||||
public class DestinationReachedMenu extends BaseMenuController {
|
||||
|
||||
public DestinationReachedMenu(MapActivity mapActivity) {
|
||||
super(mapActivity);
|
||||
}
|
||||
|
||||
public static void show(MapActivity mapActivity) {
|
||||
DestinationReachedMenu menu = new DestinationReachedMenu(mapActivity);
|
||||
DestinationReachedMenuFragment.showInstance(menu);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,145 @@
|
|||
package net.osmand.plus.mapcontextmenu.other;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageButton;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.search.SearchActivity;
|
||||
import net.osmand.plus.activities.search.SearchPOIActivity;
|
||||
import net.osmand.plus.poi.PoiFiltersHelper;
|
||||
import net.osmand.plus.poi.PoiUIFilter;
|
||||
|
||||
public class DestinationReachedMenuFragment extends Fragment {
|
||||
public static final String TAG = "DestinationReachedMenuFragment";
|
||||
private DestinationReachedMenu menu;
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (menu == null) {
|
||||
menu = new DestinationReachedMenu(getMapActivity());
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.dest_reached_menu_fragment, container, false);
|
||||
view.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismissMenu();
|
||||
}
|
||||
});
|
||||
|
||||
IconsCache iconsCache = getMapActivity().getMyApplication().getIconsCache();
|
||||
|
||||
ImageButton closeImageButton = (ImageButton) view.findViewById(R.id.closeImageButton);
|
||||
closeImageButton.setImageDrawable(iconsCache.getContentIcon(R.drawable.ic_action_remove_dark));
|
||||
closeImageButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismissMenu();
|
||||
}
|
||||
});
|
||||
|
||||
Button removeDestButton = (Button) view.findViewById(R.id.removeDestButton);
|
||||
removeDestButton.setCompoundDrawablesWithIntrinsicBounds(
|
||||
iconsCache.getContentIcon(R.drawable.ic_action_delete_dark), null, null, null);
|
||||
removeDestButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
getMapActivity().getMyApplication().getTargetPointsHelper().removeWayPoint(true, -1);
|
||||
Object contextMenuObj = getMapActivity().getContextMenu().getObject();
|
||||
if (getMapActivity().getContextMenu().isActive()
|
||||
&& contextMenuObj != null && contextMenuObj instanceof TargetPoint) {
|
||||
TargetPoint targetPoint = (TargetPoint) contextMenuObj;
|
||||
if (!targetPoint.start && !targetPoint.intermediate) {
|
||||
getMapActivity().getContextMenu().close();
|
||||
}
|
||||
}
|
||||
dismissMenu();
|
||||
}
|
||||
});
|
||||
|
||||
Button findParkingButton = (Button) view.findViewById(R.id.findParkingButton);
|
||||
findParkingButton.setCompoundDrawablesWithIntrinsicBounds(
|
||||
iconsCache.getContentIcon(R.drawable.ic_action_parking_dark), null, null, null);
|
||||
findParkingButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
PoiFiltersHelper helper = getMapActivity().getMyApplication().getPoiFilters();
|
||||
//PoiType place = getMapActivity().getMyApplication().getPoiTypes().getPoiTypeByKey("parking");
|
||||
PoiUIFilter parkingFilter = helper.getFilterById(PoiUIFilter.STD_PREFIX + "parking");
|
||||
if (parkingFilter != null) {
|
||||
final Intent newIntent = new Intent(getActivity(), SearchPOIActivity.class);
|
||||
newIntent.putExtra(SearchPOIActivity.AMENITY_FILTER, parkingFilter.getFilterId());
|
||||
newIntent.putExtra(SearchActivity.SEARCH_NEARBY, true);
|
||||
startActivityForResult(newIntent, 0);
|
||||
}
|
||||
dismissMenu();
|
||||
}
|
||||
});
|
||||
|
||||
View mainView = view.findViewById(R.id.main_view);
|
||||
if (menu.isLandscapeLayout()) {
|
||||
AndroidUtils.setBackground(view.getContext(), mainView, !menu.isLight(),
|
||||
R.drawable.bg_left_menu_light, R.drawable.bg_left_menu_dark);
|
||||
} else {
|
||||
AndroidUtils.setBackground(view.getContext(), mainView, !menu.isLight(),
|
||||
R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
getMapActivity().getContextMenu().setBaseFragmentVisibility(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
getMapActivity().getContextMenu().setBaseFragmentVisibility(true);
|
||||
}
|
||||
|
||||
|
||||
public static void showInstance(DestinationReachedMenu menu) {
|
||||
int slideInAnim = menu.getSlideInAnimation();
|
||||
int slideOutAnim = menu.getSlideOutAnimation();
|
||||
|
||||
DestinationReachedMenuFragment fragment = new DestinationReachedMenuFragment();
|
||||
fragment.menu = menu;
|
||||
menu.getMapActivity().getSupportFragmentManager().beginTransaction()
|
||||
.setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim)
|
||||
.add(R.id.fragmentContainer, fragment, TAG)
|
||||
.addToBackStack(TAG).commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
public void dismissMenu() {
|
||||
getMapActivity().getSupportFragmentManager().popBackStack();
|
||||
}
|
||||
|
||||
public MapActivity getMapActivity() {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null && activity instanceof MapActivity) {
|
||||
return (MapActivity) activity;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -677,6 +677,10 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
// do not hide fragment (needed for use case entering Planning mode without destination)
|
||||
}
|
||||
|
||||
@Override
|
||||
public void routeWasFinished() {
|
||||
}
|
||||
|
||||
public void onDismiss() {
|
||||
visible = false;
|
||||
mapActivity.getMapView().setMapPositionX(0);
|
||||
|
|
|
@ -15,6 +15,7 @@ import net.osmand.plus.OsmandSettings;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper;
|
||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||
import net.osmand.plus.mapcontextmenu.other.DestinationReachedMenu;
|
||||
import net.osmand.plus.routing.RouteCalculationResult.NextDirectionInfo;
|
||||
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
|
||||
import net.osmand.plus.routing.RouteProvider.RouteService;
|
||||
|
@ -38,6 +39,8 @@ public class RoutingHelper {
|
|||
public void newRouteIsCalculated(boolean newRoute, ValueHolder<Boolean> showToast);
|
||||
|
||||
public void routeWasCancelled();
|
||||
|
||||
public void routeWasFinished();
|
||||
}
|
||||
|
||||
private static final float POSITION_TOLERANCE = 60;
|
||||
|
@ -183,6 +186,24 @@ public class RoutingHelper {
|
|||
}
|
||||
}
|
||||
|
||||
private synchronized void finishCurrentRoute() {
|
||||
app.runInUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Iterator<WeakReference<IRouteInformationListener>> it = listeners.iterator();
|
||||
while(it.hasNext()) {
|
||||
WeakReference<IRouteInformationListener> ref = it.next();
|
||||
IRouteInformationListener l = ref.get();
|
||||
if(l == null) {
|
||||
it.remove();
|
||||
} else {
|
||||
l.routeWasFinished();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public GPXRouteParamsBuilder getCurrentGPXRoute() {
|
||||
return currentGPXRoute;
|
||||
}
|
||||
|
@ -490,7 +511,7 @@ public class RoutingHelper {
|
|||
if (currentRoute > routeNodes.size() - 3
|
||||
&& currentLocation.distanceTo(lastPoint) < (((float)settings.getApplicationMode().getArrivalDistance()) * settings.ARRIVAL_DISTANCE_FACTOR.get())
|
||||
&& !isRoutePlanningMode) {
|
||||
showMessage(app.getString(R.string.arrived_at_destination));
|
||||
//showMessage(app.getString(R.string.arrived_at_destination));
|
||||
TargetPointsHelper targets = app.getTargetPointsHelper();
|
||||
TargetPoint tp = targets.getPointToNavigate();
|
||||
String description = tp == null ? "" : tp.getOnlyName();
|
||||
|
@ -509,6 +530,7 @@ public class RoutingHelper {
|
|||
settings.APPLICATION_MODE.set(settings.DEFAULT_APPLICATION_MODE.get());
|
||||
}
|
||||
});
|
||||
finishCurrentRoute();
|
||||
// targets.clearPointToNavigate(false);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -533,6 +533,10 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
|||
public void routeWasCancelled() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void routeWasFinished() {
|
||||
}
|
||||
|
||||
public static int dpToPx(Context ctx, float dp) {
|
||||
Resources r = ctx.getResources();
|
||||
return (int) TypedValue.applyDimension(
|
||||
|
|
Loading…
Reference in a new issue