Add configure profile, switch profile aidl ID
This commit is contained in:
parent
c9d24fc7f5
commit
915dc9800b
2 changed files with 16 additions and 10 deletions
|
@ -4,6 +4,8 @@ public interface OsmAndCustomizationConstants {
|
|||
|
||||
// Navigation Drawer:
|
||||
String DRAWER_ITEM_ID_SCHEME = "drawer.action.";
|
||||
String DRAWER_SWITCH_PROFILE_ID = DRAWER_ITEM_ID_SCHEME + "switch_profile";
|
||||
String DRAWER_CONFIGURE_PROFILE_ID = DRAWER_ITEM_ID_SCHEME + "configure_profile";
|
||||
String DRAWER_DASHBOARD_ID = DRAWER_ITEM_ID_SCHEME + "dashboard";
|
||||
String DRAWER_MAP_MARKERS_ID = DRAWER_ITEM_ID_SCHEME + "map_markers";
|
||||
String DRAWER_MY_PLACES_ID = DRAWER_ITEM_ID_SCHEME + "my_places";
|
||||
|
|
|
@ -91,6 +91,7 @@ import java.util.Map;
|
|||
|
||||
import static net.osmand.IndexConstants.GPX_FILE_EXT;
|
||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_CONFIGURE_MAP_ID;
|
||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_CONFIGURE_PROFILE_ID;
|
||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_CONFIGURE_SCREEN_ID;
|
||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_DASHBOARD_ID;
|
||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_DIRECTIONS_ID;
|
||||
|
@ -104,6 +105,7 @@ import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_OSMAND_LIVE
|
|||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_PLUGINS_ID;
|
||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_SEARCH_ID;
|
||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_SETTINGS_ID;
|
||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_SWITCH_PROFILE_ID;
|
||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_TRAVEL_GUIDES_ID;
|
||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_ADD_GPX_WAYPOINT;
|
||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_ADD_ID;
|
||||
|
@ -145,7 +147,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
private static final int DIALOG_RELOAD_TITLE = 103;
|
||||
|
||||
private static final int DIALOG_SAVE_DIRECTIONS = 106;
|
||||
|
||||
|
||||
private static final int DRAWER_MODE_NORMAL = 0;
|
||||
private static final int DRAWER_MODE_SWITCH_PROFILE = 1;
|
||||
|
||||
|
@ -476,7 +478,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
mapActivity.showQuickSearch(latitude, longitude);
|
||||
} else if (standardId == R.string.context_menu_item_directions_from) {
|
||||
//if (OsmAndLocationProvider.isLocationPermissionAvailable(mapActivity)) {
|
||||
enterDirectionsFromPoint(latitude, longitude);
|
||||
enterDirectionsFromPoint(latitude, longitude);
|
||||
//} else {
|
||||
// ActivityCompat.requestPermissions(mapActivity,
|
||||
// new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
|
||||
|
@ -535,17 +537,17 @@ public class MapActivityActions implements DialogProvider {
|
|||
}
|
||||
|
||||
public void enterRoutePlanningModeGivenGpx(GPXFile gpxFile, LatLon from, PointDescription fromName,
|
||||
boolean useIntermediatePointsByDefault, boolean showMenu) {
|
||||
boolean useIntermediatePointsByDefault, boolean showMenu) {
|
||||
enterRoutePlanningModeGivenGpx(gpxFile, from, fromName, useIntermediatePointsByDefault, showMenu, MapRouteInfoMenu.DEFAULT_MENU_STATE);
|
||||
}
|
||||
|
||||
public void enterRoutePlanningModeGivenGpx(GPXFile gpxFile, LatLon from, PointDescription fromName,
|
||||
boolean useIntermediatePointsByDefault, boolean showMenu, int menuState) {
|
||||
boolean useIntermediatePointsByDefault, boolean showMenu, int menuState) {
|
||||
enterRoutePlanningModeGivenGpx(gpxFile, null, from, fromName, useIntermediatePointsByDefault, showMenu, menuState);
|
||||
}
|
||||
|
||||
public void enterRoutePlanningModeGivenGpx(GPXFile gpxFile, ApplicationMode appMode, LatLon from, PointDescription fromName,
|
||||
boolean useIntermediatePointsByDefault, boolean showMenu, int menuState) {
|
||||
boolean useIntermediatePointsByDefault, boolean showMenu, int menuState) {
|
||||
settings.USE_INTERMEDIATE_POINTS_NAVIGATION.set(useIntermediatePointsByDefault);
|
||||
OsmandApplication app = mapActivity.getMyApplication();
|
||||
TargetPointsHelper targets = app.getTargetPointsHelper();
|
||||
|
@ -727,7 +729,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
private ContextMenuAdapter createSwitchProfileOptionsMenu(final OsmandApplication app, ContextMenuAdapter optionsMenuHelper, boolean nightMode) {
|
||||
drawerMode = DRAWER_MODE_NORMAL;
|
||||
createProfilesController(app, optionsMenuHelper, nightMode, true);
|
||||
|
||||
|
||||
List<ApplicationMode> activeModes = ApplicationMode.values(app);
|
||||
ApplicationMode currentMode = app.getSettings().APPLICATION_MODE.get();
|
||||
|
||||
|
@ -759,7 +761,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
})
|
||||
.createItem());
|
||||
}
|
||||
|
||||
|
||||
int activeColorPrimaryResId = nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light;
|
||||
optionsMenuHelper.addItem(new ItemBuilder().setLayout(R.layout.profile_list_item)
|
||||
.setColor(activeColorPrimaryResId)
|
||||
|
@ -778,7 +780,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
}
|
||||
|
||||
private ContextMenuAdapter createNormalOptionsMenu(final OsmandApplication app, ContextMenuAdapter optionsMenuHelper, boolean nightMode) {
|
||||
|
||||
|
||||
createProfilesController(app, optionsMenuHelper, nightMode, false);
|
||||
|
||||
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.home, mapActivity)
|
||||
|
@ -1055,6 +1057,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
int icArrowResId = listExpanded ? R.drawable.ic_action_arrow_drop_up : R.drawable.ic_action_arrow_drop_down;
|
||||
final int nextMode = listExpanded ? DRAWER_MODE_NORMAL : DRAWER_MODE_SWITCH_PROFILE;
|
||||
optionsMenuHelper.addItem(new ItemBuilder().setLayout(R.layout.main_menu_drawer_btn_switch_profile)
|
||||
.setId(DRAWER_SWITCH_PROFILE_ID)
|
||||
.setIcon(currentMode.getIconRes())
|
||||
.setSecondaryIcon(icArrowResId)
|
||||
.setColor(currentMode.getIconColorInfo().getColor(nightMode))
|
||||
|
@ -1070,6 +1073,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
})
|
||||
.createItem());
|
||||
optionsMenuHelper.addItem(new ItemBuilder().setLayout(R.layout.main_menu_drawer_btn_configure_profile)
|
||||
.setId(DRAWER_CONFIGURE_PROFILE_ID)
|
||||
.setColor(currentMode.getIconColorInfo().getColor(nightMode))
|
||||
.setTitle(getString(R.string.configure_profile))
|
||||
.setListener(new ItemClickListener() {
|
||||
|
@ -1084,8 +1088,8 @@ public class MapActivityActions implements DialogProvider {
|
|||
}
|
||||
|
||||
private String getProfileDescription(OsmandApplication app, ApplicationMode mode,
|
||||
Map<String, RoutingProfileDataObject> profilesObjects, String defaultDescription){
|
||||
String description = defaultDescription;
|
||||
Map<String, RoutingProfileDataObject> profilesObjects, String defaultDescription) {
|
||||
String description = defaultDescription;
|
||||
|
||||
String routingProfileKey = mode.getRoutingProfile();
|
||||
if (!Algorithms.isEmpty(routingProfileKey)) {
|
||||
|
|
Loading…
Reference in a new issue