Change title in adding route points

This commit is contained in:
PavelRatushny 2017-08-16 18:32:08 +03:00
parent 50681f3e24
commit 41689efe1f
3 changed files with 11 additions and 3 deletions

View file

@ -9,6 +9,7 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). 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 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="route_point">Route point</string>
<string name="edit_line">Edit Line</string> <string name="edit_line">Edit Line</string>
<string name="add_point_before">Add point before</string> <string name="add_point_before">Add point before</string>
<string name="add_point_after">Add point after</string> <string name="add_point_after">Add point after</string>

View file

@ -409,7 +409,7 @@ public class MeasurementToolFragment extends Fragment {
}); });
mapActivity.showTopToolbar(toolBarController); mapActivity.showTopToolbar(toolBarController);
adapter = new MeasurementToolAdapter(getMapActivity(), measurementLayer.getMeasurementPoints()); adapter = new MeasurementToolAdapter(getMapActivity(), measurementLayer.getMeasurementPoints(), newGpxLine != null ? newGpxLine.getLineType() : null);
if (portrait) { if (portrait) {
pointsRv = mainView.findViewById(R.id.measure_points_recycler_view); pointsRv = mainView.findViewById(R.id.measure_points_recycler_view);
} else { } else {

View file

@ -17,6 +17,7 @@ import net.osmand.plus.IconsCache;
import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.TrackActivity.NewGpxLine.LineType;
import net.osmand.util.MapUtils; import net.osmand.util.MapUtils;
import java.util.Collections; import java.util.Collections;
@ -29,10 +30,12 @@ public class MeasurementToolAdapter extends RecyclerView.Adapter<MeasurementTool
private final List<WptPt> points; private final List<WptPt> points;
private MeasurementAdapterListener listener; private MeasurementAdapterListener listener;
private boolean nightMode; private boolean nightMode;
private LineType lineType;
public MeasurementToolAdapter(MapActivity mapActivity, List<WptPt> points) { public MeasurementToolAdapter(MapActivity mapActivity, List<WptPt> points, LineType lineType) {
this.mapActivity = mapActivity; this.mapActivity = mapActivity;
this.points = points; this.points = points;
this.lineType = lineType;
} }
public void setAdapterListener(MeasurementAdapterListener listener) { public void setAdapterListener(MeasurementAdapterListener listener) {
@ -80,9 +83,13 @@ public class MeasurementToolAdapter extends RecyclerView.Adapter<MeasurementTool
String pointTitle = pt.name; String pointTitle = pt.name;
if (!TextUtils.isEmpty(pointTitle)) { if (!TextUtils.isEmpty(pointTitle)) {
holder.title.setText(pointTitle); holder.title.setText(pointTitle);
} else {
if (lineType == LineType.ADD_ROUTE_POINTS) {
holder.title.setText(mapActivity.getString(R.string.route_point) + " - " + (pos + 1));
} else { } else {
holder.title.setText(mapActivity.getString(R.string.plugin_distance_point) + " - " + (pos + 1)); holder.title.setText(mapActivity.getString(R.string.plugin_distance_point) + " - " + (pos + 1));
} }
}
String pointDesc = pt.desc; String pointDesc = pt.desc;
if (!TextUtils.isEmpty(pointDesc)) { if (!TextUtils.isEmpty(pointDesc)) {
holder.descr.setText(pointDesc); holder.descr.setText(pointDesc);