From 299cba2b3f359d28f07b666c6512ab7818b8f325 Mon Sep 17 00:00:00 2001 From: Denis Date: Tue, 21 Oct 2014 15:24:03 +0300 Subject: [PATCH] map settings dialog moved to drawer. Added possibility to set light and dark icon for map widgets Conflicts: OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java --- .../res/layout/layers_list_activity_item.xml | 6 +- .../net/osmand/plus/ContextMenuAdapter.java | 2 +- .../plus/activities/MapActivityActions.java | 13 ++- .../audionotes/AudioVideoNotesPlugin.java | 2 +- .../development/OsmandDevelopmentPlugin.java | 2 +- .../DistanceCalculatorPlugin.java | 2 +- .../monitoring/OsmandMonitoringPlugin.java | 2 +- .../src/net/osmand/plus/osmo/OsMoPlugin.java | 2 +- .../parkingpoint/ParkingPositionPlugin.java | 2 +- .../RoutePointsPlugin.java | 2 +- .../net/osmand/plus/views/MapInfoLayer.java | 79 ++++++++++--------- .../mapwidgets/AppearanceWidgetsFactory.java | 8 +- .../views/mapwidgets/MapWidgetRegistry.java | 23 +++--- 13 files changed, 81 insertions(+), 64 deletions(-) diff --git a/OsmAnd/res/layout/layers_list_activity_item.xml b/OsmAnd/res/layout/layers_list_activity_item.xml index e40c4ae2fd..edc2905ea3 100644 --- a/OsmAnd/res/layout/layers_list_activity_item.xml +++ b/OsmAnd/res/layout/layers_list_activity_item.xml @@ -5,8 +5,7 @@ android:layout_height="wrap_content" android:orientation="horizontal" android:layout_marginLeft="5dip" - android:layout_marginRight="5dip" - android:background="@color/color_white"> + android:layout_marginRight="5dip"> + android:layout_weight="1"/> @@ -27,7 +26,6 @@ android:id="@+id/check_item" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:button="@drawable/ic_btn_wocheckbox" android:focusable="false" android:gravity="center_vertical" /> diff --git a/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java b/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java index c4e86e7ef5..9047783537 100644 --- a/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java +++ b/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java @@ -244,7 +244,7 @@ public class ContextMenuAdapter { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { OnContextMenuClick ca = getClickAdapter(position); if(ca != null) { - ca.onContextMenuClick((int) getItemId(position), position, isChecked); + ca.onContextMenuClick(position, position, isChecked); } } }); diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index f3a46cc4d4..1bda8b4b8f 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -314,6 +314,13 @@ public class MapActivityActions implements DialogProvider { enhance(dialogBundle,latitude,longitude, name); mapActivity.showDialog(DIALOG_ADD_WAYPOINT); } + + public void openViewConfigureDrawer(){ + if (!mDrawerLayout.isDrawerOpen(mDrawerList)){ + mDrawerLayout.openDrawer(mDrawerList); + } + mapActivity.getMapLayers().getMapInfoLayer().openViewConfigureDrawer(mDrawerList); + } private Dialog createAddWaypointDialog(final Bundle args) { Builder builder = new AlertDialog.Builder(mapActivity); @@ -763,7 +770,7 @@ public class MapActivityActions implements DialogProvider { public void onItemClick(AdapterView parent, View view, int which, long id) { OnContextMenuClick click = cm.getClickAdapter(which); if (click != null) { - if (click.onContextMenuClick(cm.getItemId(which), which, false)){ + if (click.onContextMenuClick(cm.getItemId(which), which, false)) { mDrawerLayout.closeDrawer(mDrawerList); } } else { @@ -916,8 +923,8 @@ public class MapActivityActions implements DialogProvider { .listen(new OnContextMenuClick() { @Override public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) { - mapActivity.getMapLayers().getMapInfoLayer().openViewConfigureDialog(); - return true; + mapActivity.getMapLayers().getMapInfoLayer().openViewConfigureDrawer(mDrawerList); + return false; } }).reg(); diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java index 4d008fb5cf..3a23c4dbda 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java @@ -477,7 +477,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { recordControl = new TextInfoWidget(activity, 0, mapInfoLayer.getPaintText(), mapInfoLayer.getPaintSubText()); recordControl.setImageDrawable(activity.getResources().getDrawable(R.drawable.monitoring_rec_inactive)); setRecordListener(recordControl, activity); - mapInfoLayer.getMapInfoControls().registerSideWidget(recordControl, R.drawable.widget_icon_av_inactive, + mapInfoLayer.getMapInfoControls().registerSideWidget(recordControl, R.drawable.widget_icon_av_inactive, R.drawable.widget_icon_av_inactive, R.string.map_widget_av_notes, "audionotes", false, 22); mapInfoLayer.recreateControls(); } diff --git a/OsmAnd/src/net/osmand/plus/development/OsmandDevelopmentPlugin.java b/OsmAnd/src/net/osmand/plus/development/OsmandDevelopmentPlugin.java index 92a7cbd813..04ee209a04 100644 --- a/OsmAnd/src/net/osmand/plus/development/OsmandDevelopmentPlugin.java +++ b/OsmAnd/src/net/osmand/plus/development/OsmandDevelopmentPlugin.java @@ -64,7 +64,7 @@ public class OsmandDevelopmentPlugin extends OsmandPlugin { return true; } }; - mapInfoLayer.getMapInfoControls().registerSideWidget(fps, R.drawable.widget_no_icon, + mapInfoLayer.getMapInfoControls().registerSideWidget(fps, R.drawable.widget_no_icon, R.drawable.widget_no_icon, R.string.map_widget_fps_info, "fps", false, 30); mapInfoLayer.recreateControls(); } diff --git a/OsmAnd/src/net/osmand/plus/distancecalculator/DistanceCalculatorPlugin.java b/OsmAnd/src/net/osmand/plus/distancecalculator/DistanceCalculatorPlugin.java index 79a05aaf72..1c48480c18 100644 --- a/OsmAnd/src/net/osmand/plus/distancecalculator/DistanceCalculatorPlugin.java +++ b/OsmAnd/src/net/osmand/plus/distancecalculator/DistanceCalculatorPlugin.java @@ -115,7 +115,7 @@ public class DistanceCalculatorPlugin extends OsmandPlugin { if (mapInfoLayer != null ) { distanceControl = createDistanceControl(activity, mapInfoLayer.getPaintText(), mapInfoLayer.getPaintSubText()); mapInfoLayer.getMapInfoControls().registerSideWidget(distanceControl, - R.drawable.widget_distance, R.string.map_widget_distancemeasurement, "distance.measurement", false, 21); + R.drawable.widget_distance, R.drawable.widget_distance, R.string.map_widget_distancemeasurement, "distance.measurement", false, 21); mapInfoLayer.recreateControls(); updateText(); } diff --git a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java index 652a7210e4..c8d853f36f 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java @@ -95,7 +95,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn monitoringControl = createMonitoringControl(activity, layer.getPaintText(), layer.getPaintSubText()); layer.getMapInfoControls().registerSideWidget(monitoringControl, - R.drawable.monitoring_rec_big, R.string.map_widget_monitoring, "monitoring", false, 18); + R.drawable.monitoring_rec_big, R.drawable.monitoring_rec_big, R.string.map_widget_monitoring, "monitoring", false, 18); layer.recreateControls(); } diff --git a/OsmAnd/src/net/osmand/plus/osmo/OsMoPlugin.java b/OsmAnd/src/net/osmand/plus/osmo/OsMoPlugin.java index 03801fdc3c..b6f38c51c6 100644 --- a/OsmAnd/src/net/osmand/plus/osmo/OsMoPlugin.java +++ b/OsmAnd/src/net/osmand/plus/osmo/OsMoPlugin.java @@ -181,7 +181,7 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer MapInfoLayer layer = activity.getMapLayers().getMapInfoLayer(); osmoControl = createOsMoControl(activity, layer.getPaintText(), layer.getPaintSubText()); layer.getMapInfoControls().registerSideWidget(osmoControl, - R.drawable.mon_osmo_signal_inactive, R.string.osmo_control, "osmo_control", false, 18); + R.drawable.mon_osmo_signal_inactive, R.drawable.mon_osmo_signal_inactive, R.string.osmo_control, "osmo_control", false, 18); layer.recreateControls(); if(olayer != null) { diff --git a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java index 62edd4fdef..fbe6d72d11 100644 --- a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java +++ b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java @@ -188,7 +188,7 @@ public class ParkingPositionPlugin extends OsmandPlugin { if (mapInfoLayer != null) { parkingPlaceControl = createParkingPlaceInfoControl(activity, mapInfoLayer.getPaintText(), mapInfoLayer.getPaintSubText()); mapInfoLayer.getMapInfoControls().registerSideWidget(parkingPlaceControl, - R.drawable.widget_parking, R.string.map_widget_parking, "parking", false, 8); + R.drawable.widget_parking, R.drawable.widget_parking, R.string.map_widget_parking, "parking", false, 8); mapInfoLayer.recreateControls(); } } diff --git a/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsPlugin.java b/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsPlugin.java index 421222b8c5..d12a227cd9 100644 --- a/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsPlugin.java +++ b/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsPlugin.java @@ -177,7 +177,7 @@ public class RoutePointsPlugin extends OsmandPlugin { if (mapInfoLayer != null) { routeStepsControl = createRouteStepsInfoControl(activity, mapInfoLayer.getPaintText(), mapInfoLayer.getPaintSubText()); mapInfoLayer.getMapInfoControls().registerSideWidget(routeStepsControl, - R.drawable.widget_signpost, R.string.map_widget_route_points, "route_steps", false, 8); + R.drawable.widget_signpost, R.drawable.widget_signpost, R.string.map_widget_route_points, "route_steps", false, 8); mapInfoLayer.recreateControls(); } } diff --git a/OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java b/OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java index 8cdcc82aec..d80215e6e1 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java @@ -27,8 +27,6 @@ import net.osmand.plus.views.mapwidgets.StackWidgetView; import net.osmand.plus.views.mapwidgets.TextInfoWidget; import net.osmand.plus.views.mapwidgets.UpdateableWidget; import net.osmand.util.Algorithms; -import android.app.AlertDialog; -import android.app.AlertDialog.Builder; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; @@ -172,51 +170,51 @@ public class MapInfoLayer extends OsmandMapLayer { RoutingHelper routingHelper = app.getRoutingHelper(); NextTurnInfoWidget bigInfoControl = ric.createNextInfoControl(routingHelper, app, view.getSettings(), paintText, paintSubText, false); - mapInfoControls.registerSideWidget(bigInfoControl, R.drawable.widget_next_turn, R.string.map_widget_next_turn,"next_turn", true, 5); + mapInfoControls.registerSideWidget(bigInfoControl, R.drawable.widget_next_turn, R.drawable.widget_next_turn, R.string.map_widget_next_turn,"next_turn", true, 5); NextTurnInfoWidget smallInfoControl = ric.createNextInfoControl(routingHelper, app, view.getSettings(), paintSmallText, paintSmallSubText, true); - mapInfoControls.registerSideWidget(smallInfoControl, R.drawable.widget_next_turn, R.string.map_widget_next_turn_small, "next_turn_small", true, + mapInfoControls.registerSideWidget(smallInfoControl, R.drawable.widget_next_turn, R.drawable.widget_next_turn, R.string.map_widget_next_turn_small, "next_turn_small", true, 10); NextTurnInfoWidget nextNextInfoControl = ric.createNextNextInfoControl(routingHelper, app, view.getSettings(), paintSmallText, paintSmallSubText, true); - mapInfoControls.registerSideWidget(nextNextInfoControl, R.drawable.widget_next_turn, R.string.map_widget_next_next_turn, "next_next_turn",true, 15); + mapInfoControls.registerSideWidget(nextNextInfoControl, R.drawable.widget_next_turn, R.drawable.widget_next_turn, R.string.map_widget_next_next_turn, "next_next_turn",true, 15); //MiniMapControl miniMap = ric.createMiniMapControl(routingHelper, view); //mapInfoControls.registerSideWidget(miniMap, R.drawable.widget_next_turn, R.string.map_widget_mini_route, "mini_route", true, none, none, 20); // right stack TextInfoWidget intermediateDist = ric.createIntermediateDistanceControl(map, paintText, paintSubText); - mapInfoControls.registerSideWidget(intermediateDist, R.drawable.widget_intermediate, R.string.map_widget_intermediate_distance, "intermediate_distance", false, 3); + mapInfoControls.registerSideWidget(intermediateDist, R.drawable.widget_intermediate, R.drawable.widget_intermediate, R.string.map_widget_intermediate_distance, "intermediate_distance", false, 3); TextInfoWidget dist = ric.createDistanceControl(map, paintText, paintSubText); - mapInfoControls.registerSideWidget(dist, R.drawable.widget_target, R.string.map_widget_distance, "distance", false, 5); + mapInfoControls.registerSideWidget(dist, R.drawable.widget_target, R.drawable.widget_target, R.string.map_widget_distance, "distance", false, 5); TextInfoWidget time = ric.createTimeControl(map, paintText, paintSubText); - mapInfoControls.registerSideWidget(time, R.drawable.widget_time, R.string.map_widget_time, "time", false, 10); + mapInfoControls.registerSideWidget(time, R.drawable.widget_time, R.drawable.widget_time, R.string.map_widget_time, "time", false, 10); TextInfoWidget speed = ric.createSpeedControl(map, paintText, paintSubText); - mapInfoControls.registerSideWidget(speed, R.drawable.widget_speed, R.string.map_widget_speed, "speed", false, 15); + mapInfoControls.registerSideWidget(speed, R.drawable.widget_speed, R.drawable.widget_speed, R.string.map_widget_speed, "speed", false, 15); TextInfoWidget gpsInfo = mic.createGPSInfoControl(map, paintText, paintSubText); - mapInfoControls.registerSideWidget(gpsInfo, R.drawable.widget_gps_info, R.string.map_widget_gps_info, "gps_info", false, 17); + mapInfoControls.registerSideWidget(gpsInfo, R.drawable.widget_gps_info, R.drawable.widget_gps_info, R.string.map_widget_gps_info, "gps_info", false, 17); TextInfoWidget maxspeed = ric.createMaxSpeedControl(map, paintText, paintSubText); - mapInfoControls.registerSideWidget(maxspeed, R.drawable.widget_max_speed, R.string.map_widget_max_speed, "max_speed", false, 18); + mapInfoControls.registerSideWidget(maxspeed, R.drawable.widget_max_speed, R.drawable.widget_max_speed, R.string.map_widget_max_speed, "max_speed", false, 18); TextInfoWidget alt = mic.createAltitudeControl(map, paintText, paintSubText); - mapInfoControls.registerSideWidget(alt, R.drawable.widget_altitude, R.string.map_widget_altitude, "altitude", false, 20); + mapInfoControls.registerSideWidget(alt, R.drawable.widget_altitude, R.drawable.widget_altitude, R.string.map_widget_altitude, "altitude", false, 20); TextInfoWidget plainTime = ric.createPlainTimeControl(map, paintText, paintSubText); - mapInfoControls.registerSideWidget(plainTime, R.drawable.widget_time_to_distance, R.string.map_widget_plain_time, "plain_time", false, 25); + mapInfoControls.registerSideWidget(plainTime, R.drawable.widget_time_to_distance, R.drawable.widget_time_to_distance, R.string.map_widget_plain_time, "plain_time", false, 25); // Top widgets ImageViewWidget compassView = mic.createCompassView(map); - mapInfoControls.registerTopWidget(compassView, R.drawable.widget_compass, R.string.map_widget_compass, "compass", MapWidgetRegistry.LEFT_CONTROL, 5); + mapInfoControls.registerTopWidget(compassView, R.drawable.widget_compass, R.drawable.widget_compass, R.string.map_widget_compass, "compass", MapWidgetRegistry.LEFT_CONTROL, 5); View config = createConfiguration(); - mapInfoControls.registerTopWidget(config, R.drawable.widget_config, R.string.map_widget_config, "config", MapWidgetRegistry.RIGHT_CONTROL, 10); + mapInfoControls.registerTopWidget(config, R.drawable.widget_config, R.drawable.widget_config, R.string.map_widget_config, "config", MapWidgetRegistry.RIGHT_CONTROL, 10); // disable monitoring widget // mapInfoControls.registerTopWidget(monitoringServices.createMonitoringWidget(view, map), R.drawable.widget_monitoring, R.string.map_widget_monitoring_services, // "monitoring_services", MapWidgetRegistry.LEFT_CONTROL, 12); - mapInfoControls.registerTopWidget(mic.createLockInfo(map), R.drawable.widget_lock_screen, R.string.bg_service_screen_lock, "bgService", + mapInfoControls.registerTopWidget(mic.createLockInfo(map), R.drawable.widget_lock_screen, R.drawable.widget_lock_screen, R.string.bg_service_screen_lock, "bgService", MapWidgetRegistry.LEFT_CONTROL, 15); - mapInfoControls.registerTopWidget(createBackToLocation(mic), R.drawable.widget_backtolocation, R.string.map_widget_back_to_loc, "back_to_location", MapWidgetRegistry.RIGHT_CONTROL, 5); + mapInfoControls.registerTopWidget(createBackToLocation(mic), R.drawable.widget_backtolocation, R.drawable.widget_backtolocation, R.string.map_widget_back_to_loc, "back_to_location", MapWidgetRegistry.RIGHT_CONTROL, 5); View globus = createLayer(); - mapInfoControls.registerTopWidget(globus, R.drawable.widget_layer, R.string.menu_layers, "layers", MapWidgetRegistry.RIGHT_CONTROL, 15); + mapInfoControls.registerTopWidget(globus, R.drawable.widget_layer, R.drawable.widget_layer, R.string.menu_layers, "layers", MapWidgetRegistry.RIGHT_CONTROL, 15); topText = mic.createStreetView(app, map, paintText); - mapInfoControls.registerTopWidget(topText, R.drawable.street_name, R.string.map_widget_top_text, + mapInfoControls.registerTopWidget(topText, R.drawable.street_name, R.drawable.street_name, R.string.map_widget_top_text, "street_name", MapWidgetRegistry.MAIN_CONTROL, 100); // Register appearance widgets @@ -324,10 +322,11 @@ public class MapInfoLayer extends OsmandMapLayer { } } - public void openViewConfigureDialog() { + public void openViewConfigureDrawer(ListView listView) { final OsmandSettings settings = view.getSettings(); final ArrayList list = new ArrayList(); + list.add(map.getString(R.string.layer_map_appearance)); list.add(map.getString(R.string.map_widget_reset)); list.add(map.getString(R.string.map_widget_top_stack)); list.addAll(mapInfoControls.getTop()); @@ -368,10 +367,17 @@ public class MapInfoLayer extends OsmandMapLayer { } else { tv.setText(s +map.getString(mi.messageId) +s); } + + int drawable = 0; + if (map.getMyApplication().getSettings().isLightContent()){ + drawable = mi.drawableLight; + } else { + drawable = mi.drawableDark; + } // Put the image on the TextView - if (mi.drawable != 0) { + if (drawable != 0) { tv.setPadding((int) (12 *scaleCoefficient), 0, 0, 0); - tv.setCompoundDrawablesWithIntrinsicBounds(mi.drawable, 0, 0, 0); + tv.setCompoundDrawablesWithIntrinsicBounds(drawable, 0, 0, 0); } else { tv.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); tv.setPadding((int) (30 *scaleCoefficient), 0, 0, 0); @@ -406,6 +412,12 @@ public class MapInfoLayer extends OsmandMapLayer { tv.setPadding((int) (5 *scaleCoefficient), 0, 0, 0); // reset if (position == 0) { + if (map.getMyApplication().getSettings().isLightContent()){ + tv.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_back_drawer_white, 0, 0, 0); + } else { + tv.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_back_drawer_dark, 0, 0, 0); + } + } else if (position == 1) { tv.setCompoundDrawablesWithIntrinsicBounds(R.drawable.widget_reset_to_default, 0, 0, 0); } else { tv.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); @@ -416,10 +428,8 @@ public class MapInfoLayer extends OsmandMapLayer { return v; } }; - Builder b = new AlertDialog.Builder(map); View confirmDialog = View.inflate(view.getContext(), R.layout.configuration_dialog, null); - final ListView lv = (ListView) confirmDialog.findViewById(android.R.id.list); - AppModeDialog.prepareAppModeView(map, selected, true, + AppModeDialog.prepareAppModeView(map, selected, true, (ViewGroup) confirmDialog.findViewById(R.id.TopBar), true, new View.OnClickListener() { @Override @@ -430,9 +440,9 @@ public class MapInfoLayer extends OsmandMapLayer { } } }); - - - lv.setOnItemClickListener(new OnItemClickListener() { + + + listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView parent, View view, int position, long id) { @@ -448,18 +458,15 @@ public class MapInfoLayer extends OsmandMapLayer { recreateControls(); listAdapter.notifyDataSetInvalidated(); } else if(position == 0) { + map.getMapActions().prepareStartOptionsMenu(); + } else if (position == 1) { mapInfoControls.resetToDefault(); recreateControls(); listAdapter.notifyDataSetInvalidated(); - } + } } }); - lv.setAdapter(listAdapter); - b.setView(confirmDialog); - final AlertDialog dlg = b.create(); - // listener.setDialog(dlg); - dlg.setCanceledOnTouchOutside(true); - dlg.show(); + listView.setAdapter(listAdapter); } private int themeId = -1; @@ -610,7 +617,7 @@ public class MapInfoLayer extends OsmandMapLayer { configuration.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { - openViewConfigureDialog(); + map.getMapActions().openViewConfigureDrawer(); } }); configuration.setImageDrawable(config); diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/AppearanceWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/AppearanceWidgetsFactory.java index 12ca4b6d80..3e262ba06c 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/AppearanceWidgetsFactory.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/AppearanceWidgetsFactory.java @@ -26,7 +26,7 @@ public class AppearanceWidgetsFactory { // } // }); - final MapWidgetRegistry.MapWidgetRegInfo showRuler = mapInfoControls.registerAppearanceWidget(R.drawable.widget_ruler, R.string.map_widget_show_ruler, + final MapWidgetRegistry.MapWidgetRegInfo showRuler = mapInfoControls.registerAppearanceWidget(R.drawable.widget_ruler, R.drawable.widget_ruler, R.string.map_widget_show_ruler, "showRuler", view.getSettings().SHOW_RULER); showRuler.setStateChangeListener(new Runnable() { @Override @@ -35,7 +35,7 @@ public class AppearanceWidgetsFactory { view.refreshMap(); } }); - final MapWidgetRegistry.MapWidgetRegInfo showDestinationArrow = mapInfoControls.registerAppearanceWidget(R.drawable.widget_show_destination_arrow, R.string.map_widget_show_destination_arrow, + final MapWidgetRegistry.MapWidgetRegInfo showDestinationArrow = mapInfoControls.registerAppearanceWidget(R.drawable.widget_show_destination_arrow, R.drawable.widget_show_destination_arrow, R.string.map_widget_show_destination_arrow, "show_destination_arrow", view.getSettings().SHOW_DESTINATION_ARROW); showDestinationArrow.setStateChangeListener(new Runnable() { @Override @@ -45,7 +45,7 @@ public class AppearanceWidgetsFactory { } }); - final MapWidgetRegistry.MapWidgetRegInfo transparent = mapInfoControls.registerAppearanceWidget(R.drawable.widget_transparent_skin, R.string.map_widget_transparent, + final MapWidgetRegistry.MapWidgetRegInfo transparent = mapInfoControls.registerAppearanceWidget(R.drawable.widget_transparent_skin, R.drawable.widget_transparent_skin, R.string.map_widget_transparent, "transparent", view.getSettings().TRANSPARENT_MAP_THEME); transparent.setStateChangeListener(new Runnable() { @Override @@ -54,7 +54,7 @@ public class AppearanceWidgetsFactory { mapInfoLayer.recreateControls(); } }); - final MapWidgetRegistry.MapWidgetRegInfo centerPosition = mapInfoControls.registerAppearanceWidget(R.drawable.widget_position_marker, + final MapWidgetRegistry.MapWidgetRegInfo centerPosition = mapInfoControls.registerAppearanceWidget(R.drawable.widget_position_marker, R.drawable.widget_position_marker, R.string.always_center_position_on_map, "centerPosition", view.getSettings().CENTER_POSITION_ON_MAP); centerPosition.setStateChangeListener(new Runnable() { diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapWidgetRegistry.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapWidgetRegistry.java index 8db02dd5ff..e077ef0bdb 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapWidgetRegistry.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapWidgetRegistry.java @@ -62,14 +62,15 @@ public class MapWidgetRegistry { } - public MapWidgetRegInfo registerAppearanceWidget(int drawable, int messageId, String key, + public MapWidgetRegInfo registerAppearanceWidget(int drawableDark,int drawableLight, int messageId, String key, OsmandPreference pref) { MapWidgetRegInfo ii = new MapWidgetRegInfo(); ii.key = key; ii.preference = pref; ii.visibleModes = new LinkedHashSet(); ii.visibleCollapsible = null; - ii.drawable = drawable; + ii.drawableDark = drawableDark; + ii.drawableLight = drawableLight; ii.messageId = messageId; this.appearanceWidgets.add(ii); return ii; @@ -84,7 +85,7 @@ public class MapWidgetRegistry { } } - public MapWidgetRegInfo registerAppearanceWidget(int drawable, String message, String key, + public MapWidgetRegInfo registerAppearanceWidget(int drawableDark,int drawableLight, String message, String key, CommonPreference pref, String subcategory) { MapWidgetRegInfo ii = new MapWidgetRegInfo(); ii.key = key; @@ -92,14 +93,15 @@ public class MapWidgetRegistry { ii.preference = pref; ii.visibleModes = new LinkedHashSet(); ii.visibleCollapsible = null; - ii.drawable = drawable; + ii.drawableDark = drawableDark; + ii.drawableLight = drawableLight; ii.messageId = message.hashCode(); ii.message = message; this.appearanceWidgets.add(ii); return ii; } - public MapWidgetRegInfo registerTopWidget(View m, int drawable, int messageId, String key, int left, int priorityOrder) { + public MapWidgetRegInfo registerTopWidget(View m, int drawableDark,int drawableLight, int messageId, String key, int left, int priorityOrder) { MapWidgetRegInfo ii = new MapWidgetRegInfo(); ii.key = key; ii.visibleModes = new LinkedHashSet(); @@ -120,7 +122,8 @@ public class MapWidgetRegistry { } if (m != null) m.setContentDescription(m.getContext().getString(messageId)); - ii.drawable = drawable; + ii.drawableDark = drawableDark; + ii.drawableLight = drawableLight; ii.messageId = messageId; ii.m = m; ii.priorityOrder = priorityOrder; @@ -131,7 +134,7 @@ public class MapWidgetRegistry { - public void registerSideWidget(BaseMapWidget m, int drawable, int messageId, String key, boolean left, int priorityOrder) { + public void registerSideWidget(BaseMapWidget m, int drawableDark,int drawableLight, int messageId, String key, boolean left, int priorityOrder) { MapWidgetRegInfo ii = new MapWidgetRegInfo(); ii.key = key; ii.visibleModes = new LinkedHashSet(); @@ -160,7 +163,8 @@ public class MapWidgetRegistry { } if (m != null) m.setContentTitle(m.getContext().getString(messageId)); - ii.drawable = drawable; + ii.drawableDark = drawableDark; + ii.drawableLight = drawableLight; ii.messageId = messageId; ii.m = m; ii.priorityOrder = priorityOrder; @@ -311,7 +315,8 @@ public class MapWidgetRegistry { public static class MapWidgetRegInfo implements Comparable { public View m; - public int drawable; + public int drawableDark; + public int drawableLight; public int messageId; public String message; private String key;