add osm bug action
This commit is contained in:
parent
26c20d2079
commit
6d8779e65a
3 changed files with 61 additions and 4 deletions
|
@ -2471,6 +2471,7 @@ If you need help with OsmAnd application, please contact our support team: suppo
|
|||
<string name="quick_action_take_audio_note">Take audio note</string>
|
||||
<string name="quick_action_take_video_note">Take video note</string>
|
||||
<string name="quick_action_take_photo_note">Take photo note</string>
|
||||
<string name="quick_action_add_osm_bug">Add OSM bug</string>
|
||||
<string name="quick_action_navigation_voice">Voice On/Off</string>
|
||||
<string name="quick_action_add_gpx">Add GPX waypoint</string>
|
||||
<string name="quick_action_add_parking">Add Parking place</string>
|
||||
|
@ -2491,6 +2492,7 @@ If you need help with OsmAnd application, please contact our support team: suppo
|
|||
<string name="quick_action_take_audio_note_discr">Tap on action will add audio note to the specified location.</string>
|
||||
<string name="quick_action_take_video_note_discr">Tap on action will add video note to the specified location.</string>
|
||||
<string name="quick_action_take_photo_note_discr">Tap on action will add photo note to the specified location.</string>
|
||||
<string name="quick_action_add_osm_bug_discr">Tap on action will add OSM bug note to the specified location.</string>
|
||||
<string name="quick_action_navigation_voice_discr">Tap on action will disable or enable voice during navigation.</string>
|
||||
<string name="quick_action_add_parking_discr">Tap on action will add Parking place to the specified location.</string>
|
||||
<string name="quick_action_favorite_dialog">Show favorite dialog</string>
|
||||
|
|
|
@ -180,10 +180,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
editPoiDialogFragment.show(mapActivity.getSupportFragmentManager(),
|
||||
EditPoiDialogFragment.TAG);
|
||||
} else if (resId == R.string.context_menu_item_open_note) {
|
||||
if (osmBugsLayer == null) {
|
||||
registerLayers(mapActivity);
|
||||
}
|
||||
osmBugsLayer.openBug(latitude, longitude, "");
|
||||
openOsmNote(mapActivity, latitude, longitude);
|
||||
} else if (resId == R.string.poi_context_menu_delete) {
|
||||
new EditPoiDialogFragment.ShowDeleteDialogAsyncTask(mapActivity)
|
||||
.execute((Amenity) selectedObj);
|
||||
|
@ -228,6 +225,13 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
.setListener(listener).createItem());
|
||||
}
|
||||
|
||||
public void openOsmNote(MapActivity mapActivity, double latitude, double longitude) {
|
||||
if (osmBugsLayer == null) {
|
||||
registerLayers(mapActivity);
|
||||
}
|
||||
osmBugsLayer.openBug(latitude, longitude, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMyPlacesTab(FavoritesActivity favoritesActivity, List<TabActivity.TabItem> mTabs, Intent intent) {
|
||||
if (getDBPOI().getOpenstreetmapPoints().size() > 0 || getDBBug().getOsmbugsPoints().size() > 0) {
|
||||
|
|
|
@ -24,6 +24,7 @@ import net.osmand.plus.activities.MapActivity;
|
|||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
|
||||
import net.osmand.plus.mapcontextmenu.editors.EditCategoryDialogFragment;
|
||||
import net.osmand.plus.mapcontextmenu.editors.SelectCategoryDialogFragment;
|
||||
import net.osmand.plus.osmedit.OsmEditingPlugin;
|
||||
import net.osmand.plus.parkingpoint.ParkingPositionPlugin;
|
||||
import net.osmand.plus.poi.PoiFiltersHelper;
|
||||
import net.osmand.plus.widgets.AutoCompleteTextViewEx;
|
||||
|
@ -92,6 +93,11 @@ public class QuickActionFactory {
|
|||
quickActions.add(new ParkingAction());
|
||||
}
|
||||
|
||||
if (OsmandPlugin.getEnabledPlugin(OsmEditingPlugin.class) != null) {
|
||||
|
||||
quickActions.add(new AddOSMBugAction());
|
||||
}
|
||||
|
||||
quickActions.add(new QuickAction(0, R.string.quick_action_add_configure_map));
|
||||
quickActions.add(new ShowHideFavoritesAction());
|
||||
quickActions.add(new ShowHidePoiAction());
|
||||
|
@ -139,6 +145,9 @@ public class QuickActionFactory {
|
|||
case NavigationVoiceAction.TYPE:
|
||||
return new NavigationVoiceAction();
|
||||
|
||||
case AddOSMBugAction.TYPE:
|
||||
return new AddOSMBugAction();
|
||||
|
||||
default:
|
||||
return new QuickAction();
|
||||
}
|
||||
|
@ -181,6 +190,9 @@ public class QuickActionFactory {
|
|||
case NavigationVoiceAction.TYPE:
|
||||
return new NavigationVoiceAction(quickAction);
|
||||
|
||||
case AddOSMBugAction.TYPE:
|
||||
return new AddOSMBugAction(quickAction);
|
||||
|
||||
default:
|
||||
return quickAction;
|
||||
}
|
||||
|
@ -767,4 +779,43 @@ public class QuickActionFactory {
|
|||
parent.addView(view);
|
||||
}
|
||||
}
|
||||
|
||||
public static class AddOSMBugAction extends QuickAction {
|
||||
public static final int TYPE = 12;
|
||||
|
||||
protected AddOSMBugAction() {
|
||||
id = System.currentTimeMillis();
|
||||
type = TYPE;
|
||||
nameRes = R.string.quick_action_add_osm_bug;
|
||||
iconRes = R.drawable.ic_action_bug_dark;
|
||||
}
|
||||
|
||||
public AddOSMBugAction(QuickAction quickAction) {
|
||||
super(quickAction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(MapActivity activity) {
|
||||
|
||||
LatLon latLon = activity.getMapView()
|
||||
.getCurrentRotatedTileBox()
|
||||
.getCenterLatLon();
|
||||
|
||||
OsmEditingPlugin plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
|
||||
if (plugin != null)
|
||||
plugin.openOsmNote(activity, latLon.getLatitude(), latLon.getLongitude());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawUI(ViewGroup parent, MapActivity activity) {
|
||||
|
||||
View view = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.quick_action_with_text, parent, false);
|
||||
|
||||
((TextView) view.findViewById(R.id.text)).setText(
|
||||
R.string.quick_action_add_osm_bug_discr);
|
||||
|
||||
parent.addView(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue