commit
432f0e6abd
1 changed files with 21 additions and 14 deletions
|
@ -611,7 +611,7 @@ public class GpxUiHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
updateSelectedTracksAppearance(app, fileNames);
|
updateSelectedTracksAppearance(app, fileNames, gpxAppearanceParams);
|
||||||
loadGPXFileInDifferentThread(activity, callbackWithObject, dir, currentGPX,
|
loadGPXFileInDifferentThread(activity, callbackWithObject, dir, currentGPX,
|
||||||
fileNames.toArray(new String[0]));
|
fileNames.toArray(new String[0]));
|
||||||
}
|
}
|
||||||
|
@ -718,13 +718,7 @@ public class GpxUiHelper {
|
||||||
return dlg;
|
return dlg;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void updateSelectedTracksAppearance(OsmandApplication app, List<String> fileNames) {
|
private static void updateSelectedTracksAppearance(final OsmandApplication app, List<String> fileNames, final Map<String, String> params) {
|
||||||
final GpxDbHelper gpxDbHelper = app.getGpxDbHelper();
|
|
||||||
final boolean showStartFinish = app.getSettings().SHOW_START_FINISH_ICONS.get();
|
|
||||||
final String savedWidth = app.getSettings().getCustomRenderProperty(CURRENT_TRACK_WIDTH_ATTR).get();
|
|
||||||
String savedColor = app.getSettings().getCustomRenderProperty(CURRENT_TRACK_COLOR_ATTR).get();
|
|
||||||
final int color = GpxAppearanceAdapter.parseTrackColor(app.getRendererRegistry().getCurrentSelectedRenderer(), savedColor);
|
|
||||||
|
|
||||||
GpxDataItemCallback callback = new GpxDataItemCallback() {
|
GpxDataItemCallback callback = new GpxDataItemCallback() {
|
||||||
@Override
|
@Override
|
||||||
public boolean isCancelled() {
|
public boolean isCancelled() {
|
||||||
|
@ -733,22 +727,35 @@ public class GpxUiHelper {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onGpxDataItemReady(GpxDataItem item) {
|
public void onGpxDataItemReady(GpxDataItem item) {
|
||||||
updateTrackAppearance(gpxDbHelper, item, savedWidth, color, showStartFinish);
|
updateTrackAppearance(app, item, params);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
GpxDbHelper gpxDbHelper = app.getGpxDbHelper();
|
||||||
for (String name : fileNames) {
|
for (String name : fileNames) {
|
||||||
GpxDataItem item = gpxDbHelper.getItem(new File(app.getAppPath(IndexConstants.GPX_INDEX_DIR), name), callback);
|
GpxDataItem item = gpxDbHelper.getItem(new File(app.getAppPath(IndexConstants.GPX_INDEX_DIR), name), callback);
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
updateTrackAppearance(gpxDbHelper, item, savedWidth, color, showStartFinish);
|
updateTrackAppearance(app, item, params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void updateTrackAppearance(GpxDbHelper gpxDbHelper, GpxDataItem item, String width, int color, boolean showStartFinish) {
|
private static void updateTrackAppearance(OsmandApplication app, GpxDataItem item, Map<String, String> params) {
|
||||||
|
OsmandSettings settings = app.getSettings();
|
||||||
|
GpxDbHelper gpxDbHelper = app.getGpxDbHelper();
|
||||||
|
if (params.containsKey(CURRENT_TRACK_COLOR_ATTR)) {
|
||||||
|
String savedColor = settings.getCustomRenderProperty(CURRENT_TRACK_COLOR_ATTR).get();
|
||||||
|
int color = GpxAppearanceAdapter.parseTrackColor(app.getRendererRegistry().getCurrentSelectedRenderer(), savedColor);
|
||||||
gpxDbHelper.updateColor(item, color);
|
gpxDbHelper.updateColor(item, color);
|
||||||
|
}
|
||||||
|
if (params.containsKey(CURRENT_TRACK_WIDTH_ATTR)) {
|
||||||
|
String width = settings.getCustomRenderProperty(CURRENT_TRACK_WIDTH_ATTR).get();
|
||||||
gpxDbHelper.updateWidth(item, width);
|
gpxDbHelper.updateWidth(item, width);
|
||||||
|
}
|
||||||
|
if (params.containsKey(SHOW_START_FINISH_ATTR)) {
|
||||||
|
boolean showStartFinish = settings.SHOW_START_FINISH_ICONS.get();
|
||||||
gpxDbHelper.updateShowStartFinish(item, showStartFinish);
|
gpxDbHelper.updateShowStartFinish(item, showStartFinish);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void updateGpxInfoView(final @NonNull OsmandApplication app,
|
public static void updateGpxInfoView(final @NonNull OsmandApplication app,
|
||||||
final @NonNull View v,
|
final @NonNull View v,
|
||||||
|
|
Loading…
Reference in a new issue