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
This commit is contained in:
parent
eb7d572234
commit
299cba2b3f
13 changed files with 81 additions and 64 deletions
|
@ -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">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
|
@ -17,7 +16,7 @@
|
|||
android:gravity="center_vertical"
|
||||
android:text="@string/layer_poi"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/color_black" android:layout_weight="1"/>
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<LinearLayout android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent">
|
||||
|
@ -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" />
|
||||
</LinearLayout>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<Object> list = new ArrayList<Object>();
|
||||
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);
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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<ApplicationMode>();
|
||||
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<ApplicationMode>();
|
||||
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<ApplicationMode>();
|
||||
|
@ -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<ApplicationMode>();
|
||||
|
@ -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<MapWidgetRegInfo> {
|
||||
public View m;
|
||||
public int drawable;
|
||||
public int drawableDark;
|
||||
public int drawableLight;
|
||||
public int messageId;
|
||||
public String message;
|
||||
private String key;
|
||||
|
|
Loading…
Reference in a new issue