Map refreshment after Parking location added. strings.xml is modified according to the rules

This commit is contained in:
aFedasenka 2012-06-14 23:28:55 +02:00
parent 439e65aa40
commit 5eef1a99d4
3 changed files with 38 additions and 47 deletions

View file

@ -9,6 +9,13 @@
1. All your modified/created strings are in the top of the file (to make easier find what's translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
<string name="osmand_parking_position_description">The position of your parked car.</string>
<string name="osmand_parking_position_name">Parking point</string>
<string name="osmand_parking_plugin_description">This plugin allows to store the location of your parked car.</string>
<string name="osmand_parking_plugin_name">Parking Position Plugin</string>
<string name="context_menu_item_add_parking_point">Add location of a parked car</string>
<string name="context_menu_item_delete_parking_point">Delete location of a parked car</string>
<string name="offline_navigation_not_available">Osmand offline navigation is temporarily not available.</string>
<string name="left_side_navigation">Left-Hand Driving</string>
<string name="left_side_navigation_descr">Select for countries with left-hand traffic</string>
@ -44,10 +51,6 @@
<string name="osmand_monitoring_name">Tracking</string>
<string name="osmand_extra_settings_description">This plugin provides advanced map configuration and some device-specific settings.</string>
<string name="osmand_extra_settings_name">Advanced Settings</string>
<string name="osmand_parking_position_description">The position of your parked car.</string>
<string name="osmand_parking_position_name">Parking point</string>
<string name="osmand_parking_plugin_description">This plugin allows to store the location of your parked car.</string>
<string name="osmand_parking_plugin_name">Parking Position Plugin</string>
<string name="osmand_development_plugin_description">This plugin enables development and debugging features like animated navigation or rendering performance display.</string>
<string name="osmand_development_plugin_name">Osmand Development</string>
<string name="plugins_screen">Plugin Manager</string>
@ -939,8 +942,6 @@
<string name="context_menu_item_navigate_point">Set as destination</string>
<string name="context_menu_item_add_favorite">Add to favorites</string>
<string name="context_menu_item_add_parking_point">Add location of a parked car</string>
<string name="context_menu_item_delete_parking_point">Delete location of a parked car</string>
<string name="context_menu_item_update_map">Update map</string>
<string name="context_menu_item_open_bug">Open OSM bug</string>
<string name="context_menu_item_create_poi">Create POI</string>

View file

@ -116,15 +116,6 @@ public class ParkingPositionLayer extends OsmandMapLayer implements ContextMenuL
}
}
@Override
public void destroyLayer() {
}
@Override
public boolean drawInScreenPixels() {
return false;
}
@Override
public boolean onSingleTap(PointF point) {
List <LatLon> parkPos = new ArrayList<LatLon>();
@ -137,9 +128,13 @@ public class ParkingPositionLayer extends OsmandMapLayer implements ContextMenuL
}
return false;
}
@Override
public boolean onLongPressEvent(PointF point) {
public void destroyLayer() {
}
@Override
public boolean drawInScreenPixels() {
return false;
}
@ -170,6 +165,26 @@ public class ParkingPositionLayer extends OsmandMapLayer implements ContextMenuL
}
}
/**
* Method creates confirmation dialog for deletion of a parking location
*/
public void showDeleteDialog() {
Builder confirm = new AlertDialog.Builder(map);
confirm.setTitle("Delete parking location");
confirm.setMessage("Do you want to remove the location of the parked car?");
confirm.setCancelable(true);
confirm.setPositiveButton(R.string.default_buttons_yes,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
settings.clearParkingPosition();
map.getMapLayers().getParkingPositionLayer().view.refreshMap();
}
});
confirm.setNegativeButton(R.string.default_buttons_cancel, null);
confirm.show();
}
/**
* @param latitude
* @param longitude
@ -273,22 +288,5 @@ public class ParkingPositionLayer extends OsmandMapLayer implements ContextMenuL
parkingPlaceControl.setImageDrawable(view.getResources().getDrawable(R.drawable.poi_parking_pos_info));
return parkingPlaceControl;
}
public void showDeleteDialog() {
Builder confirm = new AlertDialog.Builder(map);
confirm.setTitle("Delete parking location");
confirm.setMessage("Do you want to remove the location of the parked car?");
confirm.setCancelable(true);
confirm.setPositiveButton(R.string.default_buttons_yes,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO refresh map
settings.clearParkingPosition();
}
});
confirm.setNegativeButton(R.string.default_buttons_cancel, null);
confirm.show();
}
}

View file

@ -7,10 +7,8 @@ import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.SettingsActivity;
import net.osmand.plus.views.OsmandMapTileView;
import android.content.DialogInterface;
import android.preference.PreferenceScreen;
/**
*
@ -21,13 +19,14 @@ public class ParkingPositionPlugin extends OsmandPlugin {
private static final String ID = "osmand.parking.position";
private OsmandApplication app;
// private static final Log log = LogUtil.getLog(ParkingPositionPlugin.class);
private ParkingPositionLayer parkingLayer;
private OsmandSettings settings;
public ParkingPositionPlugin(OsmandApplication app) {
this.app = app;
}
@Override
public boolean init(OsmandApplication app) {
settings = app.getSettings();
@ -53,11 +52,7 @@ public class ParkingPositionPlugin extends OsmandPlugin {
public void registerLayers(MapActivity activity) {
parkingLayer = new ParkingPositionLayer(activity);
}
@Override
public void mapActivityCreate(MapActivity activity) {
}
@Override
public void updateLayers(OsmandMapTileView mapView, MapActivity activity) {
if((settings.getParkingPosition() == null) && (mapView.getLayers().contains(parkingLayer))){
@ -66,6 +61,7 @@ public class ParkingPositionPlugin extends OsmandPlugin {
mapView.addLayer(parkingLayer, 8);
}
}
@Override
public void registerMapContextMenuActions(final MapActivity mapActivity, final double latitude, final double longitude, ContextMenuAdapter adapter, Object selectedObj) {
OnContextMenuClick addListener = new OnContextMenuClick() {
@ -84,8 +80,4 @@ public class ParkingPositionPlugin extends OsmandPlugin {
if (settings.getParkingPosition() != null)
adapter.registerItem(R.string.context_menu_item_delete_parking_point, 0, addListener, -1);
}
@Override
public void settingsActivityCreate(final SettingsActivity activity, PreferenceScreen screen) {
}
}