Merge pull request #707 from Bars107/master
Fixed issue with app crush on start navigation.
This commit is contained in:
commit
725bb52dd0
3 changed files with 10 additions and 6 deletions
|
@ -3,6 +3,7 @@ package net.osmand.plus.routepointsnavigation;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
import net.osmand.CallbackWithObject;
|
import net.osmand.CallbackWithObject;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.plus.GPXUtilities;
|
import net.osmand.plus.GPXUtilities;
|
||||||
|
@ -80,7 +81,7 @@ public class RoutePointsActivity extends OsmandListActivity {
|
||||||
SelectedRouteGpxFile sgpx = plugin.getCurrentRoute();
|
SelectedRouteGpxFile sgpx = plugin.getCurrentRoute();
|
||||||
if (!sgpx.getCurrentPoints().isEmpty() &&
|
if (!sgpx.getCurrentPoints().isEmpty() &&
|
||||||
!sgpx.getCurrentPoints().get(0).isNextNavigate){
|
!sgpx.getCurrentPoints().get(0).isNextNavigate){
|
||||||
sgpx.naviateToNextPoint();
|
sgpx.navigateToNextPoint();
|
||||||
}
|
}
|
||||||
prepareView();
|
prepareView();
|
||||||
return false;
|
return false;
|
||||||
|
@ -286,7 +287,9 @@ public class RoutePointsActivity extends OsmandListActivity {
|
||||||
return true;
|
return true;
|
||||||
} else if (item.getItemId() == NAVIGATE_DIALOG_ID){
|
} else if (item.getItemId() == NAVIGATE_DIALOG_ID){
|
||||||
app.getSettings().navigateDialog();
|
app.getSettings().navigateDialog();
|
||||||
MapActivity.launchMapActivityMoveToTop(getMyApplication());
|
Intent intent = new Intent(this, app.getAppCustomization().getMapActivity());
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
|
|
|
@ -87,7 +87,7 @@ public class RoutePointsLayer extends OsmandMapLayer implements ContextMenuLaye
|
||||||
plugin.getCurrentRoute().navigateToPoint(point);
|
plugin.getCurrentRoute().navigateToPoint(point);
|
||||||
plugin.saveGPXAsync();
|
plugin.saveGPXAsync();
|
||||||
} else if (itemId == R.string.navigate_to_next){
|
} else if (itemId == R.string.navigate_to_next){
|
||||||
plugin.getCurrentRoute().naviateToNextPoint();
|
plugin.getCurrentRoute().navigateToNextPoint();
|
||||||
plugin.saveGPXAsync();
|
plugin.saveGPXAsync();
|
||||||
}
|
}
|
||||||
map.refreshMap();
|
map.refreshMap();
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
||||||
@Override
|
@Override
|
||||||
public boolean destinationReached() {
|
public boolean destinationReached() {
|
||||||
if (currentRoute != null) {
|
if (currentRoute != null) {
|
||||||
boolean naviateToNextPoint = currentRoute.naviateToNextPoint();
|
boolean naviateToNextPoint = currentRoute.navigateToNextPoint();
|
||||||
|
|
||||||
if (naviateToNextPoint) {
|
if (naviateToNextPoint) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -261,7 +261,7 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
||||||
|
|
||||||
public void markPoint(RoutePoint point, boolean visited) {
|
public void markPoint(RoutePoint point, boolean visited) {
|
||||||
if (point.isNextNavigate() && visited) {
|
if (point.isNextNavigate() && visited) {
|
||||||
naviateToNextPoint();
|
navigateToNextPoint();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (visited) {
|
if (visited) {
|
||||||
|
@ -272,11 +272,12 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
||||||
sortPoints();
|
sortPoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean naviateToNextPoint() {
|
public boolean navigateToNextPoint() {
|
||||||
if (!currentPoints.isEmpty()) {
|
if (!currentPoints.isEmpty()) {
|
||||||
RoutePoint rp = currentPoints.get(0);
|
RoutePoint rp = currentPoints.get(0);
|
||||||
if (rp.isNextNavigate) {
|
if (rp.isNextNavigate) {
|
||||||
rp.setVisitedTime(System.currentTimeMillis());
|
rp.setVisitedTime(System.currentTimeMillis());
|
||||||
|
rp.isNextNavigate = false;
|
||||||
sortPoints();
|
sortPoints();
|
||||||
}
|
}
|
||||||
RoutePoint first = currentPoints.get(0);
|
RoutePoint first = currentPoints.get(0);
|
||||||
|
|
Loading…
Reference in a new issue