diff --git a/OsmAnd/AndroidManifest.xml b/OsmAnd/AndroidManifest.xml
index d9115c377e..5da3dd3063 100644
--- a/OsmAnd/AndroidManifest.xml
+++ b/OsmAnd/AndroidManifest.xml
@@ -114,7 +114,7 @@
-
+
diff --git a/OsmAnd/res/layout/route_point_info.xml b/OsmAnd/res/layout/route_point_info.xml
index 82f7446a92..33a1ea2bba 100644
--- a/OsmAnd/res/layout/route_point_info.xml
+++ b/OsmAnd/res/layout/route_point_info.xml
@@ -1,37 +1,27 @@
-
+ android:orientation="horizontal"
+ android:padding="6dip"
+ android:weightSum="6">
-
+ android:layout_weight="5"/>
+ android:layout_weight="1"/>
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/OsmAnd/res/layout/route_steps_main.xml b/OsmAnd/res/layout/route_steps_main.xml
index c75202ca3a..ddada1c6e0 100644
--- a/OsmAnd/res/layout/route_steps_main.xml
+++ b/OsmAnd/res/layout/route_steps_main.xml
@@ -3,25 +3,30 @@
+ android:orientation="vertical">
+
+
+
+
+
-
-
-
+
-
+ android:layout_height="fill_parent"/>
\ No newline at end of file
diff --git a/OsmAnd/res/values/routepoints.xml b/OsmAnd/res/values/routepoints.xml
new file mode 100644
index 0000000000..984e8d665b
--- /dev/null
+++ b/OsmAnd/res/values/routepoints.xml
@@ -0,0 +1,5 @@
+
+
+ No gpx
+ Mark as current
+
\ No newline at end of file
diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 5dd3caf803..22c554ef36 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -1881,4 +1881,6 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
Invalid format: %s
Mark as next
Show on map
+ Mark as visited
+ Show on map
diff --git a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java
index 8f8bde4a75..fc3fe2d476 100644
--- a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java
+++ b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java
@@ -22,7 +22,7 @@ import net.osmand.plus.osmo.OsMoPlugin;
import net.osmand.plus.osmodroid.OsMoDroidPlugin;
import net.osmand.plus.parkingpoint.ParkingPositionPlugin;
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
-import net.osmand.plus.routesteps.RouteStepsPlugin;
+import net.osmand.plus.routepointsnavigation.RoutePointsPlugin;
import net.osmand.plus.srtmplugin.SRTMPlugin;
import net.osmand.plus.views.OsmandMapTileView;
import org.apache.commons.logging.Log;
@@ -45,8 +45,6 @@ public abstract class OsmandPlugin {
private static final String OSMODROID_PLUGIN_COMPONENT = "com.OsMoDroid"; //$NON-NLS-1$
- private static final String ROUTE_STEPS_PLUGIN_COMPONENT = "net.osmand.routeStepsPlugin"; //$NON-NLS-1$
-
public abstract String getId();
public abstract String getDescription();
@@ -87,7 +85,7 @@ public abstract class OsmandPlugin {
//final RouteStepsPlugin routeSteps = new RouteStepsPlugin(app);
//installPlugin(ROUTE_STEPS_PLUGIN_COMPONENT, RouteStepsPlugin.ID, app, routeSteps);
- installedPlugins.add(new RouteStepsPlugin(app));
+ installedPlugins.add(new RoutePointsPlugin(app));
installPlugin(OSMODROID_PLUGIN_COMPONENT, OsMoDroidPlugin.ID, app, new OsMoDroidPlugin(app));
installedPlugins.add(new OsmEditingPlugin(app));
diff --git a/OsmAnd/src/net/osmand/plus/routesteps/RouteStepsActivity.java b/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsActivity.java
similarity index 66%
rename from OsmAnd/src/net/osmand/plus/routesteps/RouteStepsActivity.java
rename to OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsActivity.java
index d770857279..fc8d773d7b 100644
--- a/OsmAnd/src/net/osmand/plus/routesteps/RouteStepsActivity.java
+++ b/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsActivity.java
@@ -1,9 +1,6 @@
-package net.osmand.plus.routesteps;
+package net.osmand.plus.routepointsnavigation;
-import alice.tuprolog.Int;
-import android.app.AlertDialog;
import android.content.Context;
-import android.content.DialogInterface;
import android.os.Bundle;
import android.text.format.DateFormat;
import android.util.Log;
@@ -15,9 +12,9 @@ import net.osmand.plus.GPXUtilities;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
-import net.osmand.plus.activities.MapActivity;
+import net.osmand.plus.activities.OsmandExpandableListActivity;
import net.osmand.plus.helpers.GpxUiHelper;
-import net.osmand.plus.views.ContextMenuLayer;
+import org.w3c.dom.Text;
import java.io.File;
import java.util.*;
@@ -25,10 +22,9 @@ import java.util.*;
/**
* Created by Bars on 13.06.2014.
*/
-public class RouteStepsActivity extends SherlockFragmentActivity {
+public class RoutePointsActivity extends SherlockFragmentActivity {
+
- private static final String VISITED_KEY = "IsVisited";
- private static final String POINT_KEY = "Point";
private static final String CURRENT_ROUTE_KEY = "CurrentRoute";
private File file;
@@ -39,13 +35,19 @@ public class RouteStepsActivity extends SherlockFragmentActivity {
private List pointsList;
private List pointsStatus;
+
//saves indexed of sorted list
private List pointsIndex;
+
//needed to save user selection
private List pointsChangedState;
private List pointsStartState;
- private RouteStepsPlugin plugin;
+ private RoutePointsPlugin plugin;
+
+ private int selectedItemIndex;
+
+ private ListView listView;
@Override
@@ -55,8 +57,8 @@ public class RouteStepsActivity extends SherlockFragmentActivity {
getPlugin();
getGpx();
- if (gpx != null){
- preparePoints();
+ if (gpx != null) {
+ prepareView();
}
Button done = (Button) findViewById(R.id.done);
@@ -64,6 +66,9 @@ public class RouteStepsActivity extends SherlockFragmentActivity {
@Override
public void onClick(View view) {
saveStatus();
+ GPXUtilities.WptPt point = plugin.getCurrentPoint();
+ app.getSettings().setMapLocationToShow(point.lat, point.lon, app.getSettings().getMapZoomToShow());
+ finish();
}
});
@@ -71,33 +76,40 @@ public class RouteStepsActivity extends SherlockFragmentActivity {
}
- private void getPlugin(){
+ private void getPlugin() {
List plugins = OsmandPlugin.getEnabledPlugins();
- for (OsmandPlugin plugin: plugins){
- if (plugin instanceof RouteStepsPlugin){
- this.plugin = (RouteStepsPlugin) plugin;
+ for (OsmandPlugin plugin : plugins) {
+ if (plugin instanceof RoutePointsPlugin) {
+ this.plugin = (RoutePointsPlugin) plugin;
}
}
}
- private void getGpx(){
- if (plugin.getGpx() != null){
+ private void getGpx() {
+ if (plugin.getGpx() != null) {
this.gpx = plugin.getGpx();
} else {
- GpxUiHelper.selectGPXFile(this,false,false, new CallbackWithObject() {
+ GpxUiHelper.selectGPXFile(this, false, false, new CallbackWithObject() {
@Override
public boolean processResult(GPXUtilities.GPXFile[] result) {
gpx = result[0];
- preparePoints();
plugin.setGpx(gpx);
+ prepareView();
return false;
}
});
}
}
- private void preparePoints(){
+ private void prepareView() {
+ TextView gpxName = (TextView) findViewById(R.id.gpx_name);
+ String fileName = gpx.path.substring(gpx.path.lastIndexOf("/") + 1,gpx.path.lastIndexOf("."));
+ gpxName.setText(fileName);
+
+ TextView visited = (TextView) findViewById(R.id.points_count);
+ visited.setText(plugin.getVisitedAllString());
+
loadCurrentRoute();
pointsList = currentRoute.points;
sortPoints();
@@ -112,7 +124,7 @@ public class RouteStepsActivity extends SherlockFragmentActivity {
for (int i = 0; i < pointsList.size(); i++) {
String pointName = pointsList.get(i).name;
if (pointsStatus.get(i) != 0) {
- String dateString= DateFormat.format("MM/dd/yyyy", new Date(pointsStatus.get(i))).toString();
+ String dateString = DateFormat.format("MM/dd/yyyy hh:mm:ss", new Date(pointsStatus.get(i))).toString();
pointItemsList.add(new PointItem(true, pointName, dateString));
} else {
pointItemsList.add(new PointItem(false, pointName, ""));
@@ -120,32 +132,40 @@ public class RouteStepsActivity extends SherlockFragmentActivity {
}
PointItemAdapter adapter = new PointItemAdapter(this, R.layout.route_point_info, pointItemsList);
- final ListView listView = (ListView) findViewById(R.id.pointsListView);
+ listView = (ListView) findViewById(R.id.pointsListView);
listView.setAdapter(adapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView> adapterView, View view, int i, long l) {
- final PopupMenu menu = new PopupMenu(RouteStepsActivity.this, view);
+ selectedItemIndex = i;
+ final PopupMenu popup = new PopupMenu(RoutePointsActivity.this, view);
+ final Menu menu = popup.getMenu();
+ menu.add(getString(R.string.mark_as_current));
+ menu.add(getString(R.string.mark_as_visited));
+ menu.add(getString(R.string.show_on_map));
- menu.getMenuInflater().inflate(R.menu.route_step_menu, menu.getMenu());
- menu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
+ popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem menuItem) {
- if (menuItem.getTitle().equals("Mark as next")){
+ if (menuItem.getTitle().equals(getResources().getString(R.string.mark_as_current))) {
+ plugin.setCurrentPoint(pointsList.get(selectedItemIndex));
+ } else if (menuItem.getTitle().equals(getResources().getString(R.string.show_on_map))) {
+ GPXUtilities.WptPt point = pointsList.get(selectedItemIndex);
+ app.getSettings().setMapLocationToShow(point.lat, point.lon, app.getSettings().getMapZoomToShow());
+ finish();
} else {
- //AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuItem.getMenuInfo();
- ///int position = info.position;
- //GPXUtilities.WptPt point = pointsList.get(position);
- //app.getSettings().setMapLocationToShow();
+ //inverts selection state of item
+ boolean state = pointsChangedState.get(selectedItemIndex);
+ pointsChangedState.set(selectedItemIndex,!state);
}
return true;
}
});
- menu.show();
+ popup.show();
}
});
}
@@ -172,43 +192,42 @@ public class RouteStepsActivity extends SherlockFragmentActivity {
private List getAllPointsStatus() {
List pointsStatus = new ArrayList();
for (int i = 0; i < pointsList.size(); i++) {
- pointsStatus.add(getPointStatus(pointsIndex.get(i)));
+ pointsStatus.add(plugin.getPointStatus(pointsIndex.get(i)));
}
return pointsStatus;
}
- private void saveStatus(){
+ private void saveStatus() {
for (int i = 0; i < pointsChangedState.size(); i++) {
boolean newValue = pointsChangedState.get(i);
//if values is the same - there's no need to save data
if (newValue != pointsStartState.get(i)) {
int indexToWrite = pointsIndex.get(i);
- setPointStatus(indexToWrite, newValue);
+ plugin.setPointStatus(indexToWrite, newValue);
}
}
saveGPXFile();
- finish();
}
- private void sortPoints(){
+ private void sortPoints() {
List listToSort = new ArrayList();
List indexItemsAtTheEnd = new ArrayList();
pointsIndex = new ArrayList();
- for (int i =0; i< pointsList.size(); i++){
- long status = getPointStatus(i);
- if (status == 0L){
+ for (int i = 0; i < pointsList.size(); i++) {
+ long status = plugin.getPointStatus(i);
+ if (status == 0L) {
listToSort.add(pointsList.get(i));
pointsIndex.add(i);
- } else{
+ } else {
indexItemsAtTheEnd.add(i);
}
}
- for (int i : indexItemsAtTheEnd){
+ for (int i : indexItemsAtTheEnd) {
listToSort.add(pointsList.get(i));
pointsIndex.add(i);
}
@@ -220,34 +239,6 @@ public class RouteStepsActivity extends SherlockFragmentActivity {
GPXUtilities.writeGpxFile(new File(gpx.path), gpx, app);
}
- private long getPointStatus(int numberOfPoint) {
- Map map = currentRoute.getExtensionsToRead();
-
- String mapKey = POINT_KEY + numberOfPoint + VISITED_KEY;
- if (map.containsKey(mapKey)) {
- String value = map.get(mapKey);
- return (Long.valueOf(value));
- }
-
- return 0L;
- }
-
- //saves point status value to gpx extention file
- private void setPointStatus(int numberOfPoint, boolean status) {
- Map map = currentRoute.getExtensionsToWrite();
-
- String mapKey = POINT_KEY + numberOfPoint + VISITED_KEY;
- if (status) {
- //value is current time
- Calendar c = Calendar.getInstance();
- long number = c.getTimeInMillis();
- map.put(mapKey, String.valueOf(number));
- } else if (map.containsKey(mapKey)) {
- map.remove(mapKey);
- }
-
- }
-
public List getPointsState() {
List status = new ArrayList();
for (int i = 0; i < pointsStatus.size(); i++) {
@@ -270,12 +261,12 @@ public class RouteStepsActivity extends SherlockFragmentActivity {
}
private class PointItemAdapter extends ArrayAdapter {
- private RouteStepsActivity ctx;
+ private RoutePointsActivity ctx;
private ArrayList pointsList;
public PointItemAdapter(Context context, int textViewResourceId, ArrayList pointsList) {
super(context, textViewResourceId, pointsList);
- ctx = (RouteStepsActivity) context;
+ ctx = (RoutePointsActivity) context;
this.pointsList = new ArrayList();
this.pointsList.addAll(pointsList);
}
@@ -284,8 +275,6 @@ public class RouteStepsActivity extends SherlockFragmentActivity {
TextView index;
TextView name;
TextView date;
- CheckBox visited;
-
}
@Override
@@ -300,31 +289,22 @@ public class RouteStepsActivity extends SherlockFragmentActivity {
holder.index = (TextView) convertView.findViewById(R.id.index);
holder.date = (TextView) convertView.findViewById(R.id.date);
holder.name = (TextView) convertView.findViewById(R.id.name);
- holder.visited = (CheckBox) convertView.findViewById(R.id.checkBox1);
convertView.setTag(holder);
- holder.visited.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- CheckBox ch = (CheckBox) view;
- RelativeLayout parent = (RelativeLayout) ch.getParent();
- TextView text = (TextView) parent.getChildAt(0);
- pointsChangedState.set(Integer.parseInt(text.getText().toString()), ch.isChecked());
- }
- });
} else {
holder = (ViewHolder) convertView.getTag();
}
PointItem point = pointsList.get(position);
holder.index.setText(String.valueOf(position));
- holder.visited.setChecked(point.isSelected());
String pointName = point.getName();
int pos = pointName.indexOf(":");
holder.name.setText(pointName.substring(0, pos));
- if (point.isSelected()){
+ if (point.isSelected()) {
+ holder.name.setTextColor(getResources().getColor(R.color.osmbug_closed));
holder.date.setText(String.valueOf(point.getTime()));
- } else{
+ } else {
+ holder.name.setTextColor(getResources().getColor(R.color.color_update));
holder.date.setText("");
}
@@ -333,6 +313,7 @@ public class RouteStepsActivity extends SherlockFragmentActivity {
}
+ //this class needed to represent route point in UI
private class PointItem {
private boolean visited;
private String name;
diff --git a/OsmAnd/src/net/osmand/plus/routesteps/RouteStepsLayer.java b/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsLayer.java
similarity index 80%
rename from OsmAnd/src/net/osmand/plus/routesteps/RouteStepsLayer.java
rename to OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsLayer.java
index c35697a71b..cba5596dbb 100644
--- a/OsmAnd/src/net/osmand/plus/routesteps/RouteStepsLayer.java
+++ b/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsLayer.java
@@ -1,4 +1,4 @@
-package net.osmand.plus.routesteps;
+package net.osmand.plus.routepointsnavigation;
import android.graphics.Canvas;
import android.graphics.PointF;
@@ -14,12 +14,12 @@ import java.util.List;
/**
* Created by Barsik on 10.06.2014.
*/
-public class RouteStepsLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider {
+public class RoutePointsLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider {
private final MapActivity map;
- private RouteStepsPlugin plugin;
+ private RoutePointsPlugin plugin;
- public RouteStepsLayer(MapActivity map, RouteStepsPlugin plugin){
+ public RoutePointsLayer(MapActivity map, RoutePointsPlugin plugin){
this.map = map;
this.plugin = plugin;
}
diff --git a/OsmAnd/src/net/osmand/plus/routesteps/RouteStepsPlugin.java b/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsPlugin.java
similarity index 63%
rename from OsmAnd/src/net/osmand/plus/routesteps/RouteStepsPlugin.java
rename to OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsPlugin.java
index da8dbdc3d7..ddd23313f9 100644
--- a/OsmAnd/src/net/osmand/plus/routesteps/RouteStepsPlugin.java
+++ b/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsPlugin.java
@@ -1,22 +1,16 @@
-package net.osmand.plus.routesteps;
+package net.osmand.plus.routepointsnavigation;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Paint;
import android.view.View;
-import net.osmand.data.LatLon;
import net.osmand.plus.*;
import net.osmand.plus.activities.MapActivity;
-import net.osmand.plus.views.AnimateDraggingMapThread;
import net.osmand.plus.views.MapInfoLayer;
import net.osmand.plus.views.OsmandMapLayer;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.views.mapwidgets.TextInfoWidget;
import java.io.File;
-import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
@@ -24,30 +18,28 @@ import java.util.Map;
/**
* Created by Barsik on 10.06.2014.
*/
-public class RouteStepsPlugin extends OsmandPlugin {
+public class RoutePointsPlugin extends OsmandPlugin {
public static final String ID = "osmand.route.stepsPlugin";
+ private static final String VISITED_KEY = "IsVisited";
+ private static final String POINT_KEY = "Point";
+
private OsmandApplication app;
private GPXUtilities.GPXFile gpx;
- private File file;
private GPXUtilities.Route currentRoute;
private GPXUtilities.WptPt currentPoint;
private int currentPointPos;
- private RouteStepsLayer routeStepsLayer;
+ private RoutePointsLayer routeStepsLayer;
private List pointsList;
private TextInfoWidget routeStepsControl;
+ private int visitedCount;
- public RouteStepsPlugin(OsmandApplication app) {
+
+ public RoutePointsPlugin(OsmandApplication app) {
ApplicationMode. regWidget("route_steps", (ApplicationMode[]) null);
this.app = app;
-// this.file = new File("/storage/emulated/0/osmand/tracks/", "504.gpx");
-// gpx = GPXUtilities.loadGPXFile(app, file);
- }
-
- public void setGpxFile(GPXUtilities.GPXFile file) {
- this.gpx = file;
}
public void setCurrentPoint(GPXUtilities.WptPt point) {
@@ -85,16 +77,32 @@ public class RouteStepsPlugin extends OsmandPlugin {
return true;
}
+ public GPXUtilities.WptPt getCurrentPoint(){
+ if (currentPoint == null){
+ for (int i =0; i< pointsList.size(); i++){
+ if (getPointStatus(i) == 0){
+ currentPoint = pointsList.get(i);
+ }
+ }
+ }
+ return currentPoint;
+ }
+
public GPXUtilities.GPXFile getGpx(){ return gpx;}
- public void setGpx(GPXUtilities.GPXFile gpx) { this.gpx = gpx;}
+ public void setGpx(GPXUtilities.GPXFile gpx) {
+ this.gpx = gpx;
+ currentRoute = gpx.routes.get(0);
+ pointsList = currentRoute.points;
+ refreshPointsStatus();
+ }
public void registerLayers(MapActivity activity) {
// remove old if existing after turn
if (routeStepsLayer != null) {
activity.getMapView().removeLayer(routeStepsLayer);
}
- routeStepsLayer = new RouteStepsLayer(activity, this);
+ routeStepsLayer = new RoutePointsLayer(activity, this);
activity.getMapView().addLayer(routeStepsLayer, 5.5f);
registerWidget(activity);
}
@@ -102,7 +110,7 @@ public class RouteStepsPlugin extends OsmandPlugin {
private void registerWidget(MapActivity activity) {
MapInfoLayer mapInfoLayer = activity.getMapLayers().getMapInfoLayer();
if (mapInfoLayer != null) {
- routeStepsControl = createRouteStepsInfoControl(activity, mapInfoLayer.getPaintText(), mapInfoLayer.getPaintSubText());
+ routeStepsControl = createRouteStepsInfoControl(activity, mapInfoLayer.getPaintSubText(), mapInfoLayer.getPaintSubText());
mapInfoLayer.getMapInfoControls().registerSideWidget(routeStepsControl,
R.drawable.widget_parking, R.string.map_widget_route_steps, "route_steps", false, 8);
mapInfoLayer.recreateControls();
@@ -140,16 +148,17 @@ public class RouteStepsPlugin extends OsmandPlugin {
}
}
+ public String getVisitedAllString(){ return String.valueOf(visitedCount) + "/" + String.valueOf(pointsList.size());}
+
private TextInfoWidget createRouteStepsInfoControl(final MapActivity map, Paint paintText, Paint paintSubText) {
TextInfoWidget routeStepsControl = new TextInfoWidget(map, 0, paintText, paintSubText) {
- @Override
+ @Override()
public boolean updateInfo(OsmandMapLayer.DrawSettings drawSettings) {
if (gpx != null) {
- OsmandMapTileView view = map.getMapView();
- setText("test", "test");
+ setText(String.valueOf(visitedCount) + "/",String.valueOf(pointsList.size()));
} else {
- setText("No gpx", "");
+ setText(app.getString(R.string.route_points_no_gpx), "");
}
return true;
@@ -159,7 +168,7 @@ public class RouteStepsPlugin extends OsmandPlugin {
routeStepsControl.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- Intent intent = new Intent(app, RouteStepsActivity.class);
+ Intent intent = new Intent(app, RoutePointsActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
app.startActivity(intent);
}
@@ -169,5 +178,39 @@ public class RouteStepsPlugin extends OsmandPlugin {
return routeStepsControl;
}
+ public void refreshPointsStatus(){
+ visitedCount = 0;
+ for (int i=0; i< pointsList.size();i++){
+ if (getPointStatus(i) != 0){ visitedCount++;}
+ }
+ }
+ public long getPointStatus(int numberOfPoint) {
+ Map map = currentRoute.getExtensionsToRead();
+
+ String mapKey = POINT_KEY + numberOfPoint + VISITED_KEY;
+ if (map.containsKey(mapKey)) {
+ String value = map.get(mapKey);
+ return (Long.valueOf(value));
+ }
+
+ return 0L;
+ }
+
+ //saves point status value to gpx extention file
+ public void setPointStatus(int numberOfPoint, boolean status) {
+ Map map = currentRoute.getExtensionsToWrite();
+
+ String mapKey = POINT_KEY + numberOfPoint + VISITED_KEY;
+ if (status) {
+ //value is current time
+ Calendar c = Calendar.getInstance();
+ long number = c.getTimeInMillis();
+ map.put(mapKey, String.valueOf(number));
+ } else if (map.containsKey(mapKey)) {
+ map.remove(mapKey);
+ }
+
+ refreshPointsStatus();
+ }
}