Introduce Plugin api
This commit is contained in:
parent
a4ed0d2509
commit
84d36f084c
14 changed files with 321 additions and 164 deletions
|
@ -305,7 +305,7 @@ public class IndexUploader {
|
||||||
File zFile = new File(f.getParentFile(), unzipped.getName() + ".zip");
|
File zFile = new File(f.getParentFile(), unzipped.getName() + ".zip");
|
||||||
zip(files, zFile, description, timestampCreated);
|
zip(files, zFile, description, timestampCreated);
|
||||||
|
|
||||||
uploadIndex(zFile, description, uploadCredentials);
|
uploadIndex(f, zFile, description, uploadCredentials);
|
||||||
} finally {
|
} finally {
|
||||||
if (!f.getName().equals(unzipped.getName()) ||
|
if (!f.getName().equals(unzipped.getName()) ||
|
||||||
(targetDirectory != null && !targetDirectory.equals(directory))) {
|
(targetDirectory != null && !targetDirectory.equals(directory))) {
|
||||||
|
@ -491,13 +491,12 @@ public class IndexUploader {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void uploadIndex(File zipFile, String summary, UploadCredentials uc) {
|
private void uploadIndex(File srcFile, File zipFile, String summary, UploadCredentials uc) {
|
||||||
double mbLengh = (double) zipFile.length() / MB;
|
double mbLengh = (double) zipFile.length() / MB;
|
||||||
String fileName = zipFile.getName();
|
String fileName = zipFile.getName();
|
||||||
if (mbLengh < MIN_SIZE_TO_UPLOAD) {
|
if (mbLengh < MIN_SIZE_TO_UPLOAD) {
|
||||||
log.info("Skip uploading index due to size " + fileName);
|
log.info("Skip uploading index due to size " + fileName);
|
||||||
// do not upload small files
|
// do not upload small files
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
log.info("Upload index " + fileName);
|
log.info("Upload index " + fileName);
|
||||||
|
@ -510,6 +509,9 @@ public class IndexUploader {
|
||||||
toBackup.delete();
|
toBackup.delete();
|
||||||
}
|
}
|
||||||
toUpload.renameTo(toBackup);
|
toUpload.renameTo(toBackup);
|
||||||
|
if(srcFile.equals(zipFile)){
|
||||||
|
srcFile.delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("Input/output exception uploading " + fileName, e);
|
log.error("Input/output exception uploading " + fileName, e);
|
||||||
|
|
|
@ -141,7 +141,7 @@ public class NavigationInfo {
|
||||||
|
|
||||||
public NavigationInfo(final Context context) {
|
public NavigationInfo(final Context context) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
settings = OsmandApplication.getSettings();
|
settings = ((OsmandApplication) context.getApplicationContext()).getSettings();
|
||||||
currentLocation = null;
|
currentLocation = null;
|
||||||
lastDirection = new RelativeDirection();
|
lastDirection = new RelativeDirection();
|
||||||
lastNotificationTime = SystemClock.uptimeMillis();
|
lastNotificationTime = SystemClock.uptimeMillis();
|
||||||
|
@ -300,8 +300,7 @@ public class NavigationInfo {
|
||||||
dialog.cancel();
|
dialog.cancel();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
info.setItems(attributes.toArray(new String[attributes.size()]),
|
info.setItems(attributes.toArray(new String[attributes.size()]), new DialogInterface.OnClickListener() {
|
||||||
new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,7 @@ public class OsmandApplication extends Application {
|
||||||
* Application settings
|
* Application settings
|
||||||
* @return Reference to instance of OsmandSettings
|
* @return Reference to instance of OsmandSettings
|
||||||
*/
|
*/
|
||||||
public static OsmandSettings getSettings() {
|
public OsmandSettings getSettings() {
|
||||||
if(osmandSettings == null) {
|
if(osmandSettings == null) {
|
||||||
LOG.error("Trying to access settings before they were created");
|
LOG.error("Trying to access settings before they were created");
|
||||||
}
|
}
|
||||||
|
|
87
OsmAnd/src/net/osmand/plus/OsmandPlugin.java
Normal file
87
OsmAnd/src/net/osmand/plus/OsmandPlugin.java
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
package net.osmand.plus;
|
||||||
|
|
||||||
|
import gnu.trove.list.array.TIntArrayList;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.osmedit.OsmEditingPlugin;
|
||||||
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
|
|
||||||
|
public abstract class OsmandPlugin {
|
||||||
|
|
||||||
|
private static List<OsmandPlugin> plugins = new ArrayList<OsmandPlugin>();
|
||||||
|
static {
|
||||||
|
plugins.add(new OsmEditingPlugin());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<OsmandPlugin> getAvailablePlugins(){
|
||||||
|
return plugins;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static <T extends OsmandPlugin> T getEnabledPlugin(Class<T> clz) {
|
||||||
|
for(OsmandPlugin lr : plugins) {
|
||||||
|
if(clz.isInstance(lr)){
|
||||||
|
return (T) lr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public abstract String getId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize plugin runs just after creation
|
||||||
|
*/
|
||||||
|
public abstract boolean init(OsmandApplication app);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ????
|
||||||
|
*/
|
||||||
|
public abstract void updateLayers(OsmandMapTileView mapView);
|
||||||
|
|
||||||
|
public static void refreshLayers(OsmandMapTileView mapView) {
|
||||||
|
for (OsmandPlugin plugin : plugins) {
|
||||||
|
plugin.updateLayers(mapView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public abstract void registerLayers(MapActivity activity);
|
||||||
|
|
||||||
|
public static void createLayers(OsmandMapTileView mapView, MapActivity activity) {
|
||||||
|
for (OsmandPlugin plugin : plugins) {
|
||||||
|
plugin.registerLayers(activity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void mapActivityCreate(MapActivity activity);
|
||||||
|
|
||||||
|
public static void onMapActivityCreate(MapActivity activity) {
|
||||||
|
for (OsmandPlugin plugin : plugins) {
|
||||||
|
plugin.mapActivityCreate(activity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract boolean handleContextMenuAction(int resId, double latitude, double longitude);
|
||||||
|
|
||||||
|
public abstract void registerContextMenuActions(double latitude, double longitude, TIntArrayList list);
|
||||||
|
|
||||||
|
public static void registerContextMenu(double latitude, double longitude, TIntArrayList list) {
|
||||||
|
for (OsmandPlugin plugin : plugins) {
|
||||||
|
plugin.registerContextMenuActions(latitude, longitude, list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean contextMenuAction(int resId, double latitude, double longitude) {
|
||||||
|
for (OsmandPlugin plugin : plugins) {
|
||||||
|
if(plugin.handleContextMenuAction(resId, latitude, longitude)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,6 +21,7 @@ import net.osmand.osm.LatLon;
|
||||||
import net.osmand.plus.BusyIndicator;
|
import net.osmand.plus.BusyIndicator;
|
||||||
import net.osmand.plus.FavouritesDbHelper;
|
import net.osmand.plus.FavouritesDbHelper;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.ResourceManager;
|
import net.osmand.plus.ResourceManager;
|
||||||
|
@ -29,7 +30,6 @@ import net.osmand.plus.routing.RouteAnimation;
|
||||||
import net.osmand.plus.routing.RouteProvider.GPXRouteParams;
|
import net.osmand.plus.routing.RouteProvider.GPXRouteParams;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.views.AnimateDraggingMapThread;
|
import net.osmand.plus.views.AnimateDraggingMapThread;
|
||||||
import net.osmand.plus.views.MapTileLayer;
|
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
import net.osmand.plus.views.PointLocationLayer;
|
import net.osmand.plus.views.PointLocationLayer;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
@ -109,7 +109,6 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe
|
||||||
/** Called when the activity is first created. */
|
/** Called when the activity is first created. */
|
||||||
private OsmandMapTileView mapView;
|
private OsmandMapTileView mapView;
|
||||||
final private MapActivityActions mapActions = new MapActivityActions(this);
|
final private MapActivityActions mapActions = new MapActivityActions(this);
|
||||||
private EditingPOIActivity poiActions;
|
|
||||||
final private MapActivityLayers mapLayers = new MapActivityLayers(this);
|
final private MapActivityLayers mapLayers = new MapActivityLayers(this);
|
||||||
private NavigationInfo navigationInfo;
|
private NavigationInfo navigationInfo;
|
||||||
|
|
||||||
|
@ -183,7 +182,7 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
poiActions = new EditingPOIActivity(this);
|
|
||||||
getMyApplication().getResourceManager().getMapTileDownloader().addDownloaderCallback(new IMapDownloaderCallback(){
|
getMyApplication().getResourceManager().getMapTileDownloader().addDownloaderCallback(new IMapDownloaderCallback(){
|
||||||
@Override
|
@Override
|
||||||
public void tileDownloaded(DownloadRequest request) {
|
public void tileDownloaded(DownloadRequest request) {
|
||||||
|
@ -235,8 +234,7 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe
|
||||||
}
|
}
|
||||||
|
|
||||||
addDialogProvider(mapActions);
|
addDialogProvider(mapActions);
|
||||||
addDialogProvider(poiActions);
|
OsmandPlugin.onMapActivityCreate(this);
|
||||||
addDialogProvider(mapLayers.getOsmBugsLayer());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -385,7 +383,7 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe
|
||||||
return ((OsmandApplication) getApplication());
|
return ((OsmandApplication) getApplication());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addDialogProvider(DialogProvider dp) {
|
public void addDialogProvider(DialogProvider dp) {
|
||||||
dialogProviders.add(dp);
|
dialogProviders.add(dp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1312,84 +1310,18 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe
|
||||||
|
|
||||||
|
|
||||||
public void contextMenuPoint(final double latitude, final double longitude){
|
public void contextMenuPoint(final double latitude, final double longitude){
|
||||||
contextMenuPoint(latitude, longitude, null, null);
|
mapActions.contextMenuPoint(latitude, longitude, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void contextMenuPoint(final double latitude, final double longitude, List<String> additionalItems,
|
public void contextMenuPoint(final double latitude, final double longitude, List<String> additionalItems,
|
||||||
final DialogInterface.OnClickListener additionalActions){
|
final DialogInterface.OnClickListener additionalActions) {
|
||||||
Builder builder = new AlertDialog.Builder(this);
|
mapActions.contextMenuPoint(latitude, longitude, additionalItems, additionalActions);
|
||||||
final int sizeAdditional = additionalActions == null || additionalItems == null ? 0 : additionalItems.size();
|
|
||||||
List<String> actions = new ArrayList<String>();
|
|
||||||
if(sizeAdditional > 0){
|
|
||||||
actions.addAll(additionalItems);
|
|
||||||
}
|
|
||||||
final int[] contextMenuStandardActions = new int[]{
|
|
||||||
R.string.context_menu_item_navigate_point,
|
|
||||||
R.string.context_menu_item_show_route,
|
|
||||||
R.string.context_menu_item_search,
|
|
||||||
R.string.context_menu_item_add_favorite,
|
|
||||||
R.string.context_menu_item_share_location,
|
|
||||||
R.string.context_menu_item_create_poi,
|
|
||||||
R.string.context_menu_item_add_waypoint,
|
|
||||||
R.string.context_menu_item_open_bug,
|
|
||||||
//MapTileLayer menu actions
|
|
||||||
R.string.context_menu_item_update_map,
|
|
||||||
R.string.context_menu_item_download_map
|
|
||||||
};
|
|
||||||
int actionsToUse = (mapView.getMainLayer() instanceof MapTileLayer) ? contextMenuStandardActions.length : contextMenuStandardActions.length - 2;
|
|
||||||
for(int j = 0; j<actionsToUse; j++){
|
|
||||||
actions.add(getResources().getString(contextMenuStandardActions[j]));
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.setItems(actions.toArray(new String[actions.size()]), new DialogInterface.OnClickListener(){
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
if(which < sizeAdditional){
|
|
||||||
additionalActions.onClick(dialog, which);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int standardId = contextMenuStandardActions[which - sizeAdditional];
|
|
||||||
if(standardId == R.string.context_menu_item_navigate_point){
|
|
||||||
navigateToPoint(new LatLon(latitude, longitude));
|
|
||||||
} else if(standardId == R.string.context_menu_item_show_route){
|
|
||||||
mapActions.getDirections(latitude, longitude, false);
|
|
||||||
} else if(standardId == R.string.context_menu_item_search){
|
|
||||||
Intent intent = new Intent(MapActivity.this, SearchActivity.class);
|
|
||||||
intent.putExtra(SearchActivity.SEARCH_LAT, latitude);
|
|
||||||
intent.putExtra(SearchActivity.SEARCH_LON, longitude);
|
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
||||||
startActivity(intent);
|
|
||||||
} else if(standardId == R.string.context_menu_item_add_favorite){
|
|
||||||
mapActions.addFavouritePoint(latitude, longitude);
|
|
||||||
} else if(standardId == R.string.context_menu_item_share_location){
|
|
||||||
mapActions.shareLocation(latitude, longitude, mapView.getZoom());
|
|
||||||
} else if(standardId == R.string.context_menu_item_create_poi){
|
|
||||||
getPoiActions().showCreateDialog(latitude, longitude);
|
|
||||||
} else if(standardId == R.string.context_menu_item_add_waypoint){
|
|
||||||
mapActions.addWaypoint(latitude, longitude);
|
|
||||||
} else if(standardId == R.string.context_menu_item_open_bug){
|
|
||||||
mapLayers.getOsmBugsLayer().openBug(latitude, longitude);
|
|
||||||
} else if(standardId == R.string.context_menu_item_update_map){
|
|
||||||
mapActions.reloadTile(mapView.getZoom(), latitude, longitude);
|
|
||||||
} else if(standardId == R.string.context_menu_item_download_map){
|
|
||||||
DownloadTilesDialog dlg = new DownloadTilesDialog(MapActivity.this,
|
|
||||||
(OsmandApplication) getApplication(), mapView);
|
|
||||||
dlg.openDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
builder.create().show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapActivityActions getMapActions() {
|
public MapActivityActions getMapActions() {
|
||||||
return mapActions;
|
return mapActions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EditingPOIActivity getPoiActions() {
|
|
||||||
return poiActions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MapActivityLayers getMapLayers() {
|
public MapActivityLayers getMapLayers() {
|
||||||
return mapLayers;
|
return mapLayers;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package net.osmand.plus.activities;
|
package net.osmand.plus.activities;
|
||||||
|
|
||||||
|
import gnu.trove.list.array.TIntArrayList;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -22,9 +24,11 @@ import net.osmand.osm.MapUtils;
|
||||||
import net.osmand.plus.AmenityIndexRepositoryOdb;
|
import net.osmand.plus.AmenityIndexRepositoryOdb;
|
||||||
import net.osmand.plus.FavouritesDbHelper;
|
import net.osmand.plus.FavouritesDbHelper;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.ResourceManager;
|
import net.osmand.plus.ResourceManager;
|
||||||
|
import net.osmand.plus.activities.search.SearchActivity;
|
||||||
import net.osmand.plus.routing.RouteProvider.GPXRouteParams;
|
import net.osmand.plus.routing.RouteProvider.GPXRouteParams;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.views.BaseMapLayer;
|
import net.osmand.plus.views.BaseMapLayer;
|
||||||
|
@ -711,6 +715,67 @@ public class MapActivityActions implements DialogProvider {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void contextMenuPoint(final double latitude, final double longitude, List<String> additionalItems,
|
||||||
|
final DialogInterface.OnClickListener additionalActions) {
|
||||||
|
Builder builder = new AlertDialog.Builder(mapActivity);
|
||||||
|
final int sizeAdditional = additionalActions == null || additionalItems == null ? 0 : additionalItems.size();
|
||||||
|
List<String> actions = new ArrayList<String>();
|
||||||
|
if (sizeAdditional > 0) {
|
||||||
|
actions.addAll(additionalItems);
|
||||||
|
}
|
||||||
|
final OsmandMapTileView mapView = mapActivity.getMapView();
|
||||||
|
final TIntArrayList contextMenuStandardActions = new TIntArrayList();
|
||||||
|
contextMenuStandardActions.add(new int[] { R.string.context_menu_item_navigate_point,
|
||||||
|
R.string.context_menu_item_show_route, R.string.context_menu_item_search, R.string.context_menu_item_add_favorite,
|
||||||
|
R.string.context_menu_item_share_location, R.string.context_menu_item_add_waypoint});
|
||||||
|
OsmandPlugin.registerContextMenu(latitude, longitude, contextMenuStandardActions);
|
||||||
|
if(mapView.getMainLayer() instanceof MapTileLayer) {
|
||||||
|
contextMenuStandardActions.add(R.string.context_menu_item_update_map);
|
||||||
|
contextMenuStandardActions.add(R.string.context_menu_item_download_map);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int j = 0; j < contextMenuStandardActions.size(); j++) {
|
||||||
|
actions.add(mapActivity.getString(contextMenuStandardActions.get(j)));
|
||||||
|
}
|
||||||
|
|
||||||
|
builder.setItems(actions.toArray(new String[actions.size()]), new DialogInterface.OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
if (which < sizeAdditional) {
|
||||||
|
additionalActions.onClick(dialog, which);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int standardId = contextMenuStandardActions.get(which - sizeAdditional);
|
||||||
|
if(OsmandPlugin.contextMenuAction(standardId, latitude, longitude)) {
|
||||||
|
// Plugin action
|
||||||
|
} else if (standardId == R.string.context_menu_item_navigate_point) {
|
||||||
|
mapActivity.navigateToPoint(new LatLon(latitude, longitude));
|
||||||
|
} else if (standardId == R.string.context_menu_item_show_route) {
|
||||||
|
getDirections(latitude, longitude, false);
|
||||||
|
} else if (standardId == R.string.context_menu_item_search) {
|
||||||
|
Intent intent = new Intent(mapActivity, SearchActivity.class);
|
||||||
|
intent.putExtra(SearchActivity.SEARCH_LAT, latitude);
|
||||||
|
intent.putExtra(SearchActivity.SEARCH_LON, longitude);
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
mapActivity.startActivity(intent);
|
||||||
|
} else if (standardId == R.string.context_menu_item_add_favorite) {
|
||||||
|
addFavouritePoint(latitude, longitude);
|
||||||
|
} else if (standardId == R.string.context_menu_item_share_location) {
|
||||||
|
shareLocation(latitude, longitude, mapView.getZoom());
|
||||||
|
} else if (standardId == R.string.context_menu_item_add_waypoint) {
|
||||||
|
addWaypoint(latitude, longitude);
|
||||||
|
} else if (standardId == R.string.context_menu_item_update_map) {
|
||||||
|
reloadTile(mapView.getZoom(), latitude, longitude);
|
||||||
|
} else if (standardId == R.string.context_menu_item_download_map) {
|
||||||
|
DownloadTilesDialog dlg = new DownloadTilesDialog(mapActivity, (OsmandApplication) mapActivity.getApplication(), mapView);
|
||||||
|
dlg.openDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
builder.create().show();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(int id) {
|
public Dialog onCreateDialog(int id) {
|
||||||
Bundle args = dialogBundle;
|
Bundle args = dialogBundle;
|
||||||
|
|
|
@ -23,6 +23,7 @@ import net.osmand.data.AmenityType;
|
||||||
import net.osmand.map.ITileSource;
|
import net.osmand.map.ITileSource;
|
||||||
import net.osmand.map.TileSourceManager.TileSourceTemplate;
|
import net.osmand.map.TileSourceManager.TileSourceTemplate;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.OsmandSettings.CommonPreference;
|
import net.osmand.plus.OsmandSettings.CommonPreference;
|
||||||
import net.osmand.plus.PoiFilter;
|
import net.osmand.plus.PoiFilter;
|
||||||
|
@ -40,7 +41,6 @@ import net.osmand.plus.views.GPXLayer;
|
||||||
import net.osmand.plus.views.MapControlsLayer;
|
import net.osmand.plus.views.MapControlsLayer;
|
||||||
import net.osmand.plus.views.MapInfoLayer;
|
import net.osmand.plus.views.MapInfoLayer;
|
||||||
import net.osmand.plus.views.MapTileLayer;
|
import net.osmand.plus.views.MapTileLayer;
|
||||||
import net.osmand.plus.views.OsmBugsLayer;
|
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
import net.osmand.plus.views.POIMapLayer;
|
import net.osmand.plus.views.POIMapLayer;
|
||||||
import net.osmand.plus.views.PointLocationLayer;
|
import net.osmand.plus.views.PointLocationLayer;
|
||||||
|
@ -84,7 +84,6 @@ public class MapActivityLayers {
|
||||||
private MapTileLayer underlayLayer;
|
private MapTileLayer underlayLayer;
|
||||||
private GPXLayer gpxLayer;
|
private GPXLayer gpxLayer;
|
||||||
private RouteLayer routeLayer;
|
private RouteLayer routeLayer;
|
||||||
private OsmBugsLayer osmBugsLayer;
|
|
||||||
private POIMapLayer poiMapLayer;
|
private POIMapLayer poiMapLayer;
|
||||||
private FavoritesLayer favoritesLayer;
|
private FavoritesLayer favoritesLayer;
|
||||||
private TransportStopsLayer transportStopsLayer;
|
private TransportStopsLayer transportStopsLayer;
|
||||||
|
@ -132,7 +131,7 @@ public class MapActivityLayers {
|
||||||
mapView.addLayer(routeLayer, 1);
|
mapView.addLayer(routeLayer, 1);
|
||||||
|
|
||||||
// 2. osm bugs layer
|
// 2. osm bugs layer
|
||||||
osmBugsLayer = new OsmBugsLayer(activity);
|
|
||||||
// 3. poi layer
|
// 3. poi layer
|
||||||
poiMapLayer = new POIMapLayer(activity);
|
poiMapLayer = new POIMapLayer(activity);
|
||||||
// 4. favorites layer
|
// 4. favorites layer
|
||||||
|
@ -161,6 +160,7 @@ public class MapActivityLayers {
|
||||||
mapControlsLayer = new MapControlsLayer(activity);
|
mapControlsLayer = new MapControlsLayer(activity);
|
||||||
mapView.addLayer(mapControlsLayer, 11);
|
mapView.addLayer(mapControlsLayer, 11);
|
||||||
|
|
||||||
|
OsmandPlugin.createLayers(mapView, activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -173,13 +173,7 @@ public class MapActivityLayers {
|
||||||
mapView.removeLayer(transportStopsLayer);
|
mapView.removeLayer(transportStopsLayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(mapView.getLayers().contains(osmBugsLayer) != settings.SHOW_OSM_BUGS.get()){
|
|
||||||
if(settings.SHOW_OSM_BUGS.get()){
|
|
||||||
mapView.addLayer(osmBugsLayer, 2);
|
|
||||||
} else {
|
|
||||||
mapView.removeLayer(osmBugsLayer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mapView.getLayers().contains(poiMapLayer) != settings.SHOW_POI_OVER_MAP.get()){
|
if(mapView.getLayers().contains(poiMapLayer) != settings.SHOW_POI_OVER_MAP.get()){
|
||||||
if(settings.SHOW_POI_OVER_MAP.get()){
|
if(settings.SHOW_POI_OVER_MAP.get()){
|
||||||
|
@ -196,6 +190,7 @@ public class MapActivityLayers {
|
||||||
mapView.removeLayer(favoritesLayer);
|
mapView.removeLayer(favoritesLayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
OsmandPlugin.refreshLayers(mapView);
|
||||||
updateGPXLayer();
|
updateGPXLayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -765,7 +760,4 @@ public class MapActivityLayers {
|
||||||
return poiMapLayer;
|
return poiMapLayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OsmBugsLayer getOsmBugsLayer() {
|
|
||||||
return osmBugsLayer;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@ public class TipsAndTricksActivity {
|
||||||
dlg.setContentView(R.layout.tips_and_tricks);
|
dlg.setContentView(R.layout.tips_and_tricks);
|
||||||
dlg.getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
|
dlg.getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
|
||||||
final TextView tipDescription = (TextView) dlg.findViewById(R.id.TipDescription);
|
final TextView tipDescription = (TextView) dlg.findViewById(R.id.TipDescription);
|
||||||
if (!OsmandApplication.getSettings().ACCESSIBILITY_EXTENSIONS.get())
|
if (!((OsmandApplication)ctx.getApplicationContext()).getSettings().ACCESSIBILITY_EXTENSIONS.get())
|
||||||
tipDescription.setMovementMethod(ScrollingMovementMethod.getInstance());
|
tipDescription.setMovementMethod(ScrollingMovementMethod.getInstance());
|
||||||
int nextInd = 0;
|
int nextInd = 0;
|
||||||
final TIntArrayList toShow = new TIntArrayList();
|
final TIntArrayList toShow = new TIntArrayList();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package net.osmand.plus.activities;
|
package net.osmand.plus.osmedit;
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -24,6 +24,9 @@ import net.osmand.osm.OpeningHoursParser.OpeningHoursRule;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.activities.DialogProvider;
|
||||||
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.activities.OpeningHoursView;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.AlertDialog.Builder;
|
import android.app.AlertDialog.Builder;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
|
@ -1,4 +1,5 @@
|
||||||
package net.osmand.plus.views;
|
package net.osmand.plus.osmedit;
|
||||||
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -20,6 +21,10 @@ import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.DialogProvider;
|
import net.osmand.plus.activities.DialogProvider;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.views.ContextMenuLayer.IContextMenuProvider;
|
||||||
|
import net.osmand.plus.views.OsmandMapLayer;
|
||||||
|
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
||||||
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
|
@ -43,7 +48,7 @@ import android.view.WindowManager;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class OsmBugsLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider, DialogProvider {
|
public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider, DialogProvider {
|
||||||
|
|
||||||
private static final Log log = LogUtil.getLog(OsmBugsLayer.class);
|
private static final Log log = LogUtil.getLog(OsmBugsLayer.class);
|
||||||
private final static int startZoom = 8;
|
private final static int startZoom = 8;
|
||||||
|
@ -361,7 +366,7 @@ public class OsmBugsLayer extends OsmandMapLayer implements ContextMenuLayer.ICo
|
||||||
String text = ((EditText)openBug.findViewById(R.id.BugMessage)).getText().toString();
|
String text = ((EditText)openBug.findViewById(R.id.BugMessage)).getText().toString();
|
||||||
String author = ((EditText)openBug.findViewById(R.id.AuthorName)).getText().toString();
|
String author = ((EditText)openBug.findViewById(R.id.AuthorName)).getText().toString();
|
||||||
// do not set name as author it is ridiculous in that case
|
// do not set name as author it is ridiculous in that case
|
||||||
OsmandApplication.getSettings().USER_OSM_BUG_NAME.set(author);
|
view.getApplication().getSettings().USER_OSM_BUG_NAME.set(author);
|
||||||
boolean bug = createNewBug(latitude, longitude, text, author);
|
boolean bug = createNewBug(latitude, longitude, text, author);
|
||||||
if (bug) {
|
if (bug) {
|
||||||
AccessibleToast.makeText(activity, activity.getResources().getString(R.string.osb_add_dialog_success), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(activity, activity.getResources().getString(R.string.osb_add_dialog_success), Toast.LENGTH_LONG).show();
|
||||||
|
@ -378,7 +383,7 @@ public class OsmBugsLayer extends OsmandMapLayer implements ContextMenuLayer.ICo
|
||||||
|
|
||||||
|
|
||||||
public void openBug(final double latitude, final double longitude){
|
public void openBug(final double latitude, final double longitude){
|
||||||
OsmandSettings settings = OsmandApplication.getSettings();
|
OsmandSettings settings = view.getApplication().getSettings();
|
||||||
openBugAlertDialog(latitude, longitude, "", settings.USER_OSM_BUG_NAME.get());
|
openBugAlertDialog(latitude, longitude, "", settings.USER_OSM_BUG_NAME.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,7 +397,7 @@ public class OsmBugsLayer extends OsmandMapLayer implements ContextMenuLayer.ICo
|
||||||
builder.setTitle(R.string.osb_comment_dialog_title);
|
builder.setTitle(R.string.osb_comment_dialog_title);
|
||||||
final View view = activity.getLayoutInflater().inflate(R.layout.open_bug, null);
|
final View view = activity.getLayoutInflater().inflate(R.layout.open_bug, null);
|
||||||
builder.setView(view);
|
builder.setView(view);
|
||||||
((EditText)view.findViewById(R.id.AuthorName)).setText(OsmandApplication.getSettings().USER_OSM_BUG_NAME.get());
|
((EditText)view.findViewById(R.id.AuthorName)).setText(this.view.getApplication().getSettings().USER_OSM_BUG_NAME.get());
|
||||||
builder.setNegativeButton(R.string.default_buttons_cancel, null);
|
builder.setNegativeButton(R.string.default_buttons_cancel, null);
|
||||||
builder.setPositiveButton(R.string.osb_comment_dialog_add_button, new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(R.string.osb_comment_dialog_add_button, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -400,7 +405,7 @@ public class OsmBugsLayer extends OsmandMapLayer implements ContextMenuLayer.ICo
|
||||||
OpenStreetBug bug = (OpenStreetBug) args.getSerializable(KEY_BUG);
|
OpenStreetBug bug = (OpenStreetBug) args.getSerializable(KEY_BUG);
|
||||||
String text = ((EditText)view.findViewById(R.id.BugMessage)).getText().toString();
|
String text = ((EditText)view.findViewById(R.id.BugMessage)).getText().toString();
|
||||||
String author = ((EditText)view.findViewById(R.id.AuthorName)).getText().toString();
|
String author = ((EditText)view.findViewById(R.id.AuthorName)).getText().toString();
|
||||||
OsmandApplication.getSettings().USER_OSM_BUG_NAME.set(author);
|
OsmBugsLayer.this.view.getApplication().getSettings().USER_OSM_BUG_NAME.set(author);
|
||||||
boolean added = addingComment(bug.getId(), text, author);
|
boolean added = addingComment(bug.getId(), text, author);
|
||||||
if (added) {
|
if (added) {
|
||||||
AccessibleToast.makeText(activity, activity.getResources().getString(R.string.osb_comment_dialog_success), Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(activity, activity.getResources().getString(R.string.osb_comment_dialog_success), Toast.LENGTH_LONG).show();
|
75
OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java
Normal file
75
OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
package net.osmand.plus.osmedit;
|
||||||
|
|
||||||
|
import gnu.trove.list.array.TIntArrayList;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
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.views.OsmandMapTileView;
|
||||||
|
|
||||||
|
public class OsmEditingPlugin extends OsmandPlugin {
|
||||||
|
private static final String ID = "osm.editing.plugin";
|
||||||
|
private OsmandSettings settings;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getId() {
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean init(OsmandApplication app) {
|
||||||
|
settings = app.getSettings();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private OsmBugsLayer osmBugsLayer;
|
||||||
|
private EditingPOIActivity poiActions;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateLayers(OsmandMapTileView mapView){
|
||||||
|
if(mapView.getLayers().contains(osmBugsLayer) != settings.SHOW_OSM_BUGS.get()){
|
||||||
|
if(settings.SHOW_OSM_BUGS.get()){
|
||||||
|
mapView.addLayer(osmBugsLayer, 2);
|
||||||
|
} else {
|
||||||
|
mapView.removeLayer(osmBugsLayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerLayers(MapActivity activity){
|
||||||
|
osmBugsLayer = new OsmBugsLayer(activity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mapActivityCreate(MapActivity activity) {
|
||||||
|
poiActions = new EditingPOIActivity(activity);
|
||||||
|
activity.addDialogProvider(poiActions);
|
||||||
|
activity.addDialogProvider(osmBugsLayer);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public EditingPOIActivity getPoiActions() {
|
||||||
|
return poiActions;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handleContextMenuAction(int resId, final double latitude, final double longitude) {
|
||||||
|
if (resId == R.string.context_menu_item_create_poi) {
|
||||||
|
poiActions.showCreateDialog(latitude, longitude);
|
||||||
|
return true;
|
||||||
|
} else if (resId == R.string.context_menu_item_open_bug) {
|
||||||
|
osmBugsLayer.openBug(latitude, longitude);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerContextMenuActions(double latitude, double longitude, TIntArrayList list) {
|
||||||
|
list.add(R.string.context_menu_item_create_poi);
|
||||||
|
list.add(R.string.context_menu_item_open_bug);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -27,8 +27,6 @@ import android.widget.TextView;
|
||||||
|
|
||||||
public class ContextMenuLayer extends OsmandMapLayer {
|
public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public interface IContextMenuProvider {
|
public interface IContextMenuProvider {
|
||||||
|
|
||||||
public void collectObjectsFromPoint(PointF point, List<Object> o);
|
public void collectObjectsFromPoint(PointF point, List<Object> o);
|
||||||
|
@ -42,7 +40,6 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
public DialogInterface.OnClickListener getActionListener(List<String> actionsList, Object o);
|
public DialogInterface.OnClickListener getActionListener(List<String> actionsList, Object o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private LatLon latLon;
|
private LatLon latLon;
|
||||||
private IContextMenuProvider selectedContextProvider;
|
private IContextMenuProvider selectedContextProvider;
|
||||||
private List<Object> selectedObjects = new ArrayList<Object>();
|
private List<Object> selectedObjects = new ArrayList<Object>();
|
||||||
|
|
|
@ -11,11 +11,12 @@ import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.data.Amenity;
|
import net.osmand.data.Amenity;
|
||||||
import net.osmand.data.AmenityType;
|
import net.osmand.data.AmenityType;
|
||||||
import net.osmand.osm.LatLon;
|
import net.osmand.osm.LatLon;
|
||||||
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.PoiFilter;
|
import net.osmand.plus.PoiFilter;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.ResourceManager;
|
import net.osmand.plus.ResourceManager;
|
||||||
import net.osmand.plus.activities.EditingPOIActivity;
|
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.osmedit.OsmEditingPlugin;
|
||||||
import net.osmand.plus.render.RenderingIcons;
|
import net.osmand.plus.render.RenderingIcons;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.AlertDialog.Builder;
|
import android.app.AlertDialog.Builder;
|
||||||
|
@ -54,10 +55,8 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
||||||
private ResourceManager resourceManager;
|
private ResourceManager resourceManager;
|
||||||
private PoiFilter filter;
|
private PoiFilter filter;
|
||||||
private DisplayMetrics dm;
|
private DisplayMetrics dm;
|
||||||
private final MapActivity activity;
|
|
||||||
|
|
||||||
public POIMapLayer(MapActivity activity) {
|
public POIMapLayer(MapActivity activity) {
|
||||||
this.activity = activity;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -307,30 +306,27 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
||||||
final int phoneIndex = a.getPhone() != null ? ind++ : -1;
|
final int phoneIndex = a.getPhone() != null ? ind++ : -1;
|
||||||
final int siteIndex = a.getSite() != null ? ind++ : -1;
|
final int siteIndex = a.getSite() != null ? ind++ : -1;
|
||||||
final int descriptionIndex = a.getDescription() != null ? ind++ : -1;
|
final int descriptionIndex = a.getDescription() != null ? ind++ : -1;
|
||||||
|
if(a.getDescription() != null){
|
||||||
|
actionsList.add(this.view.getResources().getString(R.string.poi_context_menu_showdescription));
|
||||||
|
}
|
||||||
if(a.getPhone() != null){
|
if(a.getPhone() != null){
|
||||||
actionsList.add(this.view.getResources().getString(R.string.poi_context_menu_call));
|
actionsList.add(this.view.getResources().getString(R.string.poi_context_menu_call));
|
||||||
}
|
}
|
||||||
if(a.getSite() != null){
|
if(a.getSite() != null){
|
||||||
actionsList.add(this.view.getResources().getString(R.string.poi_context_menu_website));
|
actionsList.add(this.view.getResources().getString(R.string.poi_context_menu_website));
|
||||||
}
|
}
|
||||||
if(a.getDescription() != null){
|
final OsmEditingPlugin editingPlugin = OsmandPlugin.getEnabledPlugin(OsmEditingPlugin.class);
|
||||||
actionsList.add(this.view.getResources().getString(R.string.poi_context_menu_showdescription));
|
final int modifyInd = editingPlugin != null ? ind++ : -1;
|
||||||
}
|
final int deleteInd = editingPlugin != null ? ind++ : -1;
|
||||||
final int modifyInd = ind++;
|
if (editingPlugin != null) {
|
||||||
actionsList.add(this.view.getResources().getString(R.string.poi_context_menu_modify));
|
actionsList.add(this.view.getResources().getString(R.string.poi_context_menu_modify));
|
||||||
final int deleteInd = ind++;
|
|
||||||
actionsList.add(this.view.getResources().getString(R.string.poi_context_menu_delete));
|
actionsList.add(this.view.getResources().getString(R.string.poi_context_menu_delete));
|
||||||
|
}
|
||||||
|
|
||||||
final EditingPOIActivity edit = activity.getPoiActions();
|
|
||||||
return new DialogInterface.OnClickListener(){
|
return new DialogInterface.OnClickListener(){
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
if (which == modifyInd) {
|
if (which == phoneIndex) {
|
||||||
edit.showEditDialog(a);
|
|
||||||
} else if(which == deleteInd) {
|
|
||||||
edit.showDeleteDialog(a);
|
|
||||||
} else if (which == phoneIndex) {
|
|
||||||
try {
|
try {
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
intent.setData(Uri.parse("tel:"+a.getPhone())); //$NON-NLS-1$
|
intent.setData(Uri.parse("tel:"+a.getPhone())); //$NON-NLS-1$
|
||||||
|
@ -350,6 +346,10 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
||||||
}
|
}
|
||||||
} else if (which == descriptionIndex) {
|
} else if (which == descriptionIndex) {
|
||||||
showDescriptionDialog(a);
|
showDescriptionDialog(a);
|
||||||
|
} else if (which == modifyInd) {
|
||||||
|
editingPlugin.getPoiActions().showEditDialog(a);
|
||||||
|
} else if(which == deleteInd) {
|
||||||
|
editingPlugin.getPoiActions().showDeleteDialog(a);
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ public abstract class AbstractPrologCommandPlayer implements CommandPlayer {
|
||||||
prologSystem.clearTheory();
|
prologSystem.clearTheory();
|
||||||
voiceDir = null;
|
voiceDir = null;
|
||||||
if (voiceProvider != null) {
|
if (voiceProvider != null) {
|
||||||
File parent = OsmandApplication.getSettings().extendOsmandPath(ResourceManager.VOICE_PATH);
|
File parent = ((OsmandApplication)ctx.getApplicationContext()).getSettings().extendOsmandPath(ResourceManager.VOICE_PATH);
|
||||||
voiceDir = new File(parent, voiceProvider);
|
voiceDir = new File(parent, voiceProvider);
|
||||||
if (!voiceDir.exists()) {
|
if (!voiceDir.exists()) {
|
||||||
voiceDir = null;
|
voiceDir = null;
|
||||||
|
|
Loading…
Reference in a new issue