Small fixes
This commit is contained in:
parent
b0b5528cc6
commit
116ec774ad
5 changed files with 35 additions and 19 deletions
|
@ -204,7 +204,7 @@ public class RouteColorize {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPalette(int[] gradientPalette) {
|
public void setPalette(int[] gradientPalette) {
|
||||||
if (gradientPalette.length != 3) {
|
if (gradientPalette == null || gradientPalette.length != 3) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setPalette(new double[][] {
|
setPalette(new double[][] {
|
||||||
|
|
|
@ -176,8 +176,8 @@ public class GPXDatabase {
|
||||||
private File file;
|
private File file;
|
||||||
private GPXTrackAnalysis analysis;
|
private GPXTrackAnalysis analysis;
|
||||||
private String width;
|
private String width;
|
||||||
private GradientScaleType gradientScaleType;
|
|
||||||
private int color;
|
private int color;
|
||||||
|
private GradientScaleType gradientScaleType;
|
||||||
private int[] gradientSpeedPalette;
|
private int[] gradientSpeedPalette;
|
||||||
private int[] gradientAltitudePalette;
|
private int[] gradientAltitudePalette;
|
||||||
private int[] gradientSlopePalette;
|
private int[] gradientSlopePalette;
|
||||||
|
@ -884,7 +884,7 @@ public class GPXDatabase {
|
||||||
item.gradientSlopePalette = Algorithms.stringToGradientPalette(gradientSlopePalette);
|
item.gradientSlopePalette = Algorithms.stringToGradientPalette(gradientSlopePalette);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
item.gradientScaleType = Algorithms.isEmpty(gradientScaleType) ? null : GradientScaleType.valueOf(gradientScaleType);
|
item.gradientScaleType = Algorithms.isEmpty(gradientScaleType) ? null : GradientScaleType.valueOf(gradientScaleType.toUpperCase());
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
item.gradientScaleType = null;
|
item.gradientScaleType = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1409,7 +1409,29 @@ public class OsmandSettings {
|
||||||
public final OsmandPreference<Long> LAST_UPDATES_CARD_REFRESH = new LongPreference(this, "last_updates_card_refresh", 0).makeGlobal();
|
public final OsmandPreference<Long> LAST_UPDATES_CARD_REFRESH = new LongPreference(this, "last_updates_card_refresh", 0).makeGlobal();
|
||||||
|
|
||||||
public final CommonPreference<Integer> CURRENT_TRACK_COLOR = new IntPreference(this, "current_track_color", 0).makeGlobal().makeShared().cache();
|
public final CommonPreference<Integer> CURRENT_TRACK_COLOR = new IntPreference(this, "current_track_color", 0).makeGlobal().makeShared().cache();
|
||||||
public final CommonPreference<GradientScaleType> CURRENT_TRACK_COLORIZATION = new EnumStringPreference<>(this, "current_track_colorization", null, GradientScaleType.values()).makeGlobal().makeShared().cache();
|
public final CommonPreference<GradientScaleType> CURRENT_TRACK_COLORIZATION = new CommonPreference<GradientScaleType>(this, "current_track_colorization", null) {
|
||||||
|
@Override
|
||||||
|
protected GradientScaleType getValue(Object prefs, GradientScaleType defaultValue) {
|
||||||
|
String name = getSettingsAPI().getString(prefs, getId(), null);
|
||||||
|
return parseString(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean setValue(Object prefs, GradientScaleType val) {
|
||||||
|
String name = val == null ? null : val.getTypeName();
|
||||||
|
return getSettingsAPI().edit(prefs).putString(getId(), name).commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GradientScaleType parseString(String s) {
|
||||||
|
for (GradientScaleType value : GradientScaleType.values()) {
|
||||||
|
if (value.name().equals(s)) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}.makeGlobal().makeShared().cache();
|
||||||
public final CommonPreference<String> CURRENT_TRACK_WIDTH = new StringPreference(this, "current_track_width", "").makeGlobal().makeShared().cache();
|
public final CommonPreference<String> CURRENT_TRACK_WIDTH = new StringPreference(this, "current_track_width", "").makeGlobal().makeShared().cache();
|
||||||
public final CommonPreference<Boolean> CURRENT_TRACK_SHOW_ARROWS = new BooleanPreference(this, "current_track_show_arrows", false).makeGlobal().makeShared().cache();
|
public final CommonPreference<Boolean> CURRENT_TRACK_SHOW_ARROWS = new BooleanPreference(this, "current_track_show_arrows", false).makeGlobal().makeShared().cache();
|
||||||
public final CommonPreference<Boolean> CURRENT_TRACK_SHOW_START_FINISH = new BooleanPreference(this, "current_track_show_start_finish", true).makeGlobal().makeShared().cache();
|
public final CommonPreference<Boolean> CURRENT_TRACK_SHOW_START_FINISH = new BooleanPreference(this, "current_track_show_start_finish", true).makeGlobal().makeShared().cache();
|
||||||
|
|
|
@ -47,8 +47,8 @@ public class TrackDrawInfo {
|
||||||
public TrackDrawInfo(@NonNull OsmandApplication app, @NonNull GpxDataItem gpxDataItem, boolean currentRecording) {
|
public TrackDrawInfo(@NonNull OsmandApplication app, @NonNull GpxDataItem gpxDataItem, boolean currentRecording) {
|
||||||
filePath = gpxDataItem.getFile().getPath();
|
filePath = gpxDataItem.getFile().getPath();
|
||||||
width = gpxDataItem.getWidth();
|
width = gpxDataItem.getWidth();
|
||||||
gradientScaleType = gpxDataItem.getGradientScaleType();
|
|
||||||
color = gpxDataItem.getColor();
|
color = gpxDataItem.getColor();
|
||||||
|
gradientScaleType = gpxDataItem.getGradientScaleType();
|
||||||
speedGradientPalette = gpxDataItem.getGradientSpeedPalette();
|
speedGradientPalette = gpxDataItem.getGradientSpeedPalette();
|
||||||
altitudeGradientPalette = gpxDataItem.getGradientAltitudePalette();
|
altitudeGradientPalette = gpxDataItem.getGradientAltitudePalette();
|
||||||
slopeGradientPalette = gpxDataItem.getGradientSlopePalette();
|
slopeGradientPalette = gpxDataItem.getGradientSlopePalette();
|
||||||
|
|
|
@ -102,7 +102,14 @@ public class Renderable {
|
||||||
|
|
||||||
protected abstract void startCuller(double newZoom);
|
protected abstract void startCuller(double newZoom);
|
||||||
|
|
||||||
protected void drawSingleSegment(double zoom, Paint p, Canvas canvas, RotatedTileBox tileBox) {}
|
protected void drawSingleSegment(double zoom, Paint p, Canvas canvas, RotatedTileBox tileBox) {
|
||||||
|
if (scaleType != null) {
|
||||||
|
drawGradient(getPointsForDrawing(), p, canvas, tileBox);
|
||||||
|
scaleType = null;
|
||||||
|
} else {
|
||||||
|
drawSolid(getPointsForDrawing(), p, canvas, tileBox);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void drawSegment(double zoom, Paint p, Canvas canvas, RotatedTileBox tileBox) {
|
public void drawSegment(double zoom, Paint p, Canvas canvas, RotatedTileBox tileBox) {
|
||||||
|
@ -230,15 +237,6 @@ public class Renderable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void drawSingleSegment(double zoom, Paint p, Canvas canvas, RotatedTileBox tileBox) {
|
|
||||||
if (scaleType != null) {
|
|
||||||
drawGradient(getPointsForDrawing(), p, canvas, tileBox);
|
|
||||||
scaleType = null;
|
|
||||||
} else {
|
|
||||||
drawSolid(getPointsForDrawing(), p, canvas, tileBox);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class CurrentTrack extends RenderableSegment {
|
public static class CurrentTrack extends RenderableSegment {
|
||||||
|
@ -257,9 +255,5 @@ public class Renderable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override protected void startCuller(double newZoom) {}
|
@Override protected void startCuller(double newZoom) {}
|
||||||
|
|
||||||
@Override public void drawSingleSegment(double zoom, Paint p, Canvas canvas, RotatedTileBox tileBox) {
|
|
||||||
drawSolid(points, p, canvas, tileBox);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue