diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java index 66a7b8cda4..7849428077 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java @@ -28,6 +28,8 @@ import net.osmand.util.MapUtils; import net.osmand.plus.ApplicationMode; import net.osmand.plus.ContextMenuAdapter; import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick; +import net.osmand.plus.OsmandSettings.CommonPreference; +import net.osmand.plus.OsmandSettings.OsmandPreference; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandSettings; @@ -43,7 +45,6 @@ import net.osmand.plus.views.MapStackControl; import net.osmand.plus.views.OsmandMapTileView; import net.osmand.plus.views.TextInfoControl; import net.osmand.util.Algorithms; -import net.osmand.util.MapAlgorithms; import org.apache.commons.logging.Log; @@ -71,7 +72,6 @@ import android.preference.ListPreference; import android.preference.PreferenceGroup; import android.preference.PreferenceScreen; import android.provider.MediaStore; -import android.text.format.DateFormat; import android.view.Display; import android.view.KeyEvent; import android.view.Surface; @@ -95,6 +95,21 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { private OsmandApplication app; private TextInfoControl recordControl; + public final CommonPreference AV_EXTERNAL_RECORDER ; + public final CommonPreference AV_EXTERNAL_PHOTO_CAM ; + + public static final int VIDEO_OUTPUT_MP4 = 0; + public static final int VIDEO_OUTPUT_3GP = 1; + public final CommonPreference AV_VIDEO_FORMAT; + + public static final int AV_DEFAULT_ACTION_AUDIO = 0; + public static final int AV_DEFAULT_ACTION_VIDEO = 1; + public static final int AV_DEFAULT_ACTION_TAKEPICTURE = 2; + public final CommonPreference AV_DEFAULT_ACTION; + + public final OsmandPreference SHOW_RECORDINGS ; + + private DataTileManager recordings = new DataTileManager(14); private Map recordingByFileName = new LinkedHashMap(); @@ -292,7 +307,12 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { public AudioVideoNotesPlugin(OsmandApplication app) { this.app = app; - + OsmandSettings settings = app.getSettings(); + AV_EXTERNAL_RECORDER = settings.registerBooleanPreference("av_external_recorder", false).makeGlobal(); + AV_EXTERNAL_PHOTO_CAM = settings.registerBooleanPreference("av_external_cam", true).makeGlobal(); + AV_VIDEO_FORMAT = settings.registerIntPreference("av_video_format", VIDEO_OUTPUT_MP4).makeGlobal(); + AV_DEFAULT_ACTION = settings.registerIntPreference("av_default_action", AV_DEFAULT_ACTION_AUDIO).makeGlobal(); + SHOW_RECORDINGS = settings.registerBooleanPreference("show_recordings", true).makeGlobal(); } @Override @@ -365,12 +385,12 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) { if (itemId == R.string.layer_recordings) { dialog.dismiss(); - app.getSettings().SHOW_RECORDINGS.set(!app.getSettings().SHOW_RECORDINGS.get()); + SHOW_RECORDINGS.set(!SHOW_RECORDINGS.get()); updateLayers(mapView, mapActivity); } } }; - adapter.registerSelectedItem(R.string.layer_recordings, app.getSettings().SHOW_RECORDINGS.get()? 1 : 0, R.drawable.large_menu_recording_layer, listener, 5); + adapter.registerSelectedItem(R.string.layer_recordings, SHOW_RECORDINGS.get()? 1 : 0, R.drawable.large_menu_recording_layer, listener, 5); } @Override @@ -402,7 +422,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { @Override public void updateLayers(OsmandMapTileView mapView, MapActivity activity) { - if(app.getSettings().SHOW_RECORDINGS.get()) { + if(SHOW_RECORDINGS.get()) { if(audioNotesLayer == null) { registerLayers(activity); } else if(!mapView.getLayers().contains(audioNotesLayer)) { @@ -443,11 +463,11 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { private void updateWidgetIcon(final TextInfoControl recordPlaceControl) { recordPlaceControl.setImageDrawable(activity.getResources().getDrawable(R.drawable.widget_icon_av_inactive)); - if (app.getSettings().AV_DEFAULT_ACTION.get() == OsmandSettings.AV_DEFAULT_ACTION_VIDEO) { + if (AV_DEFAULT_ACTION.get() == AV_DEFAULT_ACTION_VIDEO) { recordPlaceControl.setImageDrawable(activity.getResources().getDrawable(R.drawable.widget_icon_video)); - } else if (app.getSettings().AV_DEFAULT_ACTION.get() == OsmandSettings.AV_DEFAULT_ACTION_TAKEPICTURE) { + } else if (AV_DEFAULT_ACTION.get() == AV_DEFAULT_ACTION_TAKEPICTURE) { recordPlaceControl.setImageDrawable(activity.getResources().getDrawable(R.drawable.widget_icon_photo)); - } else if (app.getSettings().AV_DEFAULT_ACTION.get() == OsmandSettings.AV_DEFAULT_ACTION_AUDIO) { + } else if (AV_DEFAULT_ACTION.get() == AV_DEFAULT_ACTION_AUDIO) { recordPlaceControl.setImageDrawable(activity.getResources().getDrawable(R.drawable.widget_icon_audio)); } } @@ -462,9 +482,9 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { } double lon = loc.getLongitude(); double lat = loc.getLatitude(); - if (app.getSettings().AV_DEFAULT_ACTION.get() == OsmandSettings.AV_DEFAULT_ACTION_VIDEO) { + if (AV_DEFAULT_ACTION.get() == AV_DEFAULT_ACTION_VIDEO) { recordVideo(lat, lon, mapActivity); - } else if (app.getSettings().AV_DEFAULT_ACTION.get() == OsmandSettings.AV_DEFAULT_ACTION_TAKEPICTURE) { + } else if (AV_DEFAULT_ACTION.get() == AV_DEFAULT_ACTION_TAKEPICTURE) { takePhoto(lat, lon, mapActivity); } else { recordAudio(lat, lon, mapActivity); @@ -496,7 +516,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); String ext = MPEG4_EXTENSION; - if(app.getSettings().AV_VIDEO_FORMAT.get() == OsmandSettings.VIDEO_OUTPUT_3GP ){ + if(AV_VIDEO_FORMAT.get() == VIDEO_OUTPUT_3GP ){ ext = THREEGP_EXTENSION; } Uri fileUri = Uri.fromFile(getBaseFileName(lat, lon, app, ext)); @@ -513,7 +533,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { } public void recordVideo(final double lat, final double lon, final MapActivity mapActivity) { - if(app.getSettings().AV_EXTERNAL_RECORDER.get()) { + if(AV_EXTERNAL_RECORDER.get()) { captureVideoExternal(lat, lon, mapActivity); } else { recordVideoCamera(lat, lon, mapActivity); @@ -534,14 +554,14 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { public void surfaceCreated(SurfaceHolder holder) { MediaRecorder mr = new MediaRecorder(); String ext = MPEG4_EXTENSION; - if(app.getSettings().AV_VIDEO_FORMAT.get() == OsmandSettings.VIDEO_OUTPUT_3GP ){ + if(AV_VIDEO_FORMAT.get() == VIDEO_OUTPUT_3GP ){ ext = THREEGP_EXTENSION; } final File f = getBaseFileName(lat, lon, app,ext ); mr.setAudioSource(MediaRecorder.AudioSource.DEFAULT); mr.setVideoSource(MediaRecorder.VideoSource.CAMERA); - if(app.getSettings().AV_VIDEO_FORMAT.get() == OsmandSettings.VIDEO_OUTPUT_3GP ){ + if(AV_VIDEO_FORMAT.get() == VIDEO_OUTPUT_3GP ){ mr.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); } else { mr.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); @@ -630,7 +650,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { } public void takePhoto(final double lat, final double lon, final MapActivity mapActivity) { - if (app.getSettings().AV_EXTERNAL_PHOTO_CAM.get()) { + if (AV_EXTERNAL_PHOTO_CAM.get()) { takeIntentPhoto(lat, lon, mapActivity); } else { final Camera cam = openCamera(); @@ -760,7 +780,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { par.removeView(recordControl); } stopRecording(mapActivity); - app.getSettings().SHOW_RECORDINGS.set(true); + SHOW_RECORDINGS.set(true); indexFile(f); mapActivity.getMapView().refreshMap(); updateWidgetIcon(recordControl); @@ -869,27 +889,25 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { grp.setTitle(R.string.av_settings); grp.setKey("av_settings"); screen.addPreference(grp); - OsmandSettings settings = app.getSettings(); - entries = new String[] {app.getString(R.string.av_def_action_audio), app.getString(R.string.av_def_action_video), app.getString(R.string.av_def_action_picture)}; - intValues = new Integer[] {OsmandSettings.AV_DEFAULT_ACTION_AUDIO, OsmandSettings.AV_DEFAULT_ACTION_VIDEO, - OsmandSettings.AV_DEFAULT_ACTION_TAKEPICTURE}; - ListPreference defAct = activity.createListPreference(settings.AV_DEFAULT_ACTION, + intValues = new Integer[] {AV_DEFAULT_ACTION_AUDIO, AV_DEFAULT_ACTION_VIDEO, + AV_DEFAULT_ACTION_TAKEPICTURE}; + ListPreference defAct = activity.createListPreference(AV_DEFAULT_ACTION, entries, intValues, R.string.av_widget_action, R.string.av_widget_action_descr); grp.addPreference(defAct); - grp.addPreference(activity.createCheckBoxPreference(settings.AV_EXTERNAL_RECORDER, + grp.addPreference(activity.createCheckBoxPreference(AV_EXTERNAL_RECORDER, R.string.av_use_external_recorder, R.string.av_use_external_recorder_descr)); - grp.addPreference(activity.createCheckBoxPreference(settings.AV_EXTERNAL_PHOTO_CAM, + grp.addPreference(activity.createCheckBoxPreference(AV_EXTERNAL_PHOTO_CAM, R.string.av_use_external_camera, R.string.av_use_external_camera_descr)); entries = new String[] {"3GP", "MP4"}; - intValues = new Integer[] {OsmandSettings.VIDEO_OUTPUT_3GP, OsmandSettings.VIDEO_OUTPUT_MP4}; - ListPreference lp = activity.createListPreference(settings.AV_VIDEO_FORMAT, + intValues = new Integer[] {VIDEO_OUTPUT_3GP, VIDEO_OUTPUT_MP4}; + ListPreference lp = activity.createListPreference(AV_VIDEO_FORMAT, entries, intValues, R.string.av_video_format, R.string.av_video_format_descr); grp.addPreference(lp); } @@ -968,7 +986,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { adapter.registerItem(R.string.show_location, 0, new OnContextMenuClick() { @Override public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) { - app.getSettings().SHOW_RECORDINGS.set(true); + SHOW_RECORDINGS.set(true); app.getSettings().setMapLocationToShow(ri.rec.lat, ri.rec.lon, app.getSettings().getLastKnownMapZoom()); MapActivity.launchMapActivityMoveToTop(la); diff --git a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionLayer.java b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionLayer.java index 1a7a0ae190..4ce184aafc 100644 --- a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionLayer.java +++ b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionLayer.java @@ -5,8 +5,6 @@ import java.util.List; import net.osmand.access.AccessibleToast; import net.osmand.data.LatLon; -import net.osmand.plus.OsmandApplication; -import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.views.ContextMenuLayer; @@ -43,7 +41,6 @@ public class ParkingPositionLayer extends OsmandMapLayer implements ContextMenuL private final MapActivity map; private OsmandMapTileView view; - private OsmandSettings settings; private Paint bitmapPaint; @@ -52,8 +49,11 @@ public class ParkingPositionLayer extends OsmandMapLayer implements ContextMenuL private boolean timeLimit; - public ParkingPositionLayer(MapActivity map) { + private ParkingPositionPlugin plugin; + + public ParkingPositionLayer(MapActivity map, ParkingPositionPlugin plugin) { this.map = map; + this.plugin = plugin; } public LatLon getParkingPoint() { @@ -63,8 +63,7 @@ public class ParkingPositionLayer extends OsmandMapLayer implements ContextMenuL @Override public void initLayer(OsmandMapTileView view) { this.view = view; - this.settings = ((OsmandApplication) map.getApplication()).getSettings(); - parkingPoint = settings.getParkingPosition(); + parkingPoint = plugin.getParkingPosition(); dm = new DisplayMetrics(); WindowManager wmgr = (WindowManager) view.getContext().getSystemService(Context.WINDOW_SERVICE); wmgr.getDefaultDisplay().getMetrics(dm); @@ -75,8 +74,8 @@ public class ParkingPositionLayer extends OsmandMapLayer implements ContextMenuL bitmapPaint.setFilterBitmap(true); parkingNoLimitIcon = BitmapFactory.decodeResource(view.getResources(), R.drawable.poi_parking_pos_no_limit); parkingLimitIcon = BitmapFactory.decodeResource(view.getResources(), R.drawable.poi_parking_pos_limit); - parkingPoint = settings.getParkingPosition(); - timeLimit = settings.getParkingType(); + parkingPoint = plugin.getParkingPosition(); + timeLimit = plugin.getParkingType(); } @Override @@ -139,8 +138,8 @@ public class ParkingPositionLayer extends OsmandMapLayer implements ContextMenuL if (o instanceof LatLon) { StringBuilder timeLimitDesc = new StringBuilder(); timeLimitDesc.append(map.getString(R.string.osmand_parking_position_description_add_time) + " "); - timeLimitDesc.append(getFormattedTime(settings.getStartParkingTime()) + "."); - if (settings.getParkingType()) { + timeLimitDesc.append(getFormattedTime(plugin.getStartParkingTime()) + "."); + if (plugin.getParkingType()) { // long parkingTime = settings.getParkingTime(); // long parkingStartTime = settings.getStartParkingTime(); // Time time = new Time(); @@ -155,7 +154,7 @@ public class ParkingPositionLayer extends OsmandMapLayer implements ContextMenuL // map.getString(R.string.osmand_parking_am)); // } timeLimitDesc.append(map.getString(R.string.osmand_parking_position_description_add) + " "); - timeLimitDesc.append(getFormattedTime(settings.getParkingTime())); + timeLimitDesc.append(getFormattedTime(plugin.getParkingTime())); } return map.getString(R.string.osmand_parking_position_description, timeLimitDesc.toString()); } @@ -215,7 +214,7 @@ public class ParkingPositionLayer extends OsmandMapLayer implements ContextMenuL if (parkingPoint != null && view != null) { int ex = (int) point.x; int ey = (int) point.y; - LatLon position = settings.getParkingPosition(); + LatLon position = plugin.getParkingPosition(); int x = view.getRotatedMapXForPoint(position.getLatitude(), position.getLongitude()); int y = view.getRotatedMapYForPoint(position.getLatitude(), position.getLongitude()); // the width of an image is 40 px, the height is 60 px -> radius = 20, diff --git a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java index 97e08d3f90..68c66ac82d 100644 --- a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java +++ b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java @@ -13,6 +13,7 @@ import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandSettings; +import net.osmand.plus.OsmandSettings.CommonPreference; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.views.AnimateDraggingMapThread; @@ -45,19 +46,101 @@ import android.widget.TimePicker; public class ParkingPositionPlugin extends OsmandPlugin { public static final String ID = "osmand.parking.position"; + public final static String PARKING_POINT_LAT = "parking_point_lat"; //$NON-NLS-1$ + public final static String PARKING_POINT_LON = "parking_point_lon"; //$NON-NLS-1$ + public final static String PARKING_TYPE = "parking_type"; //$NON-NLS-1$ + public final static String PARKING_TIME = "parking_limit_time"; //$//$NON-NLS-1$ + public final static String PARKING_START_TIME = "parking_time"; //$//$NON-NLS-1$ + public final static String PARKING_EVENT_ADDED = "parking_event_added"; //$//$NON-NLS-1$ private OsmandApplication app; private ParkingPositionLayer parkingLayer; - private OsmandSettings settings; private MapInfoControl parkingPlaceControl; + private final CommonPreference parkingLat; + private final CommonPreference parkingLon; + private CommonPreference parkingType; + private CommonPreference parkingEvent; + private CommonPreference parkingTime; + private CommonPreference parkingStartTime; public ParkingPositionPlugin(OsmandApplication app) { this.app = app; + OsmandSettings set = app.getSettings(); + parkingLat = set.registerFloatPreference(PARKING_POINT_LAT, 0f).makeGlobal(); + parkingLon = set.registerFloatPreference(PARKING_POINT_LON, 0f).makeGlobal(); + parkingType = set.registerBooleanPreference(PARKING_TYPE, false).makeGlobal(); + parkingEvent = set.registerBooleanPreference(PARKING_EVENT_ADDED, false).makeGlobal(); + parkingTime = set.registerLongPreference(PARKING_TIME, -1).makeGlobal(); + parkingStartTime = set.registerLongPreference(PARKING_START_TIME, -1).makeGlobal(); } + + + + public LatLon getParkingPosition() { + float lat = parkingLat.get(); + float lon = parkingLon.get(); + if (lat == 0 && lon == 0) { + return null; + } + return new LatLon(lat, lon); + } + + public boolean getParkingType() { + return parkingType.get(); + } + + public boolean isParkingEventAdded() { + return parkingEvent.get(); + } + + public boolean addOrRemoveParkingEvent(boolean added) { + return parkingEvent.set(added); + } + + public long getParkingTime() { + return parkingTime.get(); + } + + public long getStartParkingTime() { + return parkingStartTime.get(); + } + + public boolean clearParkingPosition() { + parkingLat.resetToDefault(); + parkingLon.resetToDefault(); + parkingType.resetToDefault(); + parkingTime.resetToDefault(); + parkingEvent.resetToDefault(); + parkingStartTime.resetToDefault(); + return true; + } + + public boolean setParkingPosition(double latitude, double longitude) { + parkingLat.set((float)latitude); + parkingLon.set((float)longitude); + return true; + } + + public boolean setParkingType(boolean limited) { + if (!limited) + parkingTime.set(-1l); + parkingType.set(limited); + return true; + } + + public boolean setParkingTime(long timeInMillis) { + parkingTime.set(timeInMillis); + return true; + } + + public boolean setParkingStartTime(long timeInMillis) { + parkingStartTime.set(timeInMillis); + return true; + } + @Override public boolean init(OsmandApplication app) { - settings = app.getSettings(); return true; } @@ -82,7 +165,7 @@ public class ParkingPositionPlugin extends OsmandPlugin { if(parkingLayer != null) { activity.getMapView().removeLayer(parkingLayer); } - parkingLayer = new ParkingPositionLayer(activity); + parkingLayer = new ParkingPositionLayer(activity, this); activity.getMapView().addLayer(parkingLayer, 4.5f); registerWidget(activity); } @@ -113,7 +196,7 @@ public class ParkingPositionPlugin extends OsmandPlugin { final double latitude, final double longitude, ContextMenuAdapter adapter, Object selectedObj) { boolean isParkingSelected = false; - LatLon parkingPosition = settings.getParkingPosition(); + LatLon parkingPosition = getParkingPosition(); if (selectedObj instanceof LatLon && parkingLayer != null && parkingPosition != null) { LatLon point = (LatLon)selectedObj; if ((point.getLatitude() == parkingPosition.getLatitude()) && (point.getLongitude() == parkingPosition.getLongitude())) @@ -151,7 +234,7 @@ public class ParkingPositionPlugin extends OsmandPlugin { * It allows user to choose a type of parking (time-limited or time-unlimited). */ private void showAddParkingDialog(final MapActivity mapActivity, final double latitude, final double longitude) { - final boolean wasEventPreviouslyAdded = settings.isParkingEventAdded(); + final boolean wasEventPreviouslyAdded = isParkingEventAdded(); final View addParking = mapActivity.getLayoutInflater().inflate(R.layout.parking_set_type, null); final Dialog choose = new Dialog(mapActivity); choose.setContentView(addParking); @@ -179,7 +262,7 @@ public class ParkingPositionPlugin extends OsmandPlugin { if (wasEventPreviouslyAdded) { showDeleteEventWarning(mapActivity); } - settings.addOrRemoveParkingEvent(false); + addOrRemoveParkingEvent(false); setParkingPosition(mapActivity, latitude, longitude, false); mapActivity.getMapView().refreshMap(); } @@ -204,7 +287,7 @@ public class ParkingPositionPlugin extends OsmandPlugin { if(parkingLayer != null) { parkingLayer.removeParkingPoint(); } - settings.clearParkingPosition(); + clearParkingPosition(); mapActivity.getMapView().refreshMap(); } }); @@ -271,13 +354,13 @@ public class ParkingPositionPlugin extends OsmandPlugin { int minute = cal.get(Calendar.MINUTE); cal.set(is24HourFormat ? Calendar.HOUR_OF_DAY : Calendar.HOUR, hour + timePicker.getCurrentHour()); cal.set(Calendar.MINUTE, minute + timePicker.getCurrentMinute()); - settings.setParkingTime(cal.getTimeInMillis()); + setParkingTime(cal.getTimeInMillis()); CheckBox addCalendarEvent = (CheckBox) setTimeParking.findViewById(R.id.check_event_in_calendar); if (addCalendarEvent.isChecked()) { addCalendarEvent(setTimeParking); - settings.addOrRemoveParkingEvent(true); + addOrRemoveParkingEvent(true); } else { - settings.addOrRemoveParkingEvent(false); + addOrRemoveParkingEvent(false); } } }); @@ -294,8 +377,8 @@ public class ParkingPositionPlugin extends OsmandPlugin { intent.setType("vnd.android.cursor.item/event"); //$NON-NLS-1$ intent.putExtra("calendar_id", 1); //$NON-NLS-1$ intent.putExtra("title", view.getContext().getString(R.string.osmand_parking_event)); //$NON-NLS-1$ - intent.putExtra("beginTime", settings.getParkingTime()); //$NON-NLS-1$ - intent.putExtra("endTime", settings.getParkingTime()+60*60*1000); //$NON-NLS-1$ + intent.putExtra("beginTime", getParkingTime()); //$NON-NLS-1$ + intent.putExtra("endTime", getParkingTime()+60*60*1000); //$NON-NLS-1$ view.getContext().startActivity(intent); } @@ -304,7 +387,7 @@ public class ParkingPositionPlugin extends OsmandPlugin { * @param mapActivity */ private void showDeleteEventWarning(final MapActivity mapActivity) { - if (settings.isParkingEventAdded()) { + if (isParkingEventAdded()) { Builder deleteEventWarning = new AlertDialog.Builder(mapActivity); deleteEventWarning.setTitle(mapActivity.getString(R.string.osmand_parking_warning)); deleteEventWarning.setMessage(mapActivity.getString(R.string.osmand_parking_warning_text)); @@ -326,9 +409,9 @@ public class ParkingPositionPlugin extends OsmandPlugin { * @param isLimited */ private void setParkingPosition(final MapActivity mapActivity, final double latitude, final double longitude, boolean isLimited) { - settings.setParkingPosition(latitude, longitude); - settings.setParkingType(isLimited); - settings.setParkingStartTime(Calendar.getInstance().getTimeInMillis()); + setParkingPosition(latitude, longitude); + setParkingType(isLimited); + setParkingStartTime(Calendar.getInstance().getTimeInMillis()); if (parkingLayer != null) { parkingLayer.setParkingPointOnLayer(new LatLon(latitude, longitude), isLimited); } @@ -342,7 +425,7 @@ public class ParkingPositionPlugin extends OsmandPlugin { new OnOptionsMenuClick() { @Override public void prepareOptionsMenu(Menu menu, MenuItem deleteParkingItem) { - if (settings.getParkingPosition() != null) { + if (getParkingPosition() != null) { deleteParkingItem.setVisible(true); } else { deleteParkingItem.setVisible(false); @@ -421,7 +504,7 @@ public class ParkingPositionPlugin extends OsmandPlugin { public void onClick(View v) { OsmandMapTileView view = map.getMapView(); AnimateDraggingMapThread thread = view.getAnimatedDraggingThread(); - LatLon parkingPoint = view.getSettings().getParkingPosition(); + LatLon parkingPoint = getParkingPosition(); if (parkingPoint != null) { float fZoom = view.getFloatZoom() < 15 ? 15 : view.getFloatZoom(); thread.startMoving(parkingPoint.getLatitude(), parkingPoint.getLongitude(), fZoom, true);