Save Custom colors to tracks
This commit is contained in:
parent
1e22187dde
commit
4ef9e036a1
1 changed files with 19 additions and 0 deletions
|
@ -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<GpxDataItem> gpxDataItems = app.getGpxDbHelper().getItems();
|
||||
for (GPXDatabase.GpxDataItem dataItem : gpxDataItems) {
|
||||
if (prevColor == dataItem.getColor()) {
|
||||
app.getGpxDbHelper().updateColor(dataItem, newColor);
|
||||
}
|
||||
}
|
||||
List<SelectedGpxFile> files = app.getSelectedGpxHelper().getSelectedGPXFiles();
|
||||
for (SelectedGpxFile selectedGpxFile : files) {
|
||||
if (prevColor == selectedGpxFile.getGpxFile().getColor(0)) {
|
||||
selectedGpxFile.getGpxFile().setColor(newColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void saveCustomColors() {
|
||||
List<String> colorNames = new ArrayList<>();
|
||||
for (Integer color : customColors) {
|
||||
|
|
Loading…
Reference in a new issue