removed some more unused code. Updated functionality of current point.

This commit is contained in:
unknown 2014-06-18 15:37:24 +03:00
parent 4e8c2e6476
commit 24303e8509
3 changed files with 17 additions and 22 deletions

View file

@ -13,13 +13,6 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"/>
<TextView android:id="@+id/index"
android:layout_marginLeft="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:visibility="gone"/>
<TextView
android:id="@+id/name"
android:layout_marginLeft="6dp"

View file

@ -177,9 +177,11 @@ public class RoutePointsActivity extends OsmandListActivity {
List<GPXUtilities.WptPt> listToSort = new ArrayList<GPXUtilities.WptPt>();
List<Integer> indexItemsAtTheEnd = new ArrayList<Integer>();
pointsIndex = new ArrayList<Integer>();
listToSort.add(plugin.getCurrentPoint());
int curPointInd = plugin.getCurrentPointIndex();
pointsIndex.add(curPointInd);
if (curPointInd != -1){
pointsIndex.add(curPointInd);
listToSort.add(plugin.getCurrentPoint());
}
for (int i = 0; i < sortedPointsList.size(); i++) {
if (i == curPointInd) {
@ -223,7 +225,6 @@ public class RoutePointsActivity extends OsmandListActivity {
private class ViewHolder {
ImageView image;
TextView index;
TextView name;
TextView dateOrDistance;
}
@ -237,7 +238,6 @@ public class RoutePointsActivity extends OsmandListActivity {
convertView = vi.inflate(R.layout.route_point_info, null);
holder = new ViewHolder();
holder.index = (TextView) convertView.findViewById(R.id.index);
holder.dateOrDistance = (TextView) convertView.findViewById(R.id.date_or_distance);
holder.name = (TextView) convertView.findViewById(R.id.name);
holder.image = (ImageView) convertView.findViewById(R.id.point_icon);
@ -248,7 +248,6 @@ public class RoutePointsActivity extends OsmandListActivity {
}
PointItem point = pointsList.get(position);
holder.index.setText(String.valueOf(position));
holder.name.setText(point.getName());
holder.dateOrDistance.setText(String.valueOf(point.getTime()));
if (point.isSelected()) {

View file

@ -3,6 +3,7 @@ package net.osmand.plus.routepointsnavigation;
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.MapInfoLayer;
@ -34,7 +35,7 @@ public class RoutePointsPlugin extends OsmandPlugin {
private TextInfoWidget routeStepsControl;
private int visitedCount;
private Integer currentPointIndex;
private int currentPointIndex = -1;
public RoutePointsPlugin(OsmandApplication app) {
@ -44,8 +45,7 @@ public class RoutePointsPlugin extends OsmandPlugin {
public void setCurrentPoint(GPXUtilities.WptPt point) {
currentPoint = point;
int number = findPointPosition(point);
currentPointIndex = number;
currentPointIndex = findPointPosition(point);
}
public void setCurrentPoint(int number) {
@ -78,15 +78,18 @@ public class RoutePointsPlugin extends OsmandPlugin {
}
public GPXUtilities.WptPt getCurrentPoint() {
if (currentPoint == null) {
for (int i = 0; i < pointsList.size(); i++) {
if (getPointStatus(i) == 0) {
currentPoint = pointsList.get(i);
currentPointIndex = i;
break;
}
TargetPointsHelper targetPointsHelper = app.getTargetPointsHelper();
LatLon latLon = targetPointsHelper.getPointToNavigate();
for(int i=0; i<pointsList.size();i++){
GPXUtilities.WptPt point = pointsList.get(i);
if (point.lat == latLon.getLatitude() && point.lon == latLon.getLongitude()){
currentPoint = point;
currentPointIndex = i;
break;
}
}
return currentPoint;
}