From 4ef9e036a1fe486e695f3296c0b9972501c28633 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Mon, 3 Aug 2020 12:57:17 +0300 Subject: [PATCH 1/3] Save Custom colors to tracks --- .../osmand/plus/track/TrackColoringCard.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/track/TrackColoringCard.java b/OsmAnd/src/net/osmand/plus/track/TrackColoringCard.java index 7d102c44fa..2dbbeb3a59 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackColoringCard.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackColoringCard.java @@ -23,6 +23,9 @@ import com.google.android.material.internal.FlowLayout; import net.osmand.AndroidUtils; import net.osmand.PlatformUtil; +import net.osmand.plus.GPXDatabase; +import net.osmand.plus.GPXDatabase.GpxDataItem; +import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; import net.osmand.plus.R; import net.osmand.plus.UiUtilities; import net.osmand.plus.activities.MapActivity; @@ -282,9 +285,25 @@ public class TrackColoringCard extends BaseCard implements ColorPickerListener { } } saveCustomColors(); + saveCustomColorsToTracks(prevColor, newColor); updateContent(); } + private void saveCustomColorsToTracks(int prevColor, int newColor) { + List gpxDataItems = app.getGpxDbHelper().getItems(); + for (GPXDatabase.GpxDataItem dataItem : gpxDataItems) { + if (prevColor == dataItem.getColor()) { + app.getGpxDbHelper().updateColor(dataItem, newColor); + } + } + List files = app.getSelectedGpxHelper().getSelectedGPXFiles(); + for (SelectedGpxFile selectedGpxFile : files) { + if (prevColor == selectedGpxFile.getGpxFile().getColor(0)) { + selectedGpxFile.getGpxFile().setColor(newColor); + } + } + } + private void saveCustomColors() { List colorNames = new ArrayList<>(); for (Integer color : customColors) { From cb7f60be620acf020b727b1fd7dfc10062d7fce4 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Mon, 3 Aug 2020 13:35:03 +0300 Subject: [PATCH 2/3] Open track appearance screen to header after click on map --- .../src/net/osmand/plus/track/TrackAppearanceFragment.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java b/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java index 4834a43b0e..4f7c1b0150 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java @@ -174,6 +174,13 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement if (view != null) { trackIcon = view.findViewById(R.id.track_icon); + view.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + openMenuHeaderOnly(); + } + }); + if (isPortrait()) { updateCardsLayout(); } From 0011085fb547756cef153edfbaa54e8a86d7b7d2 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Tue, 4 Aug 2020 00:27:38 +0300 Subject: [PATCH 3/3] Remove unnecessary selectable background --- OsmAnd/src/net/osmand/plus/track/TrackColoringCard.java | 3 +++ OsmAnd/src/net/osmand/plus/track/TrackWidthCard.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/track/TrackColoringCard.java b/OsmAnd/src/net/osmand/plus/track/TrackColoringCard.java index 2dbbeb3a59..ff21fa3f18 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackColoringCard.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackColoringCard.java @@ -250,6 +250,9 @@ public class TrackColoringCard extends BaseCard implements ColorPickerListener { private void updateHeader() { AndroidUiHelper.updateVisibility(view.findViewById(R.id.icon), false); + View headerView = view.findViewById(R.id.header_view); + headerView.setBackgroundDrawable(null); + TextView titleView = view.findViewById(R.id.title); titleView.setText(R.string.select_color); diff --git a/OsmAnd/src/net/osmand/plus/track/TrackWidthCard.java b/OsmAnd/src/net/osmand/plus/track/TrackWidthCard.java index 7dc668e3d6..81208971bb 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackWidthCard.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackWidthCard.java @@ -99,6 +99,9 @@ public class TrackWidthCard extends BaseCard { private void updateHeader() { AndroidUiHelper.updateVisibility(view.findViewById(R.id.icon), false); + View headerView = view.findViewById(R.id.header_view); + headerView.setBackgroundDrawable(null); + TextView titleView = view.findViewById(R.id.title); titleView.setText(R.string.select_track_width);