Fix widgets
This commit is contained in:
parent
ca263605fe
commit
9b364bf31b
13 changed files with 81 additions and 54 deletions
|
@ -520,7 +520,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
recordControl = new TextInfoWidget(activity);
|
recordControl = new TextInfoWidget(activity);
|
||||||
recordControl.setImageDrawable(activity.getResources().getDrawable(R.drawable.monitoring_rec_inactive));
|
recordControl.setImageDrawable(activity.getResources().getDrawable(R.drawable.monitoring_rec_inactive));
|
||||||
setRecordListener(recordControl, activity);
|
setRecordListener(recordControl, activity);
|
||||||
mapInfoLayer.registerSideWidget(recordControl, R.drawable.ic_action_micro_dark, R.drawable.widget_icon_av_inactive,
|
mapInfoLayer.registerSideWidget(recordControl, R.drawable.ic_action_micro_dark,
|
||||||
R.string.map_widget_av_notes, "audionotes", false, 22);
|
R.string.map_widget_av_notes, "audionotes", false, 22);
|
||||||
mapInfoLayer.recreateControls();
|
mapInfoLayer.recreateControls();
|
||||||
}
|
}
|
||||||
|
@ -539,13 +539,17 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateWidgetIcon(final TextInfoWidget recordPlaceControl) {
|
private void updateWidgetIcon(final TextInfoWidget recordPlaceControl) {
|
||||||
recordPlaceControl.setImageDrawable(activity.getResources().getDrawable(R.drawable.widget_icon_av_inactive));
|
recordPlaceControl.setIcons(R.drawable.widget_icon_av_inactive_day,
|
||||||
|
R.drawable.widget_icon_av_inactive_night);
|
||||||
if (AV_DEFAULT_ACTION.get() == AV_DEFAULT_ACTION_VIDEO) {
|
if (AV_DEFAULT_ACTION.get() == AV_DEFAULT_ACTION_VIDEO) {
|
||||||
recordPlaceControl.setImageDrawable(R.drawable.widget_icon_video);
|
recordPlaceControl.setIcons(R.drawable.widget_icon_video,
|
||||||
|
R.drawable.widget_icon_video);
|
||||||
} else if (AV_DEFAULT_ACTION.get() == AV_DEFAULT_ACTION_TAKEPICTURE) {
|
} else if (AV_DEFAULT_ACTION.get() == AV_DEFAULT_ACTION_TAKEPICTURE) {
|
||||||
recordPlaceControl.setImageDrawable(R.drawable.widget_icon_photo);
|
recordPlaceControl.setIcons(R.drawable.widget_icon_video,
|
||||||
|
R.drawable.widget_icon_video);
|
||||||
} else if (AV_DEFAULT_ACTION.get() == AV_DEFAULT_ACTION_AUDIO) {
|
} else if (AV_DEFAULT_ACTION.get() == AV_DEFAULT_ACTION_AUDIO) {
|
||||||
recordPlaceControl.setImageDrawable(R.drawable.widget_icon_audio);
|
recordPlaceControl.setIcons(R.drawable.widget_icon_audio,
|
||||||
|
R.drawable.widget_icon_audio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class OsmandDevelopmentPlugin extends OsmandPlugin {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
mapInfoLayer.registerSideWidget(fps, R.drawable.widget_no_icon, R.drawable.widget_no_icon,
|
mapInfoLayer.registerSideWidget(fps, R.drawable.widget_no_icon,
|
||||||
R.string.map_widget_fps_info, "fps", false, 30);
|
R.string.map_widget_fps_info, "fps", false, 30);
|
||||||
mapInfoLayer.recreateControls();
|
mapInfoLayer.recreateControls();
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,6 @@ public class OsmandDevelopmentPlugin extends OsmandPlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLogoResourceId() {
|
public int getLogoResourceId() {
|
||||||
// TODO
|
|
||||||
return R.drawable.ic_plugin_developer;
|
return R.drawable.ic_plugin_developer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ public class DistanceCalculatorPlugin extends OsmandPlugin {
|
||||||
if (mapInfoLayer != null ) {
|
if (mapInfoLayer != null ) {
|
||||||
distanceControl = createDistanceControl(activity);
|
distanceControl = createDistanceControl(activity);
|
||||||
mapInfoLayer.registerSideWidget(distanceControl,
|
mapInfoLayer.registerSideWidget(distanceControl,
|
||||||
R.drawable.ic_action_ruler_dark, R.drawable.widget_distance, R.string.map_widget_distancemeasurement, "distance.measurement", false, 21);
|
R.drawable.ic_action_ruler_dark, R.string.map_widget_distancemeasurement, "distance.measurement", false, 21);
|
||||||
mapInfoLayer.recreateControls();
|
mapInfoLayer.recreateControls();
|
||||||
updateText();
|
updateText();
|
||||||
}
|
}
|
||||||
|
@ -390,7 +390,7 @@ public class DistanceCalculatorPlugin extends OsmandPlugin {
|
||||||
showDialog(activity);
|
showDialog(activity);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
distanceControl.setImageDrawable(R.drawable.widget_distance);
|
distanceControl.setIcons(R.drawable.widget_distance_day, R.drawable.widget_distance_night);
|
||||||
return distanceControl;
|
return distanceControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
|
||||||
monitoringControl = createMonitoringControl(activity);
|
monitoringControl = createMonitoringControl(activity);
|
||||||
|
|
||||||
layer.registerSideWidget(monitoringControl,
|
layer.registerSideWidget(monitoringControl,
|
||||||
R.drawable.ic_action_play_dark, R.drawable.monitoring_rec_big, R.string.map_widget_monitoring, "monitoring", false, 18);
|
R.drawable.ic_action_play_dark, R.string.map_widget_monitoring, "monitoring", false, 18);
|
||||||
layer.recreateControls();
|
layer.recreateControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -172,7 +172,7 @@ public class OsMoPlugin extends OsmandPlugin implements OsMoReactor {
|
||||||
MapInfoLayer layer = activity.getMapLayers().getMapInfoLayer();
|
MapInfoLayer layer = activity.getMapLayers().getMapInfoLayer();
|
||||||
osmoControl = createOsMoControl(activity);
|
osmoControl = createOsMoControl(activity);
|
||||||
layer.registerSideWidget(osmoControl,
|
layer.registerSideWidget(osmoControl,
|
||||||
R.drawable.ic_osmo_dark, R.drawable.mon_osmo_signal_inactive, R.string.osmo_control, "osmo_control", false, 18);
|
R.drawable.ic_osmo_dark, R.string.osmo_control, "osmo_control", false, 18);
|
||||||
layer.recreateControls();
|
layer.recreateControls();
|
||||||
|
|
||||||
if(olayer != null) {
|
if(olayer != null) {
|
||||||
|
|
|
@ -191,7 +191,7 @@ public class ParkingPositionPlugin extends OsmandPlugin {
|
||||||
if (mapInfoLayer != null) {
|
if (mapInfoLayer != null) {
|
||||||
parkingPlaceControl = createParkingPlaceInfoControl(activity);
|
parkingPlaceControl = createParkingPlaceInfoControl(activity);
|
||||||
mapInfoLayer.registerSideWidget(parkingPlaceControl,
|
mapInfoLayer.registerSideWidget(parkingPlaceControl,
|
||||||
R.drawable.ic_action_parking_dark, R.drawable.widget_parking, R.string.map_widget_parking, "parking", false, 8);
|
R.drawable.ic_action_parking_dark, R.string.map_widget_parking, "parking", false, 8);
|
||||||
mapInfoLayer.recreateControls();
|
mapInfoLayer.recreateControls();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -495,7 +495,7 @@ public class ParkingPositionPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
parkingPlaceControl.setText(null, null);
|
parkingPlaceControl.setText(null, null);
|
||||||
parkingPlaceControl.setImageDrawable(R.drawable.widget_parking);
|
parkingPlaceControl.setIcons(R.drawable.widget_parking_day, R.drawable.widget_parking_night);
|
||||||
return parkingPlaceControl;
|
return parkingPlaceControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ import net.osmand.util.MapUtils;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Paint;
|
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.text.format.DateFormat;
|
import android.text.format.DateFormat;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
|
@ -201,7 +200,7 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
||||||
if (mapInfoLayer != null) {
|
if (mapInfoLayer != null) {
|
||||||
routeStepsControl = createRouteStepsInfoControl(activity);
|
routeStepsControl = createRouteStepsInfoControl(activity);
|
||||||
mapInfoLayer.registerSideWidget(routeStepsControl,
|
mapInfoLayer.registerSideWidget(routeStepsControl,
|
||||||
R.drawable.ic_action_signpost_dark, R.drawable.widget_signpost, R.string.map_widget_route_points, "route_steps", false, 8);
|
R.drawable.ic_action_signpost_dark, R.string.map_widget_route_points, "route_steps", false, 8);
|
||||||
mapInfoLayer.recreateControls();
|
mapInfoLayer.recreateControls();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,9 +82,9 @@ public class MapInfoLayer extends OsmandMapLayer {
|
||||||
recreateControls();
|
recreateControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerSideWidget(TextInfoWidget widget, int drawableMenu, int drawableMap,
|
public void registerSideWidget(TextInfoWidget widget, int drawableMenu,
|
||||||
int messageId, String key, boolean left, int priorityOrder) {
|
int messageId, String key, boolean left, int priorityOrder) {
|
||||||
MapWidgetRegInfo reg = mapInfoControls.registerSideWidgetInternal(widget, drawableMenu, drawableMap, messageId, key, left, priorityOrder);
|
MapWidgetRegInfo reg = mapInfoControls.registerSideWidgetInternal(widget, drawableMenu, messageId, key, left, priorityOrder);
|
||||||
updateReg(calculateTextState(), reg);
|
updateReg(calculateTextState(), reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,29 +105,29 @@ public class MapInfoLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
// register left stack
|
// register left stack
|
||||||
NextTurnInfoWidget bigInfoControl = ric.createNextInfoControl(map, app, false);
|
NextTurnInfoWidget bigInfoControl = ric.createNextInfoControl(map, app, false);
|
||||||
registerSideWidget(bigInfoControl, R.drawable.ic_action_next_turn, R.drawable.widget_next_turn, R.string.map_widget_next_turn,"next_turn", true, 5);
|
registerSideWidget(bigInfoControl, R.drawable.ic_action_next_turn, R.string.map_widget_next_turn,"next_turn", true, 5);
|
||||||
NextTurnInfoWidget smallInfoControl = ric.createNextInfoControl(map, app, true);
|
NextTurnInfoWidget smallInfoControl = ric.createNextInfoControl(map, app, true);
|
||||||
registerSideWidget(smallInfoControl, R.drawable.ic_action_next_turn, R.drawable.widget_next_turn, R.string.map_widget_next_turn_small, "next_turn_small", true,
|
registerSideWidget(smallInfoControl, R.drawable.ic_action_next_turn, R.string.map_widget_next_turn_small, "next_turn_small", true,
|
||||||
10);
|
10);
|
||||||
NextTurnInfoWidget nextNextInfoControl = ric.createNextNextInfoControl(map, app, true);
|
NextTurnInfoWidget nextNextInfoControl = ric.createNextNextInfoControl(map, app, true);
|
||||||
registerSideWidget(nextNextInfoControl, R.drawable.ic_action_next_turn, R.drawable.widget_next_turn, R.string.map_widget_next_next_turn, "next_next_turn",true, 15);
|
registerSideWidget(nextNextInfoControl, R.drawable.ic_action_next_turn, R.string.map_widget_next_next_turn, "next_next_turn",true, 15);
|
||||||
// right stack
|
// right stack
|
||||||
TextInfoWidget intermediateDist = ric.createIntermediateDistanceControl(map);
|
TextInfoWidget intermediateDist = ric.createIntermediateDistanceControl(map);
|
||||||
registerSideWidget(intermediateDist, R.drawable.ic_action_intermediate, R.drawable.widget_intermediate, R.string.map_widget_intermediate_distance, "intermediate_distance", false, 3);
|
registerSideWidget(intermediateDist, R.drawable.ic_action_intermediate, R.string.map_widget_intermediate_distance, "intermediate_distance", false, 3);
|
||||||
TextInfoWidget dist = ric.createDistanceControl(map);
|
TextInfoWidget dist = ric.createDistanceControl(map);
|
||||||
registerSideWidget(dist, R.drawable.ic_action_target, R.drawable.widget_target, R.string.map_widget_distance, "distance", false, 5);
|
registerSideWidget(dist, R.drawable.ic_action_target, R.string.map_widget_distance, "distance", false, 5);
|
||||||
TextInfoWidget time = ric.createTimeControl(map);
|
TextInfoWidget time = ric.createTimeControl(map);
|
||||||
registerSideWidget(time, R.drawable.ic_action_time, R.drawable.widget_time, R.string.map_widget_time, "time", false, 10);
|
registerSideWidget(time, R.drawable.ic_action_time, R.string.map_widget_time, "time", false, 10);
|
||||||
TextInfoWidget speed = ric.createSpeedControl(map);
|
TextInfoWidget speed = ric.createSpeedControl(map);
|
||||||
registerSideWidget(speed, R.drawable.ic_action_speed, R.drawable.widget_speed, R.string.map_widget_speed, "speed", false, 15);
|
registerSideWidget(speed, R.drawable.ic_action_speed, R.string.map_widget_speed, "speed", false, 15);
|
||||||
TextInfoWidget gpsInfo = mic.createGPSInfoControl(map);
|
TextInfoWidget gpsInfo = mic.createGPSInfoControl(map);
|
||||||
registerSideWidget(gpsInfo, R.drawable.ic_action_gps_info, R.drawable.widget_gps_info, R.string.map_widget_gps_info, "gps_info", false, 17);
|
registerSideWidget(gpsInfo, R.drawable.ic_action_gps_info, R.string.map_widget_gps_info, "gps_info", false, 17);
|
||||||
TextInfoWidget maxspeed = ric.createMaxSpeedControl(map);
|
TextInfoWidget maxspeed = ric.createMaxSpeedControl(map);
|
||||||
registerSideWidget(maxspeed, R.drawable.ic_action_max_speed, R.drawable.widget_max_speed, R.string.map_widget_max_speed, "max_speed", false, 18);
|
registerSideWidget(maxspeed, R.drawable.ic_action_max_speed, R.string.map_widget_max_speed, "max_speed", false, 18);
|
||||||
TextInfoWidget alt = mic.createAltitudeControl(map);
|
TextInfoWidget alt = mic.createAltitudeControl(map);
|
||||||
registerSideWidget(alt, R.drawable.ic_action_altitude, R.drawable.widget_altitude, R.string.map_widget_altitude, "altitude", false, 20);
|
registerSideWidget(alt, R.drawable.ic_action_altitude, R.string.map_widget_altitude, "altitude", false, 20);
|
||||||
TextInfoWidget plainTime = ric.createPlainTimeControl(map);
|
TextInfoWidget plainTime = ric.createPlainTimeControl(map);
|
||||||
registerSideWidget(plainTime, R.drawable.ic_action_time_to_distance, R.drawable.widget_time_to_distance, R.string.map_widget_plain_time, "plain_time", false, 25);
|
registerSideWidget(plainTime, R.drawable.ic_action_time_to_distance, R.string.map_widget_plain_time, "plain_time", false, 25);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -155,6 +155,7 @@ public class MapInfoLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
private static class TextState {
|
private static class TextState {
|
||||||
boolean textBold ;
|
boolean textBold ;
|
||||||
|
boolean night;
|
||||||
int textColor ;
|
int textColor ;
|
||||||
int textShadowColor ;
|
int textShadowColor ;
|
||||||
int boxTop;
|
int boxTop;
|
||||||
|
@ -202,6 +203,7 @@ public class MapInfoLayer extends OsmandMapLayer {
|
||||||
if(v != null) {
|
if(v != null) {
|
||||||
v.setBackgroundResource(reg.left ? ts.leftRes : ts.rightRes);
|
v.setBackgroundResource(reg.left ? ts.leftRes : ts.rightRes);
|
||||||
reg.widget.updateTextColor(ts.textColor, ts.textShadowColor, ts.textBold, ts.textShadowRadius);
|
reg.widget.updateTextColor(ts.textColor, ts.textShadowColor, ts.textBold, ts.textShadowRadius);
|
||||||
|
reg.widget.updateIconMode(ts.night);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,6 +213,7 @@ public class MapInfoLayer extends OsmandMapLayer {
|
||||||
boolean following = routeLayer.getHelper().isFollowingMode();
|
boolean following = routeLayer.getHelper().isFollowingMode();
|
||||||
TextState ts = new TextState();
|
TextState ts = new TextState();
|
||||||
ts.textBold = following;
|
ts.textBold = following;
|
||||||
|
ts.night = nightMode;
|
||||||
ts.textColor = nightMode ? view.getResources().getColor(R.color.widgettext_night) : Color.BLACK;
|
ts.textColor = nightMode ? view.getResources().getColor(R.color.widgettext_night) : Color.BLACK;
|
||||||
// Night shadowColor always use widgettext_shadow_night, same as widget background color for non-transparent
|
// Night shadowColor always use widgettext_shadow_night, same as widget background color for non-transparent
|
||||||
// night skin (from box_night_free_simple.9.png)
|
// night skin (from box_night_free_simple.9.png)
|
||||||
|
|
|
@ -105,19 +105,20 @@ public class PointLocationLayer extends OsmandMapLayer {
|
||||||
if (isLocationVisible(box, lastKnownLocation)) {
|
if (isLocationVisible(box, lastKnownLocation)) {
|
||||||
checkAppMode(view.getSettings().getApplicationMode());
|
checkAppMode(view.getSettings().getApplicationMode());
|
||||||
boolean isBearing = lastKnownLocation.hasBearing();
|
boolean isBearing = lastKnownLocation.hasBearing();
|
||||||
if (!isBearing) {
|
|
||||||
canvas.drawBitmap(locationIcon, locationX - locationIcon.getWidth() / 2, locationY - locationIcon.getHeight() / 2,
|
|
||||||
locationPaint);
|
|
||||||
}
|
|
||||||
Float heading = locationProvider.getHeading();
|
Float heading = locationProvider.getHeading();
|
||||||
if (heading != null && mapViewTrackingUtilities.isShowViewAngle()) {
|
if (heading != null && mapViewTrackingUtilities.isShowViewAngle()) {
|
||||||
canvas.drawArc(getHeadingRect(locationX, locationY), heading - HEADING_ANGLE / 2 - 90, HEADING_ANGLE, true, headingPaint);
|
canvas.drawArc(getHeadingRect(locationX, locationY), heading - HEADING_ANGLE / 2 - 90, HEADING_ANGLE,
|
||||||
|
true, headingPaint);
|
||||||
}
|
}
|
||||||
if (isBearing) {
|
if (isBearing) {
|
||||||
float bearing = lastKnownLocation.getBearing();
|
float bearing = lastKnownLocation.getBearing();
|
||||||
canvas.rotate(bearing - 90, locationX, locationY);
|
canvas.rotate(bearing - 90, locationX, locationY);
|
||||||
canvas.drawBitmap(bearingIcon, locationX - bearingIcon.getWidth() / 2, locationY - bearingIcon.getHeight() / 2,
|
canvas.drawBitmap(bearingIcon, locationX - bearingIcon.getWidth() / 2,
|
||||||
locationPaint);
|
locationY - bearingIcon.getHeight() / 2, locationPaint);
|
||||||
|
} else {
|
||||||
|
canvas.drawBitmap(locationIcon, locationX - locationIcon.getWidth() / 2,
|
||||||
|
locationY - locationIcon.getHeight() / 2, locationPaint);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class MapInfoWidgetsFactory {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
altitudeControl.setText(null, null);
|
altitudeControl.setText(null, null);
|
||||||
altitudeControl.setImageDrawable(R.drawable.widget_altitude);
|
altitudeControl.setIcons(R.drawable.widget_altitude_day, R.drawable.widget_altitude_night);
|
||||||
return altitudeControl;
|
return altitudeControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ public class MapInfoWidgetsFactory {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
gpsInfoControl.setImageDrawable(R.drawable.widget_gps_info);
|
gpsInfoControl.setIcons(R.drawable.widget_gps_info_day, R.drawable.widget_gps_info_night);
|
||||||
gpsInfoControl.setText(null, null);
|
gpsInfoControl.setText(null, null);
|
||||||
gpsInfoControl.setOnClickListener(new View.OnClickListener() {
|
gpsInfoControl.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -89,9 +89,9 @@ public class MapWidgetRegistry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public MapWidgetRegInfo registerSideWidgetInternal(TextInfoWidget widget, int drawableMenu, int drawableMap,
|
public MapWidgetRegInfo registerSideWidgetInternal(TextInfoWidget widget, int drawableMenu,
|
||||||
int messageId, String key, boolean left, int priorityOrder) {
|
int messageId, String key, boolean left, int priorityOrder) {
|
||||||
MapWidgetRegInfo ii = new MapWidgetRegInfo(key, widget, drawableMenu, drawableMap,
|
MapWidgetRegInfo ii = new MapWidgetRegInfo(key, widget, drawableMenu,
|
||||||
messageId, priorityOrder, left);
|
messageId, priorityOrder, left);
|
||||||
for (ApplicationMode ms : ApplicationMode.values(settings)) {
|
for (ApplicationMode ms : ApplicationMode.values(settings)) {
|
||||||
boolean collapse = ms.isWidgetCollapsible(key);
|
boolean collapse = ms.isWidgetCollapsible(key);
|
||||||
|
@ -309,7 +309,6 @@ public class MapWidgetRegistry {
|
||||||
public static class MapWidgetRegInfo implements Comparable<MapWidgetRegInfo> {
|
public static class MapWidgetRegInfo implements Comparable<MapWidgetRegInfo> {
|
||||||
public final TextInfoWidget widget;
|
public final TextInfoWidget widget;
|
||||||
public final int drawableMenu;
|
public final int drawableMenu;
|
||||||
public final int drawableMap;
|
|
||||||
public final int messageId;
|
public final int messageId;
|
||||||
public final String key;
|
public final String key;
|
||||||
public final boolean left;
|
public final boolean left;
|
||||||
|
@ -319,12 +318,10 @@ public class MapWidgetRegistry {
|
||||||
private Runnable stateChangeListener = null;
|
private Runnable stateChangeListener = null;
|
||||||
|
|
||||||
public MapWidgetRegInfo(String key, TextInfoWidget widget, int drawableMenu,
|
public MapWidgetRegInfo(String key, TextInfoWidget widget, int drawableMenu,
|
||||||
int drawableMap, int messageId, int priorityOrder,
|
int messageId, int priorityOrder, boolean left) {
|
||||||
boolean left) {
|
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.widget = widget;
|
this.widget = widget;
|
||||||
this.drawableMenu = drawableMenu;
|
this.drawableMenu = drawableMenu;
|
||||||
this.drawableMap = drawableMap;
|
|
||||||
this.messageId = messageId;
|
this.messageId = messageId;
|
||||||
this.priorityOrder = priorityOrder;
|
this.priorityOrder = priorityOrder;
|
||||||
this.left = left;
|
this.left = left;
|
||||||
|
|
|
@ -196,8 +196,10 @@ public class RouteInfoWidgetsFactory {
|
||||||
|
|
||||||
public TextInfoWidget createTimeControl(final MapActivity map){
|
public TextInfoWidget createTimeControl(final MapActivity map){
|
||||||
final RoutingHelper routingHelper = map.getRoutingHelper();
|
final RoutingHelper routingHelper = map.getRoutingHelper();
|
||||||
final int time = R.drawable.widget_time;
|
final int time = R.drawable.widget_time_day;
|
||||||
final int timeToGo = R.drawable.widget_time_to_distance;
|
final int timeN = R.drawable.widget_time_night;
|
||||||
|
final int timeToGo = R.drawable.widget_time_to_distance_day;
|
||||||
|
final int timeToGoN = R.drawable.widget_time_to_distance_night;
|
||||||
final OsmandApplication ctx = map.getMyApplication();
|
final OsmandApplication ctx = map.getMyApplication();
|
||||||
final OsmandPreference<Boolean> showArrival = ctx.getSettings().SHOW_ARRIVAL_TIME_OTHERWISE_EXPECTED_TIME;
|
final OsmandPreference<Boolean> showArrival = ctx.getSettings().SHOW_ARRIVAL_TIME_OTHERWISE_EXPECTED_TIME;
|
||||||
final TextInfoWidget leftTimeControl = new TextInfoWidget(map) {
|
final TextInfoWidget leftTimeControl = new TextInfoWidget(map) {
|
||||||
|
@ -248,13 +250,15 @@ public class RouteInfoWidgetsFactory {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
showArrival.set(!showArrival.get());
|
showArrival.set(!showArrival.get());
|
||||||
leftTimeControl.setImageDrawable(showArrival.get()? time : timeToGo);
|
leftTimeControl.setIcons(showArrival.get() ? time : timeToGo,
|
||||||
|
showArrival.get() ? timeN : timeToGoN);
|
||||||
map.getMapView().refreshMap();
|
map.getMapView().refreshMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
leftTimeControl.setText(null, null);
|
leftTimeControl.setText(null, null);
|
||||||
leftTimeControl.setImageDrawable(showArrival.get()? time : timeToGo);
|
leftTimeControl.setIcons(showArrival.get() ? time : timeToGo,
|
||||||
|
showArrival.get() ? timeN : timeToGoN);
|
||||||
return leftTimeControl;
|
return leftTimeControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +284,7 @@ public class RouteInfoWidgetsFactory {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
plainTimeControl.setText(null, null);
|
plainTimeControl.setText(null, null);
|
||||||
plainTimeControl.setImageDrawable(R.drawable.widget_time_to_distance);
|
plainTimeControl.setIcons(R.drawable.widget_time_to_distance_day, R.drawable.widget_time_to_distance_night);
|
||||||
return plainTimeControl;
|
return plainTimeControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,7 +327,7 @@ public class RouteInfoWidgetsFactory {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
speedControl.setImageDrawable(R.drawable.widget_max_speed);
|
speedControl.setIcons(R.drawable.widget_max_speed_day, R.drawable.widget_max_speed_night);
|
||||||
speedControl.setText(null, null);
|
speedControl.setText(null, null);
|
||||||
return speedControl;
|
return speedControl;
|
||||||
}
|
}
|
||||||
|
@ -367,7 +371,7 @@ public class RouteInfoWidgetsFactory {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
speedControl.setImageDrawable(R.drawable.widget_speed);
|
speedControl.setIcons(R.drawable.widget_speed_day, R.drawable.widget_speed_night);
|
||||||
speedControl.setText(null, null);
|
speedControl.setText(null, null);
|
||||||
return speedControl;
|
return speedControl;
|
||||||
}
|
}
|
||||||
|
@ -378,10 +382,10 @@ public class RouteInfoWidgetsFactory {
|
||||||
private float[] calculations = new float[1];
|
private float[] calculations = new float[1];
|
||||||
private int cachedMeters;
|
private int cachedMeters;
|
||||||
|
|
||||||
public DistanceToPointInfoControl(MapActivity ma, int res) {
|
public DistanceToPointInfoControl(MapActivity ma, int res, int resNight) {
|
||||||
super(ma);
|
super(ma);
|
||||||
this.view = ma.getMapView();
|
this.view = ma.getMapView();
|
||||||
setImageDrawable(res);
|
setIcons(res, resNight);
|
||||||
setText(null, null);
|
setText(null, null);
|
||||||
setOnClickListener(new View.OnClickListener() {
|
setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
||||||
|
@ -437,7 +441,8 @@ public class RouteInfoWidgetsFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextInfoWidget createDistanceControl(final MapActivity map) {
|
public TextInfoWidget createDistanceControl(final MapActivity map) {
|
||||||
DistanceToPointInfoControl distanceControl = new DistanceToPointInfoControl(map,R.drawable.widget_target) {
|
DistanceToPointInfoControl distanceControl = new DistanceToPointInfoControl(map,R.drawable.widget_target_day,
|
||||||
|
R.drawable.widget_target_night) {
|
||||||
@Override
|
@Override
|
||||||
public LatLon getPointToNavigate() {
|
public LatLon getPointToNavigate() {
|
||||||
TargetPoint p = map.getPointToNavigate();
|
TargetPoint p = map.getPointToNavigate();
|
||||||
|
@ -457,7 +462,8 @@ public class RouteInfoWidgetsFactory {
|
||||||
|
|
||||||
public TextInfoWidget createIntermediateDistanceControl(final MapActivity map) {
|
public TextInfoWidget createIntermediateDistanceControl(final MapActivity map) {
|
||||||
final TargetPointsHelper targets = map.getMyApplication().getTargetPointsHelper();
|
final TargetPointsHelper targets = map.getMyApplication().getTargetPointsHelper();
|
||||||
DistanceToPointInfoControl distanceControl = new DistanceToPointInfoControl(map, R.drawable.widget_intermediate) {
|
DistanceToPointInfoControl distanceControl = new DistanceToPointInfoControl(map, R.drawable.widget_intermediate_day,
|
||||||
|
R.drawable.widget_intermediate_night) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void click(OsmandMapTileView view) {
|
protected void click(OsmandMapTileView view) {
|
||||||
|
|
|
@ -23,6 +23,9 @@ public class TextInfoWidget {
|
||||||
private boolean explicitlyVisible;
|
private boolean explicitlyVisible;
|
||||||
private OsmandApplication app;
|
private OsmandApplication app;
|
||||||
|
|
||||||
|
private int dayIcon;
|
||||||
|
private int nightIcon;
|
||||||
|
private boolean isNight;
|
||||||
|
|
||||||
|
|
||||||
public TextInfoWidget(Activity activity) {
|
public TextInfoWidget(Activity activity) {
|
||||||
|
@ -72,6 +75,12 @@ public class TextInfoWidget {
|
||||||
topImageView.invalidate();
|
topImageView.invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIcons(int widgetDayIcon, int widgetNightIcon) {
|
||||||
|
dayIcon = widgetDayIcon;
|
||||||
|
nightIcon = widgetNightIcon;
|
||||||
|
setImageDrawable(!isNight ? dayIcon : nightIcon);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -155,6 +164,13 @@ public class TextInfoWidget {
|
||||||
return explicitlyVisible;
|
return explicitlyVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateIconMode(boolean night) {
|
||||||
|
isNight = night;
|
||||||
|
if(dayIcon != 0) {
|
||||||
|
setImageDrawable(!night? dayIcon : nightIcon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void updateTextColor(int textColor, int textShadowColor, boolean bold, int rad) {
|
public void updateTextColor(int textColor, int textShadowColor, boolean bold, int rad) {
|
||||||
updateTextColor(smallTextView, textColor, textShadowColor, bold, rad);
|
updateTextColor(smallTextView, textColor, textShadowColor, bold, rad);
|
||||||
updateTextColor(textView, textColor, textShadowColor, bold, rad);
|
updateTextColor(textView, textColor, textShadowColor, bold, rad);
|
||||||
|
@ -169,4 +185,6 @@ public class TextInfoWidget {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue