Added support for modifying content fo point action's menu through AIDL.
This commit is contained in:
parent
49d7529f9c
commit
e3fcfe295a
11 changed files with 67 additions and 56 deletions
|
@ -161,11 +161,8 @@ interface IOsmAndAidlInterface {
|
|||
boolean showSqliteDbFile(String fileName);
|
||||
boolean hideSqliteDbFile(String fileName);
|
||||
|
||||
boolean setNavDrawerLogoWithParams(in String imageUri, String packageName, String intent);
|
||||
boolean setNavDrawerFooterParams(in String packageName, String intent, String appName);
|
||||
|
||||
|
||||
boolean setNavDrawerLogoWithIntent(in String imageUri, String packageName, String intent);
|
||||
boolean setNavDrawerFooterAction(in String packageName, String intent, String appName);
|
||||
boolean setPointMenuEnabledIds(in List<String> ids);
|
||||
boolean setPointMenuDisabledIds(in List<String> ids);
|
||||
boolean setPointMenuEnabledPatterns(in List<String> patterns);
|
||||
boolean setPointMenuDisabledPatterns(in List<String> patterns);
|
||||
}
|
|
@ -1860,32 +1860,15 @@ public class OsmandAidlApi {
|
|||
return true;
|
||||
}
|
||||
|
||||
boolean setNavDrawerLogoWithIntent(
|
||||
boolean setNavDrawerLogoWithParams(
|
||||
@Nullable String uri, @Nullable String packageName, @Nullable String intent) {
|
||||
|
||||
return app.getAppCustomization().setNavDrawerLogoWithIntent(uri, packageName, intent);
|
||||
return app.getAppCustomization().setNavDrawerLogoWithParams(uri, packageName, intent);
|
||||
}
|
||||
|
||||
boolean setNavDrawerFooterAction(@Nullable String packageName, @Nullable String intent, @Nullable String appName) {
|
||||
|
||||
boolean setNavDrawerFooterParams(@Nullable String packageName, @Nullable String intent, @Nullable String appName) {
|
||||
return app.getAppCustomization().setNavDrawerFooterAction(packageName, intent, appName);
|
||||
}
|
||||
|
||||
boolean setPointMenuEnabledIds(List<String> ids){
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean setPointMenuDisabledIds(List<String> ids){
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean setPointMenuEnabledPatterns(List<String> patterns){
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean setPointMenuDisabledPatterns(List<String> patterns){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private static AGpxFileDetails createGpxFileDetails(@NonNull GPXTrackAnalysis a) {
|
||||
|
|
|
@ -773,35 +773,16 @@ public class OsmandAidlService extends Service {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean setNavDrawerLogoWithIntent(String imageUri, String packageName, String intent) throws RemoteException {
|
||||
OsmandAidlApi api = getApi("setNavDrawerLogoWithIntent");
|
||||
return api != null && api.setNavDrawerLogoWithIntent(imageUri, packageName, intent);
|
||||
public boolean setNavDrawerLogoWithParams(String imageUri, String packageName, String intent) throws RemoteException {
|
||||
OsmandAidlApi api = getApi("setNavDrawerLogoWithParams");
|
||||
return api != null && api.setNavDrawerLogoWithParams(imageUri, packageName, intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setNavDrawerFooterAction(String packageName, String intent, String appName) throws RemoteException {
|
||||
OsmandAidlApi api = getApi ("setNavDrawerFooterAction");
|
||||
return api != null && api.setNavDrawerFooterAction(packageName, intent, appName);
|
||||
public boolean setNavDrawerFooterParams(String packageName, String intent, String appName) throws RemoteException {
|
||||
OsmandAidlApi api = getApi ("setNavDrawerFooterParams");
|
||||
return api != null && api.setNavDrawerFooterParams(packageName, intent, appName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setPointMenuEnabledIds(List<String> ids) throws RemoteException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setPointMenuDisabledIds(List<String> ids) throws RemoteException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setPointMenuEnabledPatterns(List<String> patterns) throws RemoteException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setPointMenuDisabledPatterns(List<String> patterns) throws RemoteException {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.osmand.plus;
|
||||
|
||||
import alice.tuprolog.Int;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
@ -74,6 +75,8 @@ public class ContextMenuAdapter {
|
|||
items.remove(position);
|
||||
}
|
||||
|
||||
public void clearAdapter() { items.clear(); }
|
||||
|
||||
public void setDefaultLayoutId(int defaultLayoutId) {
|
||||
this.DEFAULT_LAYOUT_ID = defaultLayoutId;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package net.osmand.plus;
|
||||
|
||||
import static net.osmand.plus.osmedit.OpenstreetmapLocalUtil.LOG;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
|
@ -221,7 +223,6 @@ public class OsmAndAppCustomization {
|
|||
// ignore
|
||||
}
|
||||
if(packageName!=null && intent!=null) {
|
||||
Log.d("setNavDrawerLogo", packageName + ", " + intent);
|
||||
navDrawerParams = new ArrayList<>();
|
||||
navDrawerParams.add(packageName);
|
||||
navDrawerParams.add(intent);
|
||||
|
@ -286,7 +287,8 @@ public class OsmAndAppCustomization {
|
|||
return set.contains(appMode);
|
||||
}
|
||||
|
||||
public boolean setNavDrawerLogoWithIntent(String uri, @Nullable String packageName, @Nullable String intent) {
|
||||
public boolean setNavDrawerLogoWithParams(String uri, @Nullable String packageName, @Nullable String intent) {
|
||||
LOG.info("setNavDrawerLogoWithParams called");
|
||||
return setNavDrawerLogo(uri, packageName, intent);
|
||||
}
|
||||
|
||||
|
|
|
@ -70,4 +70,23 @@ public interface OsmAndCustomizationConstants {
|
|||
String ROUTE_PLANNING_HUD_ID = HUD_BTN_ID_SCHEME + "route_planning";
|
||||
String ZOOM_IN_HUD_ID = HUD_BTN_ID_SCHEME + "zoom_id";
|
||||
String ZOOM_OUT_HUD_ID = HUD_BTN_ID_SCHEME + "zoom_out";
|
||||
|
||||
//Point's Context Action Menu:
|
||||
String POINTS_ACTION_MENU = "point.actions.";
|
||||
String POINT_DIRECTIONS_FROM_ID = POINTS_ACTION_MENU + "directions_from";
|
||||
String POINT_SEARCH_NEARBY = POINTS_ACTION_MENU + "search_nearby";
|
||||
String POINT_CHANGE_MARKER_POSITION = POINTS_ACTION_MENU + "change_m_position";
|
||||
String POINT_MARK_AS_PARKING_LOC = POINTS_ACTION_MENU + "mark_as_parking";
|
||||
String POINT_MEASURE_DISTANCE = POINTS_ACTION_MENU + "measure_distance";
|
||||
String POINT_EDIT_GPX_WP = POINTS_ACTION_MENU + "edit_gpx_waypoint";
|
||||
String POINT_ADD_GPX_WAYPOINT = POINTS_ACTION_MENU + "add_gpx_waypoint";
|
||||
String POINT_UPDATE_MAP = POINTS_ACTION_MENU + "update_map";
|
||||
String POINT_DOWNLOAD_MAP = POINTS_ACTION_MENU + "download_map";
|
||||
String POINT_MODIFY_POI = POINTS_ACTION_MENU + "modify_poi";
|
||||
String POINT_MODIFY_OSM_CHANGE = POINTS_ACTION_MENU + "modify_osm_change";
|
||||
String POINT_CREATE_POI = POINTS_ACTION_MENU + "create_poi";
|
||||
String POINT_MODIFY_OSM_NOTE = POINTS_ACTION_MENU + "modify_osm_note";
|
||||
String POINT_OPEN_OSM_NOTE = POINTS_ACTION_MENU + "open_osm_note";
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -51,7 +51,6 @@ import net.osmand.plus.R;
|
|||
import net.osmand.plus.TargetPointsHelper;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.activities.actions.OsmAndDialogs;
|
||||
import net.osmand.plus.audionotes.SortByMenuBottomSheetDialogFragment;
|
||||
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
|
||||
import net.osmand.plus.dialogs.FavoriteDialogs;
|
||||
import net.osmand.plus.download.IndexItem;
|
||||
|
@ -80,6 +79,8 @@ import java.util.ArrayList;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_ADD_GPX_WAYPOINT;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_DIRECTIONS_FROM_ID;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_CONFIGURE_MAP_ID;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_CONFIGURE_SCREEN_ID;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_DASHBOARD_ID;
|
||||
|
@ -95,6 +96,9 @@ import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_PLUGINS_ID;
|
|||
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_SEARCH_ID;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_SETTINGS_ID;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_TRAVEL_GUIDES_ID;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_EDIT_GPX_WP;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_MEASURE_DISTANCE;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_SEARCH_NEARBY;
|
||||
import static net.osmand.plus.helpers.ImportHelper.GPX_SUFFIX;
|
||||
|
||||
public class MapActivityActions implements DialogProvider {
|
||||
|
@ -320,11 +324,13 @@ public class MapActivityActions implements DialogProvider {
|
|||
|
||||
adapter.addItem(itemBuilder
|
||||
.setTitleId(R.string.context_menu_item_directions_from, mapActivity)
|
||||
.setId(POINT_DIRECTIONS_FROM_ID)
|
||||
.setIcon(R.drawable.ic_action_route_direction_from_here)
|
||||
.setOrder(DIRECTIONS_FROM_ITEM_ORDER)
|
||||
.createItem());
|
||||
adapter.addItem(itemBuilder
|
||||
.setTitleId(R.string.context_menu_item_search, mapActivity)
|
||||
.setId(POINT_SEARCH_NEARBY)
|
||||
.setIcon(R.drawable.ic_action_search_dark)
|
||||
.setOrder(SEARCH_NEAR_ITEM_ORDER)
|
||||
.createItem());
|
||||
|
@ -347,6 +353,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
&& getMyApplication().getSelectedGpxHelper().getSelectedGPXFile((WptPt) selectedObj) != null) {
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setTitleId(R.string.context_menu_item_edit_waypoint, mapActivity)
|
||||
.setId(POINT_EDIT_GPX_WP)
|
||||
.setIcon(R.drawable.ic_action_edit_dark)
|
||||
.setOrder(EDIT_GPX_WAYPOINT_ITEM_ORDER)
|
||||
.setListener(listener).createItem());
|
||||
|
@ -354,6 +361,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
|| (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null)) {
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setTitleId(R.string.context_menu_item_add_waypoint, mapActivity)
|
||||
.setTitle(POINT_ADD_GPX_WAYPOINT)
|
||||
.setIcon(R.drawable.ic_action_gnew_label_dark)
|
||||
.setOrder(ADD_GPX_WAYPOINT_ITEM_ORDER)
|
||||
.setListener(listener).createItem());
|
||||
|
@ -361,6 +369,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
|
||||
adapter.addItem(itemBuilder
|
||||
.setTitleId(R.string.measurement_tool, mapActivity)
|
||||
.setId(POINT_MEASURE_DISTANCE)
|
||||
.setIcon(R.drawable.ic_action_ruler)
|
||||
.setOrder(MEASURE_DISTANCE_ITEM_ORDER)
|
||||
.createItem());
|
||||
|
|
|
@ -47,6 +47,11 @@ import org.apache.commons.logging.Log;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_CREATE_POI;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_MODIFY_OSM_CHANGE;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_MODIFY_OSM_NOTE;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_MODIFY_POI;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_OPEN_OSM_NOTE;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.OSM_NOTES;
|
||||
|
||||
|
||||
|
@ -230,18 +235,21 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
}
|
||||
if (isEditable) {
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.poi_context_menu_modify, mapActivity)
|
||||
.setId(POINT_MODIFY_POI)
|
||||
.setIcon(R.drawable.ic_action_edit_dark)
|
||||
.setOrder(MODIFY_POI_ITEM_ORDER)
|
||||
.setListener(listener)
|
||||
.createItem());
|
||||
} else if (selectedObj instanceof OpenstreetmapPoint && ((OpenstreetmapPoint) selectedObj).getAction() != Action.DELETE) {
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.poi_context_menu_modify_osm_change, mapActivity)
|
||||
.setId(POINT_MODIFY_OSM_CHANGE)
|
||||
.setIcon(R.drawable.ic_action_edit_dark)
|
||||
.setOrder(MODIFY_OSM_CHANGE_ITEM_ORDER)
|
||||
.setListener(listener)
|
||||
.createItem());
|
||||
} else {
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.context_menu_item_create_poi, mapActivity)
|
||||
.setId(POINT_CREATE_POI)
|
||||
.setIcon(R.drawable.ic_action_plus_dark)
|
||||
.setOrder(CREATE_POI_ITEM_ORDER)
|
||||
.setListener(listener)
|
||||
|
@ -249,12 +257,14 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
}
|
||||
if (selectedObj instanceof OsmNotesPoint) {
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.context_menu_item_modify_note, mapActivity)
|
||||
.setId(POINT_MODIFY_OSM_NOTE)
|
||||
.setIcon(R.drawable.ic_action_edit_dark)
|
||||
.setOrder(MODIFY_OSM_NOTE_ITEM_ORDER)
|
||||
.setListener(listener)
|
||||
.createItem());
|
||||
} else {
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.context_menu_item_open_note, mapActivity)
|
||||
.setId(POINT_OPEN_OSM_NOTE)
|
||||
.setIcon(R.drawable.ic_action_bug_dark)
|
||||
.setOrder(OPEN_OSM_NOTE_ITEM_ORDER)
|
||||
.setListener(listener)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package net.osmand.plus.parkingpoint;
|
||||
|
||||
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_MARK_AS_PARKING_LOC;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
|
@ -233,6 +235,7 @@ public class ParkingPositionPlugin extends OsmandPlugin {
|
|||
};
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setTitleId(R.string.context_menu_item_add_parking_point, mapActivity)
|
||||
.setId(POINT_MARK_AS_PARKING_LOC)
|
||||
.setIcon(R.drawable.ic_action_parking_dark)
|
||||
.setOrder(MARK_AS_PARKING_POS_ITEM_ORDER)
|
||||
.setListener(addListener)
|
||||
|
|
|
@ -46,8 +46,10 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_DOWNLOAD_MAP;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.OVERLAY_MAP;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.UNDERLAY_MAP;
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_UPDATE_MAP;
|
||||
|
||||
public class OsmandRasterMapsPlugin extends OsmandPlugin {
|
||||
public static final String ID = "osmand.rastermaps";
|
||||
|
@ -370,11 +372,13 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
|
|||
};
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setTitleId(R.string.context_menu_item_update_map, mapActivity)
|
||||
.setId(POINT_UPDATE_MAP)
|
||||
.setIcon(R.drawable.ic_action_refresh_dark)
|
||||
.setOrder(UPDATE_MAP_ITEM_ORDER)
|
||||
.setListener(listener).createItem());
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setTitleId(R.string.shared_string_download_map, mapActivity)
|
||||
.setId(POINT_DOWNLOAD_MAP)
|
||||
.setIcon(R.drawable.ic_action_import)
|
||||
.setOrder(DOWNLOAD_MAP_ITEM_ORDER)
|
||||
.setListener(listener).createItem());
|
||||
|
|
|
@ -55,8 +55,6 @@ import net.osmand.plus.R;
|
|||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.MapActivityActions;
|
||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||
import net.osmand.plus.mapcontextmenu.MenuController;
|
||||
import net.osmand.plus.mapcontextmenu.MenuController.MenuState;
|
||||
import net.osmand.plus.mapcontextmenu.other.MapMultiSelectionMenu;
|
||||
import net.osmand.plus.render.MapRenderRepositories;
|
||||
import net.osmand.plus.render.NativeOsmandLibrary;
|
||||
|
@ -77,6 +75,7 @@ import java.util.Set;
|
|||
|
||||
import gnu.trove.list.array.TIntArrayList;
|
||||
|
||||
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_CHANGE_MARKER_POSITION;
|
||||
import static net.osmand.plus.mapcontextmenu.controllers.TransportStopController.SHOW_STOPS_RADIUS_METERS;
|
||||
|
||||
public class ContextMenuLayer extends OsmandMapLayer {
|
||||
|
@ -281,6 +280,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
};
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setTitleId(R.string.change_markers_position, activity)
|
||||
.setId(POINT_CHANGE_MARKER_POSITION)
|
||||
.setIcon(R.drawable.ic_show_on_map)
|
||||
.setOrder(MapActivityActions.CHANGE_POSITION_ITEM_ORDER)
|
||||
.setClickable(isObjectMoveable(o))
|
||||
|
|
Loading…
Reference in a new issue