Add empty mode to the ruler
This commit is contained in:
parent
57e8c596be
commit
a23c6f78de
3 changed files with 11 additions and 4 deletions
|
@ -3031,6 +3031,7 @@ public class OsmandSettings {
|
||||||
|
|
||||||
public enum RulerMode {
|
public enum RulerMode {
|
||||||
FIRST,
|
FIRST,
|
||||||
SECOND
|
SECOND,
|
||||||
|
EMPTY
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,13 +85,14 @@ public class RulerControlLayer extends OsmandMapLayer {
|
||||||
final QuadPoint center = tb.getCenterPixelPoint();
|
final QuadPoint center = tb.getCenterPixelPoint();
|
||||||
final RulerMode mode = app.getSettings().RULER_MODE.get();
|
final RulerMode mode = app.getSettings().RULER_MODE.get();
|
||||||
|
|
||||||
drawCenterIcon(canvas, tb, center);
|
|
||||||
if (mode == RulerMode.FIRST) {
|
if (mode == RulerMode.FIRST) {
|
||||||
|
drawCenterIcon(canvas, tb, center);
|
||||||
Location currentLoc = app.getLocationProvider().getLastKnownLocation();
|
Location currentLoc = app.getLocationProvider().getLastKnownLocation();
|
||||||
if (currentLoc != null) {
|
if (currentLoc != null) {
|
||||||
drawDistance(canvas, tb, center, currentLoc);
|
drawDistance(canvas, tb, center, currentLoc);
|
||||||
}
|
}
|
||||||
} else if (mode == RulerMode.SECOND) {
|
} else if (mode == RulerMode.SECOND) {
|
||||||
|
drawCenterIcon(canvas, tb, center);
|
||||||
updateData(tb, center);
|
updateData(tb, center);
|
||||||
for (int i = 1; i <= cacheDistances.size(); i++) {
|
for (int i = 1; i <= cacheDistances.size(); i++) {
|
||||||
drawCircle(canvas, tb, i, center);
|
drawCircle(canvas, tb, i, center);
|
||||||
|
|
|
@ -139,8 +139,13 @@ public class MapInfoWidgetsFactory {
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
rulerControl.setText(title, null);
|
rulerControl.setText(title, null);
|
||||||
final RulerMode mode = map.getMyApplication().getSettings().RULER_MODE.get();
|
final RulerMode mode = map.getMyApplication().getSettings().RULER_MODE.get();
|
||||||
map.getMyApplication().getSettings().RULER_MODE
|
RulerMode newMode = RulerMode.FIRST;
|
||||||
.set(mode == RulerMode.FIRST ? RulerMode.SECOND : RulerMode.FIRST);
|
if (mode == RulerMode.FIRST) {
|
||||||
|
newMode = RulerMode.SECOND;
|
||||||
|
} else if (mode == RulerMode.SECOND) {
|
||||||
|
newMode = RulerMode.EMPTY;
|
||||||
|
}
|
||||||
|
map.getMyApplication().getSettings().RULER_MODE.set(newMode);
|
||||||
map.refreshMap();
|
map.refreshMap();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue