Fix bearing: added M for magnetic, move widget under 1st marker widget
This commit is contained in:
parent
8be44e1e87
commit
e85dbc0deb
2 changed files with 15 additions and 10 deletions
|
@ -129,14 +129,17 @@ public class MapInfoLayer extends OsmandMapLayer {
|
|||
registerSideWidget(dist, R.drawable.ic_action_target, R.string.map_widget_distance, "distance", false, 5);
|
||||
TextInfoWidget time = ric.createTimeControl(map);
|
||||
registerSideWidget(time, new TimeControlWidgetState(app), "time", false, 10);
|
||||
TextInfoWidget bearing = ric.createBearingControl(map);
|
||||
registerSideWidget(bearing, new BearingWidgetState(app), "bearing", false, 11);
|
||||
|
||||
if (settings.USE_MAP_MARKERS.get()) {
|
||||
TextInfoWidget marker = mwf.createMapMarkerControl(map, true);
|
||||
registerSideWidget(marker, R.drawable.ic_action_flag_dark, R.string.map_marker_1st, "map_marker_1st", false, 12);
|
||||
TextInfoWidget bearing = ric.createBearingControl(map);
|
||||
registerSideWidget(bearing, new BearingWidgetState(app), "bearing", false, 13);
|
||||
TextInfoWidget marker2nd = mwf.createMapMarkerControl(map, false);
|
||||
registerSideWidget(marker2nd, R.drawable.ic_action_flag_dark, R.string.map_marker_2nd, "map_marker_2nd", false, 13);
|
||||
registerSideWidget(marker2nd, R.drawable.ic_action_flag_dark, R.string.map_marker_2nd, "map_marker_2nd", false, 14);
|
||||
} else {
|
||||
TextInfoWidget bearing = ric.createBearingControl(map);
|
||||
registerSideWidget(bearing, new BearingWidgetState(app), "bearing", false, 13);
|
||||
}
|
||||
|
||||
TextInfoWidget speed = ric.createSpeedControl(map);
|
||||
|
|
|
@ -622,13 +622,13 @@ public class RouteInfoWidgetsFactory {
|
|||
@Override
|
||||
public boolean updateInfo(DrawSettings drawSettings) {
|
||||
boolean relative = showRelativeBearing.get();
|
||||
setIcons(relative ? relativeBearingResId : bearingResId, relative ? relativeBearingNightResId : bearingNightResId);
|
||||
boolean modeChanged = setIcons(relative ? relativeBearingResId : bearingResId, relative ? relativeBearingNightResId : bearingNightResId);
|
||||
setContentTitle(relative ? R.string.map_widget_bearing : R.string.map_widget_magnetic_bearing);
|
||||
int b = getBearing(relative);
|
||||
if (distChanged(cachedDegrees, b)) {
|
||||
if (degreesChanged(cachedDegrees, b) || modeChanged) {
|
||||
cachedDegrees = b;
|
||||
if (b != -1000) {
|
||||
setText(String.valueOf(b) + "°", null);
|
||||
setText(String.valueOf(b) + "°" + (relative ? "" : " M"), null);
|
||||
} else {
|
||||
setText(null, null);
|
||||
}
|
||||
|
@ -688,9 +688,7 @@ public class RouteInfoWidgetsFactory {
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
showRelativeBearing.set(!showRelativeBearing.get());
|
||||
bearingControl.setIcons(!showRelativeBearing.get() ? bearingResId : relativeBearingResId,
|
||||
!showRelativeBearing.get() ? bearingNightResId : relativeBearingNightResId);
|
||||
map.getMapView().refreshMap();
|
||||
map.refreshMap();
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -1198,12 +1196,16 @@ public class RouteInfoWidgetsFactory {
|
|||
|
||||
|
||||
public static boolean distChanged(int oldDist, int dist){
|
||||
if(oldDist != 0 && Math.abs(oldDist - dist) < 10){
|
||||
if (oldDist != 0 && Math.abs(oldDist - dist) < 10) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean degreesChanged(int oldDegrees, int degrees){
|
||||
return Math.abs(oldDegrees - degrees) >= 1;
|
||||
}
|
||||
|
||||
public AlarmWidget createAlarmInfoControl(OsmandApplication app, MapActivity map) {
|
||||
return new AlarmWidget(app, map);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue