Allow to display tracks with different colors (colors are not stored back to gpx). Add to Release Notes?
This commit is contained in:
parent
c6b7082f6e
commit
d5f191cfa6
5 changed files with 48 additions and 4 deletions
|
@ -26,6 +26,27 @@
|
|||
android:layout_marginRight="10dp" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/osmo_edit_color"></TextView>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/ColorSpinner"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"></Spinner>
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:layout_width="fill_parent"
|
||||
|
|
|
@ -546,12 +546,13 @@ public class GPXUtilities {
|
|||
public List<TrkSegment> proccessPoints() {
|
||||
List<TrkSegment> tpoints = new ArrayList<TrkSegment>();
|
||||
for (Track t : tracks) {
|
||||
int trackColor = t.getColor(getColor(0));
|
||||
for (TrkSegment ts : t.segments) {
|
||||
if (ts.points.size() > 0) {
|
||||
TrkSegment sgmt = new TrkSegment();
|
||||
tpoints.add(sgmt);
|
||||
sgmt.points.addAll(ts.points);
|
||||
sgmt.setColor(t.getColor(0));
|
||||
sgmt.setColor(trackColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -506,8 +506,8 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
|
|||
protected void openChangeGroupDialog(final FavoriteGroup group) {
|
||||
Builder bld = new AlertDialog.Builder(getActivity());
|
||||
View favEdit = getActivity().getLayoutInflater().inflate(R.layout.fav_group_edit, null);
|
||||
final Spinner colorSpinner = (Spinner) favEdit.findViewById(R.id.ColorSpinner);
|
||||
final TIntArrayList list = new TIntArrayList();
|
||||
final Spinner colorSpinner = (Spinner) favEdit.findViewById(R.id.ColorSpinner);
|
||||
final int intColor = group.color == 0? getResources().getColor(R.color.color_favorite) : group.color;
|
||||
ColorDialogs.setupColorSpinner(getActivity(), intColor, colorSpinner, list);
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import net.osmand.data.PointDescription;
|
|||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.FavouritesDbHelper;
|
||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||
import net.osmand.plus.GPXUtilities.WptPt;
|
||||
import net.osmand.plus.GpxSelectionHelper;
|
||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup;
|
||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
|
||||
|
@ -24,10 +25,12 @@ import net.osmand.plus.OsmAndFormatter;
|
|||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.OsmAndListFragment;
|
||||
import net.osmand.plus.activities.TrackActivity;
|
||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.helpers.ColorDialogs;
|
||||
import net.osmand.util.Algorithms;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
|
@ -265,6 +268,12 @@ public class SelectedGPXFragment extends OsmAndListFragment {
|
|||
final List<GpxDisplayGroup> groups = filterGroups(GpxDisplayItemType.TRACK_SEGMENT);
|
||||
|
||||
View view = getMyActivity().getLayoutInflater().inflate(R.layout.selected_track_edit, null);
|
||||
|
||||
final TIntArrayList list = new TIntArrayList();
|
||||
final Spinner colorSpinner = (Spinner) view.findViewById(R.id.ColorSpinner);
|
||||
ColorDialogs.setupColorSpinner(getActivity(), getGpx().getColor(0), colorSpinner, list);
|
||||
|
||||
|
||||
final Spinner sp = (Spinner) view.findViewById(R.id.Spinner);
|
||||
Builder bld = new AlertDialog.Builder(getMyActivity());
|
||||
final List<Double> distanceSplit = new ArrayList<Double>();
|
||||
|
@ -324,10 +333,23 @@ public class SelectedGPXFragment extends OsmAndListFragment {
|
|||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
SelectedGpxFile sf = app.getSelectedGpxHelper().selectGpxFile(getGpx(), vis.isChecked(), false);
|
||||
int clr = list.get(colorSpinner.getSelectedItemPosition());
|
||||
if(clr != 0 ) {
|
||||
sf.getModifiableGpxFile().setColor(clr);
|
||||
sf.processPoints();
|
||||
}
|
||||
if (groups.size() > 0) {
|
||||
updateSplit(groups, distanceSplit, timeSplit, sp.getSelectedItemPosition(), vis.isChecked() ? sf
|
||||
: null);
|
||||
}
|
||||
if(vis.isChecked() && sf.getGpxFile() != null) {
|
||||
WptPt wpt = sf.getGpxFile().findPointToShow();
|
||||
if (wpt != null) {
|
||||
app.getSettings().setMapLocationToShow(wpt.getLatitude(), wpt.getLongitude(), 15, null, false,
|
||||
false); //$NON-NLS-1$
|
||||
MapActivity.launchMapActivityMoveToTop(activity);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -464,7 +486,7 @@ public class SelectedGPXFragment extends OsmAndListFragment {
|
|||
OsmandSettings settings = app.getSettings();
|
||||
final PopupMenu optionsMenu = new PopupMenu(getActivity(), v);
|
||||
DirectionsDialogs.createDirectionActionsPopUpMenu(optionsMenu, location, child.locationStart, name, settings.getLastKnownMapZoom(),
|
||||
getActivity(), true, false);
|
||||
getActivity(), false, false);
|
||||
optionsMenu.show();
|
||||
// } else {
|
||||
// child.expanded = !child.expanded;
|
||||
|
|
|
@ -363,7 +363,7 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
|||
canvas.drawPath(path, shadowPaint);
|
||||
}
|
||||
int clr = paint.getColor();
|
||||
if(clr != l.getColor(clr)) {
|
||||
if(clr != l.getColor(clr) && l.getColor(clr) != 0) {
|
||||
paint.setColor(l.getColor(clr));
|
||||
}
|
||||
canvas.drawPath(path, paint);
|
||||
|
|
Loading…
Reference in a new issue