Updated functionality of waypoints in drawer menu
This commit is contained in:
parent
6de2bab538
commit
d7ca432c32
24 changed files with 415 additions and 332 deletions
|
@ -17,8 +17,8 @@ import android.widget.TextView;
|
||||||
public class ContextMenuAdapter {
|
public class ContextMenuAdapter {
|
||||||
|
|
||||||
public interface OnContextMenuClick {
|
public interface OnContextMenuClick {
|
||||||
|
//boolean return type needed to desribe if drawer needed to be close or not
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog);
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Context ctx;
|
private final Context ctx;
|
||||||
|
|
|
@ -159,7 +159,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
||||||
optionsMenuAdapter = new ContextMenuAdapter(getActivity());
|
optionsMenuAdapter = new ContextMenuAdapter(getActivity());
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(final int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(final int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
if (itemId == R.string.local_index_mi_reload) {
|
if (itemId == R.string.local_index_mi_reload) {
|
||||||
asyncLoader = new LoadGpxTask();
|
asyncLoader = new LoadGpxTask();
|
||||||
asyncLoader.execute(getActivity());
|
asyncLoader.execute(getActivity());
|
||||||
|
@ -175,6 +175,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
optionsMenuAdapter.item(R.string.show_gpx_route)
|
optionsMenuAdapter.item(R.string.show_gpx_route)
|
||||||
|
@ -395,7 +396,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
||||||
private void basicFileOperation(final GpxInfo info, ContextMenuAdapter adapter) {
|
private void basicFileOperation(final GpxInfo info, ContextMenuAdapter adapter) {
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int resId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int resId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
if (resId == R.string.local_index_mi_rename) {
|
if (resId == R.string.local_index_mi_rename) {
|
||||||
renameFile(info);
|
renameFile(info);
|
||||||
} else if (resId == R.string.local_index_unselect_gpx_file ||
|
} else if (resId == R.string.local_index_unselect_gpx_file ||
|
||||||
|
@ -441,6 +442,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
||||||
AccessibleToast.makeText(getActivity(), R.string.gpx_file_is_empty, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(getActivity(), R.string.gpx_file_is_empty, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (info.gpx != null && info.file == null) {
|
if (info.gpx != null && info.file == null) {
|
||||||
|
|
|
@ -176,8 +176,9 @@ public class FavouritesTreeFragment extends OsmandExpandableListFragment {
|
||||||
new OnContextMenuClick() {
|
new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
editPoint(point);
|
editPoint(point);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
Item delete = qa.item(R.string.favourites_context_menu_delete).icons(
|
Item delete = qa.item(R.string.favourites_context_menu_delete).icons(
|
||||||
|
@ -186,8 +187,9 @@ public class FavouritesTreeFragment extends OsmandExpandableListFragment {
|
||||||
new OnContextMenuClick() {
|
new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
deletePoint(point);
|
deletePoint(point);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
MapActivityActions.showObjectContextMenu(qa, getActivity(), onshow);
|
MapActivityActions.showObjectContextMenu(qa, getActivity(), onshow);
|
||||||
|
|
|
@ -51,6 +51,7 @@ import net.osmand.plus.configuremap.ConfigureScreenSettingsActivity;
|
||||||
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
||||||
import net.osmand.plus.helpers.WaypointDialogHelper;
|
import net.osmand.plus.helpers.WaypointDialogHelper;
|
||||||
import net.osmand.plus.osmo.OsMoPositionLayer;
|
import net.osmand.plus.osmo.OsMoPositionLayer;
|
||||||
|
import net.osmand.plus.helpers.WaypointHelper;
|
||||||
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
|
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.views.BaseMapLayer;
|
import net.osmand.plus.views.BaseMapLayer;
|
||||||
|
@ -94,6 +95,9 @@ public class MapActivityActions implements DialogProvider {
|
||||||
private OsmandSettings settings;
|
private OsmandSettings settings;
|
||||||
private RoutingHelper routingHelper;
|
private RoutingHelper routingHelper;
|
||||||
|
|
||||||
|
DrawerLayout mDrawerLayout;
|
||||||
|
ListView mDrawerList;
|
||||||
|
|
||||||
|
|
||||||
public MapActivityActions(MapActivity mapActivity){
|
public MapActivityActions(MapActivity mapActivity){
|
||||||
this.mapActivity = mapActivity;
|
this.mapActivity = mapActivity;
|
||||||
|
@ -727,8 +731,8 @@ public class MapActivityActions implements DialogProvider {
|
||||||
|
|
||||||
public void createOptionsMenuAsDrawer(boolean show){
|
public void createOptionsMenuAsDrawer(boolean show){
|
||||||
final ContextMenuAdapter cm = createOptionsMenu();
|
final ContextMenuAdapter cm = createOptionsMenu();
|
||||||
final DrawerLayout mDrawerLayout = (DrawerLayout) mapActivity.findViewById(R.id.drawer_layout);
|
mDrawerLayout = (DrawerLayout) mapActivity.findViewById(R.id.drawer_layout);
|
||||||
final ListView mDrawerList = (ListView) mapActivity.findViewById(R.id.left_drawer);
|
mDrawerList = (ListView) mapActivity.findViewById(R.id.left_drawer);
|
||||||
mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
|
mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
|
||||||
ListAdapter listAdapter;
|
ListAdapter listAdapter;
|
||||||
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB){
|
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB){
|
||||||
|
@ -751,10 +755,13 @@ public class MapActivityActions implements DialogProvider {
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int which, long id) {
|
public void onItemClick(AdapterView<?> parent, View view, int which, long id) {
|
||||||
OnContextMenuClick click = cm.getClickAdapter(which);
|
OnContextMenuClick click = cm.getClickAdapter(which);
|
||||||
if (click != null) {
|
if (click != null) {
|
||||||
click.onContextMenuClick(cm.getItemId(which), which, false, null);
|
if (click.onContextMenuClick(cm.getItemId(which), which, false, null)){
|
||||||
}
|
|
||||||
mDrawerLayout.closeDrawer(mDrawerList);
|
mDrawerLayout.closeDrawer(mDrawerList);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
mDrawerLayout.closeDrawer(mDrawerList);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (show){
|
if (show){
|
||||||
|
@ -800,12 +807,13 @@ public class MapActivityActions implements DialogProvider {
|
||||||
icons(R.drawable.ic_action_gloc_dark, R.drawable.ic_action_gloc_light)
|
icons(R.drawable.ic_action_gloc_dark, R.drawable.ic_action_gloc_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
if (getMyApplication().accessibilityEnabled()) {
|
if (getMyApplication().accessibilityEnabled()) {
|
||||||
whereAmIDialog();
|
whereAmIDialog();
|
||||||
} else {
|
} else {
|
||||||
mapActivity.getMapViewTrackingUtilities().backToLocationImpl();
|
mapActivity.getMapViewTrackingUtilities().backToLocationImpl();
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
|
|
||||||
|
@ -826,8 +834,9 @@ public class MapActivityActions implements DialogProvider {
|
||||||
optionsMenuHelper.item(t).icons(icon, iconLight)
|
optionsMenuHelper.item(t).icons(icon, iconLight)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
routingHelper.getVoiceRouter().setMute(!routingHelper.getVoiceRouter().isMute());
|
routingHelper.getVoiceRouter().setMute(!routingHelper.getVoiceRouter().isMute());
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
}
|
}
|
||||||
|
@ -836,8 +845,9 @@ public class MapActivityActions implements DialogProvider {
|
||||||
.icons(R.drawable.ic_action_gdirections_dark, R.drawable.ic_action_gdirections_light)
|
.icons(R.drawable.ic_action_gdirections_dark, R.drawable.ic_action_gdirections_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
enterRoutePlanningMode(null, null, false);
|
enterRoutePlanningMode(null, null, false);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
} else if(routingHelper.isRouteCalculated()) {
|
} else if(routingHelper.isRouteCalculated()) {
|
||||||
|
@ -847,7 +857,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
.icons(R.drawable.ic_action_gdirections_dark, R.drawable.ic_action_gdirections_light)
|
.icons(R.drawable.ic_action_gdirections_dark, R.drawable.ic_action_gdirections_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
if(routingHelper.isRoutePlanningMode()) {
|
if(routingHelper.isRoutePlanningMode()) {
|
||||||
routingHelper.setRoutePlanningMode(false);
|
routingHelper.setRoutePlanningMode(false);
|
||||||
routingHelper.setFollowingMode(true);
|
routingHelper.setFollowingMode(true);
|
||||||
|
@ -858,6 +868,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
}
|
}
|
||||||
mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode();
|
mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode();
|
||||||
mapActivity.refreshMap();
|
mapActivity.refreshMap();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
}
|
}
|
||||||
|
@ -873,12 +884,13 @@ public class MapActivityActions implements DialogProvider {
|
||||||
optionsMenuHelper.item(nav).icons(R.drawable.ic_action_remove_dark, R.drawable.ic_action_remove_light)
|
optionsMenuHelper.item(nav).icons(R.drawable.ic_action_remove_dark, R.drawable.ic_action_remove_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
stopNavigationActionConfirm(mapView);
|
stopNavigationActionConfirm(mapView);
|
||||||
OsMoPositionLayer osMoPositionLayer = mapActivity.getMapView().getLayerByClass(OsMoPositionLayer.class);
|
OsMoPositionLayer osMoPositionLayer = mapActivity.getMapView().getLayerByClass(OsMoPositionLayer.class);
|
||||||
if (osMoPositionLayer != null) {
|
if (osMoPositionLayer != null) {
|
||||||
OsMoPositionLayer.setFollowDestination(null);
|
OsMoPositionLayer.setFollowDestination(null);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
}
|
}
|
||||||
|
@ -886,11 +898,18 @@ public class MapActivityActions implements DialogProvider {
|
||||||
optionsMenuHelper.item(R.string.target_points).icons(R.drawable.ic_action_flage_dark, R.drawable.ic_action_flage_light)
|
optionsMenuHelper.item(R.string.target_points).icons(R.drawable.ic_action_flage_dark, R.drawable.ic_action_flage_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
if (getMyApplication().getWaypointHelper().isRouteCalculated()) {
|
if (getMyApplication().getWaypointHelper().isRouteCalculated()) {
|
||||||
WaypointDialogHelper.showWaypointsDialog(mapActivity);
|
|
||||||
|
final List<WaypointHelper.LocationPointWrapper> deletedPoints = new ArrayList<WaypointHelper.LocationPointWrapper>();
|
||||||
|
ArrayAdapter<Object> adapter = app.getMapActivity().getMapLayers().
|
||||||
|
getMapControlsLayer().getWaypointDialogHelper().getWaypointsAdapter(app.getMapActivity(), deletedPoints);
|
||||||
|
mDrawerList = (ListView) mapActivity.findViewById(R.id.left_drawer);
|
||||||
|
mDrawerList.setAdapter(adapter);
|
||||||
|
return false;
|
||||||
} else {
|
} else {
|
||||||
openIntermediatePointsDialog();
|
openIntermediatePointsDialog();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
|
@ -900,9 +919,9 @@ public class MapActivityActions implements DialogProvider {
|
||||||
optionsMenuHelper.item(R.string.menu_layers).icons(R.drawable.ic_action_layers_dark, R.drawable.ic_action_layers_light)
|
optionsMenuHelper.item(R.string.menu_layers).icons(R.drawable.ic_action_layers_dark, R.drawable.ic_action_layers_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
mapActivity.startActivity(new Intent(mapActivity, ConfigureScreenSettingsActivity.class));
|
mapActivity.startActivity(new Intent(mapActivity, ConfigureScreenSettingsActivity.class));
|
||||||
|
return true;
|
||||||
//mapActivity.getMapLayers().openLayerSelectionDialog(mapView);
|
//mapActivity.getMapLayers().openLayerSelectionDialog(mapView);
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
|
@ -910,24 +929,26 @@ public class MapActivityActions implements DialogProvider {
|
||||||
optionsMenuHelper.item(R.string.layer_map_appearance).icons(R.drawable.ic_action_settings_dark, R.drawable.ic_action_settings_light)
|
optionsMenuHelper.item(R.string.layer_map_appearance).icons(R.drawable.ic_action_settings_dark, R.drawable.ic_action_settings_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
mapActivity.getMapLayers().getMapInfoLayer().openViewConfigureDialog();
|
mapActivity.getMapLayers().getMapInfoLayer().openViewConfigureDialog();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
|
|
||||||
optionsMenuHelper.item(R.string.settings_Button).icons(R.drawable.ic_action_settings2_dark, R.drawable.ic_action_settings2_light)
|
optionsMenuHelper.item(R.string.settings_Button).icons(R.drawable.ic_action_settings2_dark, R.drawable.ic_action_settings2_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
final Intent intentSettings = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getSettingsActivity());
|
final Intent intentSettings = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getSettingsActivity());
|
||||||
mapActivity.startActivity(intentSettings);
|
mapActivity.startActivity(intentSettings);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
|
|
||||||
optionsMenuHelper.item(R.string.search_button).icons(R.drawable.ic_action_search_dark, R.drawable.ic_action_search_light)
|
optionsMenuHelper.item(R.string.search_button).icons(R.drawable.ic_action_search_dark, R.drawable.ic_action_search_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getSearchActivity());
|
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getSearchActivity());
|
||||||
// causes wrong position caching: newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
// causes wrong position caching: newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
LatLon loc = mapActivity.getMapLocation();
|
LatLon loc = mapActivity.getMapLocation();
|
||||||
|
@ -935,23 +956,26 @@ public class MapActivityActions implements DialogProvider {
|
||||||
newIntent.putExtra(SearchActivity.SEARCH_LON, loc.getLongitude());
|
newIntent.putExtra(SearchActivity.SEARCH_LON, loc.getLongitude());
|
||||||
newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
mapActivity.startActivity(newIntent);
|
mapActivity.startActivity(newIntent);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
|
|
||||||
optionsMenuHelper.item(R.string.favorites_Button).icons( R.drawable.ic_action_fav_dark, R.drawable.ic_action_fav_light)
|
optionsMenuHelper.item(R.string.favorites_Button).icons( R.drawable.ic_action_fav_dark, R.drawable.ic_action_fav_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getFavoritesActivity());
|
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getFavoritesActivity());
|
||||||
// causes wrong position caching: newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
// causes wrong position caching: newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
mapActivity.startActivity(newIntent);
|
mapActivity.startActivity(newIntent);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
optionsMenuHelper.item(R.string.show_point_options).icons(R.drawable.ic_action_marker_dark, R.drawable.ic_action_marker_light )
|
optionsMenuHelper.item(R.string.show_point_options).icons(R.drawable.ic_action_marker_dark, R.drawable.ic_action_marker_light )
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
contextMenuPoint(mapView.getLatitude(), mapView.getLongitude());
|
contextMenuPoint(mapView.getLatitude(), mapView.getLongitude());
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
//////////// Others
|
//////////// Others
|
||||||
|
@ -960,8 +984,9 @@ public class MapActivityActions implements DialogProvider {
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
new StartGPSStatus(mapActivity).run();
|
new StartGPSStatus(mapActivity).run();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
}
|
}
|
||||||
|
@ -970,7 +995,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
listen(new OnContextMenuClick() {
|
listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
if (MainMenuActivity.TIPS_AND_TRICKS) {
|
if (MainMenuActivity.TIPS_AND_TRICKS) {
|
||||||
TipsAndTricksActivity tactivity = new TipsAndTricksActivity(mapActivity);
|
TipsAndTricksActivity tactivity = new TipsAndTricksActivity(mapActivity);
|
||||||
Dialog dlg = tactivity.getDialogToShowTips(false, true);
|
Dialog dlg = tactivity.getDialogToShowTips(false, true);
|
||||||
|
@ -979,6 +1004,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
final Intent helpIntent = new Intent(mapActivity, HelpActivity.class);
|
final Intent helpIntent = new Intent(mapActivity, HelpActivity.class);
|
||||||
mapActivity.startActivity(helpIntent);
|
mapActivity.startActivity(helpIntent);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
final OsmAndLocationProvider loc = app.getLocationProvider();
|
final OsmAndLocationProvider loc = app.getLocationProvider();
|
||||||
|
@ -990,10 +1016,11 @@ public class MapActivityActions implements DialogProvider {
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked,
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked,
|
||||||
DialogInterface dialog) {
|
DialogInterface dialog) {
|
||||||
// animate moving on route
|
// animate moving on route
|
||||||
loc.getLocationSimulation().startStopRouteAnimation(mapActivity);
|
loc.getLocationSimulation().startStopRouteAnimation(mapActivity);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
}
|
}
|
||||||
|
@ -1003,7 +1030,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
optionsMenuHelper.item(R.string.exit_Button).icons(R.drawable.ic_action_quit_dark, R.drawable.ic_action_quit_light )
|
optionsMenuHelper.item(R.string.exit_Button).icons(R.drawable.ic_action_quit_dark, R.drawable.ic_action_quit_light )
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
// 1. Work for almost all cases when user open apps from main menu
|
// 1. Work for almost all cases when user open apps from main menu
|
||||||
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getMainMenuActivity());
|
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getMainMenuActivity());
|
||||||
newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
@ -1011,6 +1038,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
mapActivity.startActivity(newIntent);
|
mapActivity.startActivity(newIntent);
|
||||||
// In future when map will be main screen this should change
|
// In future when map will be main screen this should change
|
||||||
// app.closeApplication(mapActivity);
|
// app.closeApplication(mapActivity);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
|
|
||||||
|
@ -1113,8 +1141,9 @@ public class MapActivityActions implements DialogProvider {
|
||||||
new OnContextMenuClick() {
|
new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
MapActivityActions.directionsToDialogAndLaunchMap(activity, location.getLatitude(), location.getLongitude(), name);
|
MapActivityActions.directionsToDialogAndLaunchMap(activity, location.getLatitude(), location.getLongitude(), name);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
Item intermediate;
|
Item intermediate;
|
||||||
|
@ -1127,8 +1156,9 @@ public class MapActivityActions implements DialogProvider {
|
||||||
}
|
}
|
||||||
intermediate.listen(new OnContextMenuClick() {
|
intermediate.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
addWaypointDialogAndLaunchMap(activity, location.getLatitude(), location.getLongitude(), name);
|
addWaypointDialogAndLaunchMap(activity, location.getLatitude(), location.getLongitude(), name);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
|
|
||||||
|
@ -1138,10 +1168,11 @@ public class MapActivityActions implements DialogProvider {
|
||||||
new OnContextMenuClick() {
|
new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
app.getSettings().setMapLocationToShow(location.getLatitude(), location.getLongitude(), z, saveHistory ? name : null, name,
|
app.getSettings().setMapLocationToShow(location.getLatitude(), location.getLongitude(), z, saveHistory ? name : null, name,
|
||||||
obj); //$NON-NLS-1$
|
obj); //$NON-NLS-1$
|
||||||
MapActivity.launchMapActivityMoveToTop(activity);
|
MapActivity.launchMapActivityMoveToTop(activity);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
if (favorite) {
|
if (favorite) {
|
||||||
|
@ -1150,13 +1181,13 @@ public class MapActivityActions implements DialogProvider {
|
||||||
addToFavorite.listen(new OnContextMenuClick() {
|
addToFavorite.listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
Dialog dlg = createAddFavouriteDialog(activity, args);
|
Dialog dlg = createAddFavouriteDialog(activity, args);
|
||||||
dlg.show();
|
dlg.show();
|
||||||
prepareAddFavouriteDialog(activity, dlg, args, location.getLatitude(), location.getLongitude(),
|
prepareAddFavouriteDialog(activity, dlg, args, location.getLatitude(), location.getLongitude(),
|
||||||
name);
|
name);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,13 +188,14 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment {
|
||||||
private void basicFileOperation(final GpxDisplayItem gpxDisplayItem, ContextMenuAdapter adapter) {
|
private void basicFileOperation(final GpxDisplayItem gpxDisplayItem, ContextMenuAdapter adapter) {
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int resId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int resId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
if (resId == R.string.show_gpx_route) {
|
if (resId == R.string.show_gpx_route) {
|
||||||
OsmandSettings settings = app.getSettings();
|
OsmandSettings settings = app.getSettings();
|
||||||
settings.setMapLocationToShow(gpxDisplayItem.locationStart.lat, gpxDisplayItem.locationStart.lon,
|
settings.setMapLocationToShow(gpxDisplayItem.locationStart.lat, gpxDisplayItem.locationStart.lon,
|
||||||
settings.getLastKnownMapZoom(), Html.fromHtml(gpxDisplayItem.name).toString());
|
settings.getLastKnownMapZoom(), Html.fromHtml(gpxDisplayItem.name).toString());
|
||||||
MapActivity.launchMapActivityMoveToTop(getMyActivity());
|
MapActivity.launchMapActivityMoveToTop(getMyActivity());
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (gpxDisplayItem.locationStart != null) {
|
if (gpxDisplayItem.locationStart != null) {
|
||||||
|
|
|
@ -580,7 +580,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
poiDescr.listen(new OnContextMenuClick() {
|
poiDescr.listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dlg) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dlg) {
|
||||||
// Build text(amenity)
|
// Build text(amenity)
|
||||||
|
|
||||||
// Find and format links
|
// Find and format links
|
||||||
|
@ -598,6 +598,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
TextView textView = (TextView) dialog.findViewById(android.R.id.message);
|
TextView textView = (TextView) dialog.findViewById(android.R.id.message);
|
||||||
textView.setMovementMethod(LinkMovementMethod.getInstance());
|
textView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
textView.setLinksClickable(true);
|
textView.setLinksClickable(true);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
}
|
}
|
||||||
|
@ -606,8 +607,9 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
showDetails.listen(new OnContextMenuClick() {
|
showDetails.listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dlg) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dlg) {
|
||||||
showPOIDetails(amenity, settings.usingEnglishNames());
|
showPOIDetails(amenity, settings.usingEnglishNames());
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,13 +118,14 @@ public class AudioNotesLayer extends OsmandMapLayer implements IContextMenuProvi
|
||||||
final Recording r = (Recording) o;
|
final Recording r = (Recording) o;
|
||||||
OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
if (itemId == R.string.recording_context_menu_play ||
|
if (itemId == R.string.recording_context_menu_play ||
|
||||||
itemId == R.string.recording_context_menu_show) {
|
itemId == R.string.recording_context_menu_show) {
|
||||||
plugin.playRecording(view.getContext(), r);
|
plugin.playRecording(view.getContext(), r);
|
||||||
} else if (itemId == R.string.recording_context_menu_delete) {
|
} else if (itemId == R.string.recording_context_menu_delete) {
|
||||||
deleteRecording(r);
|
deleteRecording(r);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -414,12 +414,13 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
public void registerLayerContextMenuActions(final OsmandMapTileView mapView, ContextMenuAdapter adapter, final MapActivity mapActivity) {
|
public void registerLayerContextMenuActions(final OsmandMapTileView mapView, ContextMenuAdapter adapter, final MapActivity mapActivity) {
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
if (itemId == R.string.layer_recordings) {
|
if (itemId == R.string.layer_recordings) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
SHOW_RECORDINGS.set(!SHOW_RECORDINGS.get());
|
SHOW_RECORDINGS.set(!SHOW_RECORDINGS.get());
|
||||||
updateLayers(mapView, mapActivity);
|
updateLayers(mapView, mapActivity);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
adapter.item(R.string.layer_recordings).selected(SHOW_RECORDINGS.get() ? 1 : 0)
|
adapter.item(R.string.layer_recordings).selected(SHOW_RECORDINGS.get() ? 1 : 0)
|
||||||
|
@ -433,23 +434,26 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
recordAudio(latitude, longitude, mapActivity);
|
recordAudio(latitude, longitude, mapActivity);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).position(6).reg();
|
}).position(6).reg();
|
||||||
adapter.item(R.string.recording_context_menu_vrecord).icons(R.drawable.ic_action_video_dark, R.drawable.ic_action_video_light)
|
adapter.item(R.string.recording_context_menu_vrecord).icons(R.drawable.ic_action_video_dark, R.drawable.ic_action_video_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
recordVideo(latitude, longitude, mapActivity);
|
recordVideo(latitude, longitude, mapActivity);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).position(7).reg();
|
}).position(7).reg();
|
||||||
adapter.item(R.string.recording_context_menu_precord).icons(R.drawable.ic_action_photo_dark, R.drawable.ic_action_photo_light)
|
adapter.item(R.string.recording_context_menu_precord).icons(R.drawable.ic_action_photo_dark, R.drawable.ic_action_photo_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
takePhoto(latitude, longitude, mapActivity);
|
takePhoto(latitude, longitude, mapActivity);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}).position(8).reg();
|
}).position(8).reg();
|
||||||
|
@ -1101,8 +1105,9 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
final RecordingLocalIndexInfo ri = (RecordingLocalIndexInfo) info;
|
final RecordingLocalIndexInfo ri = (RecordingLocalIndexInfo) info;
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
playRecording(la, ri.rec);
|
playRecording(la, ri.rec);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (ri.rec.isPhoto()) {
|
if (ri.rec.isPhoto()) {
|
||||||
|
@ -1118,13 +1123,13 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
.icons(R.drawable.ic_action_marker_dark, R.drawable.ic_action_marker_light)
|
.icons(R.drawable.ic_action_marker_dark, R.drawable.ic_action_marker_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked,
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked,
|
||||||
DialogInterface dialog) {
|
DialogInterface dialog) {
|
||||||
SHOW_RECORDINGS.set(true);
|
SHOW_RECORDINGS.set(true);
|
||||||
app.getSettings().setMapLocationToShow(ri.rec.lat, ri.rec.lon,
|
app.getSettings().setMapLocationToShow(ri.rec.lat, ri.rec.lon,
|
||||||
app.getSettings().getLastKnownMapZoom());
|
app.getSettings().getLastKnownMapZoom());
|
||||||
MapActivity.launchMapActivityMoveToTop(la);
|
MapActivity.launchMapActivityMoveToTop(la);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
}
|
}
|
||||||
|
|
|
@ -584,7 +584,7 @@ public class DistanceCalculatorPlugin extends OsmandPlugin {
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
if (itemId == R.string.delete_point) {
|
if (itemId == R.string.delete_point) {
|
||||||
for (int i = 0; i < measurementPoints.size(); i++) {
|
for (int i = 0; i < measurementPoints.size(); i++) {
|
||||||
Iterator<WptPt> it = measurementPoints.get(i).iterator();
|
Iterator<WptPt> it = measurementPoints.get(i).iterator();
|
||||||
|
@ -596,6 +596,7 @@ public class DistanceCalculatorPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
calculateDistance();
|
calculateDistance();
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
adapter.item(R.string.delete_point).icons(R.drawable.ic_action_delete_dark,
|
adapter.item(R.string.delete_point).icons(R.drawable.ic_action_delete_dark,
|
||||||
|
|
|
@ -158,7 +158,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
||||||
private void basicFileOperation(final LocalIndexInfo info, ContextMenuAdapter adapter) {
|
private void basicFileOperation(final LocalIndexInfo info, ContextMenuAdapter adapter) {
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int resId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int resId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
if (resId == R.string.local_index_mi_rename) {
|
if (resId == R.string.local_index_mi_rename) {
|
||||||
renameFile(info);
|
renameFile(info);
|
||||||
} else if (resId == R.string.local_index_mi_restore) {
|
} else if (resId == R.string.local_index_mi_restore) {
|
||||||
|
@ -177,6 +177,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
||||||
} else if (resId == R.string.local_index_mi_backup) {
|
} else if (resId == R.string.local_index_mi_backup) {
|
||||||
new LocalIndexOperationTask(BACKUP_OPERATION).execute(info);
|
new LocalIndexOperationTask(BACKUP_OPERATION).execute(info);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if(info.getType() == LocalIndexType.MAP_DATA || info.getType() == LocalIndexType.SRTM_DATA){
|
if(info.getType() == LocalIndexType.MAP_DATA || info.getType() == LocalIndexType.SRTM_DATA){
|
||||||
|
@ -475,8 +476,9 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
||||||
optionsMenuAdapter = new ContextMenuAdapter(getDownloadActivity());
|
optionsMenuAdapter = new ContextMenuAdapter(getDownloadActivity());
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
localOptionsMenu(itemId);
|
localOptionsMenu(itemId);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
optionsMenuAdapter.item(R.string.local_index_mi_reload)
|
optionsMenuAdapter.item(R.string.local_index_mi_reload)
|
||||||
|
|
|
@ -3,7 +3,6 @@ package net.osmand.plus.helpers;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import android.support.v4.widget.DrawerLayout;
|
|
||||||
import android.widget.*;
|
import android.widget.*;
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
|
@ -195,14 +194,16 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
|
||||||
public static void showWaypointsDialogFlat(FragmentActivity fragmentActivity) {
|
public static void showWaypointsDialogFlat(FragmentActivity fragmentActivity) {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putBoolean(WaypointDialogFragment.FLAT_ARG, true);
|
args.putBoolean(WaypointDialogFragment.FLAT_ARG, true);
|
||||||
WaypointDialogFragment wdf = new WaypointDialogFragment();
|
//TODO remove this method totally
|
||||||
|
WaypointDialogFragment wdf = new WaypointDialogFragment(new WaypointDialogHelper(null));
|
||||||
wdf.setArguments(args);
|
wdf.setArguments(args);
|
||||||
fragmentActivity.getSupportFragmentManager().beginTransaction().add(wdf, "tag").commit();
|
fragmentActivity.getSupportFragmentManager().beginTransaction().add(wdf, "tag").commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showWaypointsDialog(FragmentActivity fragmentActivity) {
|
public static void showWaypointsDialog(FragmentActivity fragmentActivity) {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
WaypointDialogFragment wdf = new WaypointDialogFragment();
|
//TODO remove this method totally
|
||||||
|
WaypointDialogFragment wdf = new WaypointDialogFragment(new WaypointDialogHelper(null));
|
||||||
wdf.setArguments(args);
|
wdf.setArguments(args);
|
||||||
fragmentActivity.getSupportFragmentManager().beginTransaction().add(wdf, "tag").commit();
|
fragmentActivity.getSupportFragmentManager().beginTransaction().add(wdf, "tag").commit();
|
||||||
}
|
}
|
||||||
|
@ -211,9 +212,14 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
|
||||||
|
|
||||||
WaypointHelper waypointHelper;
|
WaypointHelper waypointHelper;
|
||||||
private OsmandApplication app;
|
private OsmandApplication app;
|
||||||
|
private WaypointDialogHelper dialogHelper;
|
||||||
|
|
||||||
public static final String FLAT_ARG = "FLAT_ARG";
|
public static final String FLAT_ARG = "FLAT_ARG";
|
||||||
|
|
||||||
|
public WaypointDialogFragment(WaypointDialogHelper helper){
|
||||||
|
this.dialogHelper = helper;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(Activity activity) {
|
public void onAttach(Activity activity) {
|
||||||
super.onAttach(activity);
|
super.onAttach(activity);
|
||||||
|
@ -229,91 +235,6 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
|
||||||
return createWaypointsDialog();
|
return createWaypointsDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectPoi(final int[] running, final ArrayAdapter<Object> listAdapter, final int type,
|
|
||||||
final boolean enable) {
|
|
||||||
if (getActivity() instanceof MapActivity && !PoiFilter.CUSTOM_FILTER_ID.equals(app.getSettings().getPoiFilterForMap())) {
|
|
||||||
MapActivity map = (MapActivity) getActivity();
|
|
||||||
final PoiFilter[] selected = new PoiFilter[1];
|
|
||||||
AlertDialog dlg = map.getMapLayers().selectPOIFilterLayer(map.getMapView(), selected);
|
|
||||||
dlg.setOnDismissListener(new OnDismissListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDismiss(DialogInterface dialog) {
|
|
||||||
if (selected != null) {
|
|
||||||
enableType(running, listAdapter, type, enable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
enableType(running, listAdapter, type, enable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void recalculatePoints(final int[] running, final ArrayAdapter<Object> listAdapter, final int type){
|
|
||||||
new AsyncTask<Void, Void, Void>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Void doInBackground(Void... params) {
|
|
||||||
app.getWaypointHelper().recalculatePoints(type);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void onPostExecute(Void result) {
|
|
||||||
running[0] = -1;
|
|
||||||
listAdapter.clear();
|
|
||||||
for (Object point : getPoints()) {
|
|
||||||
listAdapter.add(point);
|
|
||||||
}
|
|
||||||
listAdapter.notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
}.execute((Void) null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void enableType(final int[] running, final ArrayAdapter<Object> listAdapter, final int type,
|
|
||||||
final boolean enable) {
|
|
||||||
new AsyncTask<Void, Void, Void>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Void doInBackground(Void... params) {
|
|
||||||
app.getWaypointHelper().enableWaypointType(type, enable);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void onPostExecute(Void result) {
|
|
||||||
running[0] = -1;
|
|
||||||
listAdapter.clear();
|
|
||||||
for (Object point : getPoints()) {
|
|
||||||
listAdapter.add(point);
|
|
||||||
}
|
|
||||||
listAdapter.notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
}.execute((Void) null);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String getHeader(int type, boolean checked) {
|
|
||||||
FragmentActivity ctx = getActivity();
|
|
||||||
String str = ctx.getString(R.string.waypoints);
|
|
||||||
switch (type) {
|
|
||||||
case WaypointHelper.TARGETS:
|
|
||||||
str = ctx.getString(R.string.targets);
|
|
||||||
break;
|
|
||||||
case WaypointHelper.ALARMS:
|
|
||||||
str = ctx.getString(R.string.way_alarms);
|
|
||||||
break;
|
|
||||||
case WaypointHelper.FAVORITES:
|
|
||||||
str = ctx.getString(R.string.my_favorites);
|
|
||||||
break;
|
|
||||||
case WaypointHelper.WAYPOINTS:
|
|
||||||
str = ctx.getString(R.string.waypoints);
|
|
||||||
break;
|
|
||||||
case WaypointHelper.POI:
|
|
||||||
str = waypointHelper.getPoiFilter() == null || !checked ? ctx.getString(R.string.poi) : waypointHelper
|
|
||||||
.getPoiFilter().getName();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AlertDialog createWaypointsDialogFlat(final List<LocationPointWrapper> points) {
|
public AlertDialog createWaypointsDialogFlat(final List<LocationPointWrapper> points) {
|
||||||
final List<LocationPointWrapper> deletedPoints = new ArrayList<WaypointHelper.LocationPointWrapper>();
|
final List<LocationPointWrapper> deletedPoints = new ArrayList<WaypointHelper.LocationPointWrapper>();
|
||||||
final FragmentActivity ctx = getActivity();
|
final FragmentActivity ctx = getActivity();
|
||||||
|
@ -368,12 +289,81 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
public AlertDialog createWaypointsDialog() {
|
public AlertDialog createWaypointsDialog() {
|
||||||
final List<Object> points = getPoints();
|
|
||||||
final List<LocationPointWrapper> deletedPoints = new ArrayList<WaypointHelper.LocationPointWrapper>();
|
|
||||||
final FragmentActivity ctx = getActivity();
|
final FragmentActivity ctx = getActivity();
|
||||||
final ListView listView = new ListView(ctx);
|
final ListView listView = new ListView(ctx);
|
||||||
|
final List<LocationPointWrapper> deletedPoints = new ArrayList<WaypointHelper.LocationPointWrapper>();
|
||||||
|
final ArrayAdapter<Object> listAdapter = dialogHelper.getWaypointsAdapter(ctx, deletedPoints);
|
||||||
|
|
||||||
|
listView.setAdapter(listAdapter);
|
||||||
|
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> adapterView, View view, int item, long l) {
|
||||||
|
if (listAdapter.getItem(item) instanceof LocationPointWrapper) {
|
||||||
|
LocationPointWrapper ps = (LocationPointWrapper) listAdapter.getItem(item);
|
||||||
|
showOnMap(app, ctx, ps.getPoint(), WaypointDialogFragment.this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
|
||||||
|
builder.setView(listView);
|
||||||
|
builder.setNeutralButton(R.string.flat_list_waypoints, new OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
showWaypointsDialogFlat(getActivity());
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
builder.setPositiveButton(R.string.default_buttons_ok, new OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
waypointHelper.removeVisibleLocationPoint(deletedPoints);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
builder.setNegativeButton(ctx.getString(R.string.default_buttons_cancel), null);
|
||||||
|
return builder.create();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static void showOnMap(OsmandApplication app, Activity a, LocationPoint locationPoint, DialogFragment dialog) {
|
||||||
|
if (!(a instanceof MapActivity)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MapActivity ctx = (MapActivity) a;
|
||||||
|
AnimateDraggingMapThread thread = ctx.getMapView().getAnimatedDraggingThread();
|
||||||
|
int fZoom = ctx.getMapView().getZoom() < 15 ? 15 : ctx.getMapView().getZoom();
|
||||||
|
boolean di = dialog != null;
|
||||||
|
if (thread.isAnimating()) {
|
||||||
|
ctx.getMapView().setIntZoom(fZoom);
|
||||||
|
ctx.getMapView().setLatLon(locationPoint.getLatitude(), locationPoint.getLongitude());
|
||||||
|
app.getAppCustomization().showLocationPoint(ctx, locationPoint);
|
||||||
|
} else {
|
||||||
|
final double dist = MapUtils.getDistance(ctx.getMapView().getLatitude(), ctx.getMapView().getLongitude(),
|
||||||
|
locationPoint.getLatitude(), locationPoint.getLongitude());
|
||||||
|
double t = 10;
|
||||||
|
if (dist < t) {
|
||||||
|
app.getAppCustomization().showLocationPoint(ctx, locationPoint);
|
||||||
|
} else {
|
||||||
|
thread.startMoving(locationPoint.getLatitude(), locationPoint.getLongitude(), fZoom, true);
|
||||||
|
}
|
||||||
|
if (di) {
|
||||||
|
ctx.getMapLayers().getContextMenuLayer().setSelectedObject(locationPoint);
|
||||||
|
ctx.getMapLayers()
|
||||||
|
.getContextMenuLayer()
|
||||||
|
.setLocation(new LatLon(locationPoint.getLatitude(), locationPoint.getLongitude()),
|
||||||
|
locationPoint.getName(ctx));
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayAdapter<Object> getWaypointsAdapter(final Activity ctx, final List<LocationPointWrapper> deletedPoints){
|
||||||
|
final List<Object> points = getPoints();
|
||||||
final int[] running = new int[]{-1};
|
final int[] running = new int[]{-1};
|
||||||
final ArrayAdapter<Object> listAdapter = new ArrayAdapter<Object>(ctx,
|
return new ArrayAdapter<Object>(ctx,
|
||||||
R.layout.waypoint_reached, R.id.title, points) {
|
R.layout.waypoint_reached, R.id.title, points) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -403,7 +393,7 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
|
||||||
selected = i;
|
selected = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
new AlertDialog.Builder(getActivity())
|
new AlertDialog.Builder(ctx)
|
||||||
.setSingleChoiceItems(names, selected, new OnClickListener() {
|
.setSingleChoiceItems(names, selected, new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
|
@ -438,7 +428,7 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
|
||||||
selected = i;
|
selected = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
new AlertDialog.Builder(getActivity())
|
new AlertDialog.Builder(ctx)
|
||||||
.setSingleChoiceItems(names, selected, new OnClickListener() {
|
.setSingleChoiceItems(names, selected, new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
|
@ -489,7 +479,7 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
|
||||||
running[0] = position;
|
running[0] = position;
|
||||||
thisAdapter.notifyDataSetInvalidated();
|
thisAdapter.notifyDataSetInvalidated();
|
||||||
if (type == WaypointHelper.POI && isChecked) {
|
if (type == WaypointHelper.POI && isChecked) {
|
||||||
selectPoi(running, thisAdapter, type, isChecked);
|
selectPoi(running, thisAdapter, type, isChecked, mapActivity);
|
||||||
} else {
|
} else {
|
||||||
enableType(running, thisAdapter, type, isChecked);
|
enableType(running, thisAdapter, type, isChecked);
|
||||||
}
|
}
|
||||||
|
@ -497,10 +487,10 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
|
||||||
|
|
||||||
});
|
});
|
||||||
TextView tv = (TextView) v.findViewById(R.id.header_text);
|
TextView tv = (TextView) v.findViewById(R.id.header_text);
|
||||||
tv.setText(getHeader(type, checked));
|
tv.setText(getHeader(ctx, type, checked));
|
||||||
} else {
|
} else {
|
||||||
v = ctx.getLayoutInflater().inflate(R.layout.waypoint_reached, null);
|
v = ctx.getLayoutInflater().inflate(R.layout.waypoint_reached, null);
|
||||||
updatePointInfoView(app, ctx, v, (LocationPointWrapper) getItem(position), WaypointDialogFragment.this);
|
updatePointInfoView(app, ctx, v, (LocationPointWrapper) getItem(position), null);
|
||||||
View remove = v.findViewById(R.id.info_close);
|
View remove = v.findViewById(R.id.info_close);
|
||||||
((ImageButton) remove).setImageDrawable(ctx.getResources().getDrawable(
|
((ImageButton) remove).setImageDrawable(ctx.getResources().getDrawable(
|
||||||
app.getSettings().isLightContent() ? R.drawable.ic_action_gremove_light
|
app.getSettings().isLightContent() ? R.drawable.ic_action_gremove_light
|
||||||
|
@ -518,36 +508,68 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getHeader(Activity ctx, int type, boolean checked) {
|
||||||
|
String str = ctx.getString(R.string.waypoints);
|
||||||
|
switch (type) {
|
||||||
|
case WaypointHelper.TARGETS:
|
||||||
|
str = ctx.getString(R.string.targets);
|
||||||
|
break;
|
||||||
|
case WaypointHelper.ALARMS:
|
||||||
|
str = ctx.getString(R.string.way_alarms);
|
||||||
|
break;
|
||||||
|
case WaypointHelper.FAVORITES:
|
||||||
|
str = ctx.getString(R.string.my_favorites);
|
||||||
|
break;
|
||||||
|
case WaypointHelper.WAYPOINTS:
|
||||||
|
str = ctx.getString(R.string.waypoints);
|
||||||
|
break;
|
||||||
|
case WaypointHelper.POI:
|
||||||
|
str = waypointHelper.getPoiFilter() == null || !checked ? ctx.getString(R.string.poi) : waypointHelper
|
||||||
|
.getPoiFilter().getName();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void selectPoi(final int[] running, final ArrayAdapter<Object> listAdapter, final int type,
|
||||||
|
final boolean enable, MapActivity map) {
|
||||||
|
if (!PoiFilter.CUSTOM_FILTER_ID.equals(app.getSettings().getPoiFilterForMap())) {
|
||||||
|
final PoiFilter[] selected = new PoiFilter[1];
|
||||||
|
AlertDialog dlg = map.getMapLayers().selectPOIFilterLayer(map.getMapView(), selected);
|
||||||
|
dlg.setOnDismissListener(new OnDismissListener() {
|
||||||
|
|
||||||
listView.setAdapter(listAdapter);
|
|
||||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> adapterView, View view, int item, long l) {
|
public void onDismiss(DialogInterface dialog) {
|
||||||
if (listAdapter.getItem(item) instanceof LocationPointWrapper) {
|
if (selected != null) {
|
||||||
LocationPointWrapper ps = (LocationPointWrapper) listAdapter.getItem(item);
|
enableType(running, listAdapter, type, enable);
|
||||||
showOnMap(app, ctx, ps.getPoint(), WaypointDialogFragment.this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
|
} else {
|
||||||
builder.setView(listView);
|
enableType(running, listAdapter, type, enable);
|
||||||
builder.setNeutralButton(R.string.flat_list_waypoints, new OnClickListener() {
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
showWaypointsDialogFlat(getActivity());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
private void recalculatePoints(final int[] running, final ArrayAdapter<Object> listAdapter, final int type){
|
||||||
builder.setPositiveButton(R.string.default_buttons_ok, new OnClickListener() {
|
new AsyncTask<Void, Void, Void>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
protected Void doInBackground(Void... params) {
|
||||||
waypointHelper.removeVisibleLocationPoint(deletedPoints);
|
app.getWaypointHelper().recalculatePoints(type);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
});
|
|
||||||
builder.setNegativeButton(ctx.getString(R.string.default_buttons_cancel), null);
|
protected void onPostExecute(Void result) {
|
||||||
return builder.create();
|
running[0] = -1;
|
||||||
|
listAdapter.clear();
|
||||||
|
for (Object point : getPoints()) {
|
||||||
|
listAdapter.add(point);
|
||||||
|
}
|
||||||
|
listAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
}.execute((Void) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<Object> getPoints() {
|
protected List<Object> getPoints() {
|
||||||
|
@ -568,40 +590,25 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
|
||||||
}
|
}
|
||||||
return points;
|
return points;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void enableType(final int[] running, final ArrayAdapter<Object> listAdapter, final int type,
|
||||||
|
final boolean enable) {
|
||||||
|
new AsyncTask<Void, Void, Void>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Void doInBackground(Void... params) {
|
||||||
|
app.getWaypointHelper().enableWaypointType(type, enable);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void onPostExecute(Void result) {
|
||||||
private static void showOnMap(OsmandApplication app, Activity a, LocationPoint locationPoint, DialogFragment dialog) {
|
running[0] = -1;
|
||||||
if (!(a instanceof MapActivity)) {
|
listAdapter.clear();
|
||||||
return;
|
for (Object point : getPoints()) {
|
||||||
|
listAdapter.add(point);
|
||||||
}
|
}
|
||||||
MapActivity ctx = (MapActivity) a;
|
listAdapter.notifyDataSetChanged();
|
||||||
AnimateDraggingMapThread thread = ctx.getMapView().getAnimatedDraggingThread();
|
|
||||||
int fZoom = ctx.getMapView().getZoom() < 15 ? 15 : ctx.getMapView().getZoom();
|
|
||||||
boolean di = dialog != null;
|
|
||||||
if (thread.isAnimating()) {
|
|
||||||
ctx.getMapView().setIntZoom(fZoom);
|
|
||||||
ctx.getMapView().setLatLon(locationPoint.getLatitude(), locationPoint.getLongitude());
|
|
||||||
app.getAppCustomization().showLocationPoint(ctx, locationPoint);
|
|
||||||
} else {
|
|
||||||
final double dist = MapUtils.getDistance(ctx.getMapView().getLatitude(), ctx.getMapView().getLongitude(),
|
|
||||||
locationPoint.getLatitude(), locationPoint.getLongitude());
|
|
||||||
double t = 10;
|
|
||||||
if (dist < t) {
|
|
||||||
app.getAppCustomization().showLocationPoint(ctx, locationPoint);
|
|
||||||
} else {
|
|
||||||
thread.startMoving(locationPoint.getLatitude(), locationPoint.getLongitude(), fZoom, true);
|
|
||||||
}
|
}
|
||||||
if (di) {
|
}.execute((Void) null);
|
||||||
ctx.getMapLayers().getContextMenuLayer().setSelectedObject(locationPoint);
|
|
||||||
ctx.getMapLayers()
|
|
||||||
.getContextMenuLayer()
|
|
||||||
.setLocation(new LatLon(locationPoint.getLatitude(), locationPoint.getLongitude()),
|
|
||||||
locationPoint.getName(ctx));
|
|
||||||
dialog.dismiss();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,10 +115,11 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
|
||||||
ContextMenuAdapter adapter, Object selectedObj) {
|
ContextMenuAdapter adapter, Object selectedObj) {
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int resId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int resId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
if (resId == R.string.context_menu_item_add_waypoint) {
|
if (resId == R.string.context_menu_item_add_waypoint) {
|
||||||
mapActivity.getMapActions().addWaypoint(latitude, longitude);
|
mapActivity.getMapActions().addWaypoint(latitude, longitude);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
adapter.item(R.string.context_menu_item_add_waypoint).icons(R.drawable.ic_action_gnew_label_dark, R.drawable.ic_action_gnew_label_light)
|
adapter.item(R.string.context_menu_item_add_waypoint).icons(R.drawable.ic_action_gnew_label_dark, R.drawable.ic_action_gnew_label_light)
|
||||||
|
@ -447,7 +448,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
|
||||||
int draw = !bgoff ? R.drawable.monitoring_rec_big : R.drawable.monitoring_rec_inactive;
|
int draw = !bgoff ? R.drawable.monitoring_rec_big : R.drawable.monitoring_rec_inactive;
|
||||||
qa.item(msgId).icon(draw).listen(new OnContextMenuClick() {
|
qa.item(msgId).icon(draw).listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
if (view.getApplication().getNavigationService() == null) {
|
if (view.getApplication().getNavigationService() == null) {
|
||||||
final ValueHolder<Integer> vs = new ValueHolder<Integer>();
|
final ValueHolder<Integer> vs = new ValueHolder<Integer>();
|
||||||
final ValueHolder<Boolean> choice = new ValueHolder<Boolean>();
|
final ValueHolder<Boolean> choice = new ValueHolder<Boolean>();
|
||||||
|
@ -465,6 +466,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
|
||||||
} else {
|
} else {
|
||||||
view.getContext().stopService(serviceIntent);
|
view.getContext().stopService(serviceIntent);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).position(0).reg();
|
}).position(0).reg();
|
||||||
}
|
}
|
||||||
|
|
|
@ -495,12 +495,13 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
if (itemId == R.string.osb_comment_menu_item) {
|
if (itemId == R.string.osb_comment_menu_item) {
|
||||||
commentBug(bug);
|
commentBug(bug);
|
||||||
} else if (itemId == R.string.osb_close_menu_item) {
|
} else if (itemId == R.string.osb_close_menu_item) {
|
||||||
closeBug(bug);
|
closeBug(bug);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
adapter.item(R.string.osb_comment_menu_item).icons(
|
adapter.item(R.string.osb_comment_menu_item).icons(
|
||||||
|
|
|
@ -122,7 +122,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
||||||
final Object selectedObj) {
|
final Object selectedObj) {
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int resId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int resId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
if (resId == R.string.context_menu_item_create_poi) {
|
if (resId == R.string.context_menu_item_create_poi) {
|
||||||
getPoiActions(mapActivity).showCreateDialog(latitude, longitude);
|
getPoiActions(mapActivity).showCreateDialog(latitude, longitude);
|
||||||
} else if (resId == R.string.context_menu_item_open_bug) {
|
} else if (resId == R.string.context_menu_item_open_bug) {
|
||||||
|
@ -135,6 +135,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
||||||
} else if (resId == R.string.poi_context_menu_modify) {
|
} else if (resId == R.string.poi_context_menu_modify) {
|
||||||
getPoiActions(mapActivity).showEditDialog((Amenity) selectedObj);
|
getPoiActions(mapActivity).showEditDialog((Amenity) selectedObj);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if(selectedObj instanceof Amenity) {
|
if(selectedObj instanceof Amenity) {
|
||||||
|
@ -156,10 +157,11 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
||||||
.icons(R.drawable.ic_action_bug_dark, R.drawable.ic_action_bug_light).listen(new OnContextMenuClick() {
|
.icons(R.drawable.ic_action_bug_dark, R.drawable.ic_action_bug_light).listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
if (itemId == R.string.layer_osm_bugs) {
|
if (itemId == R.string.layer_osm_bugs) {
|
||||||
settings.SHOW_OSM_BUGS.set(isChecked);
|
settings.SHOW_OSM_BUGS.set(isChecked);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).position(7).reg();
|
}).position(7).reg();
|
||||||
|
|
||||||
|
@ -178,8 +180,9 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
sendGPXFiles(la, (AvailableGPXFragment) fragment, (GpxInfo) info);
|
sendGPXFiles(la, (AvailableGPXFragment) fragment, (GpxInfo) info);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
}
|
}
|
||||||
|
@ -194,7 +197,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
f.openSelectionMode(R.string.local_index_mi_upload_gpx, R.drawable.ic_action_gup_dark,
|
f.openSelectionMode(R.string.local_index_mi_upload_gpx, R.drawable.ic_action_gup_dark,
|
||||||
R.drawable.ic_action_gup_light, new OnClickListener() {
|
R.drawable.ic_action_gup_light, new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -204,6 +207,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
||||||
selectedItems.toArray(new GpxInfo[selectedItems.size()]));
|
selectedItems.toArray(new GpxInfo[selectedItems.size()]));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).position(5).reg();
|
}).position(5).reg();
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,13 +136,14 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
|
||||||
R.drawable.ic_action_gloc_light).listen(new OnContextMenuClick() {
|
R.drawable.ic_action_gloc_light).listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
OsMoDevice o = (OsMoDevice) selectedObj;
|
OsMoDevice o = (OsMoDevice) selectedObj;
|
||||||
double lat = o.getLastLocation() == null ? latitude : o.getLastLocation().getLatitude();
|
double lat = o.getLastLocation() == null ? latitude : o.getLastLocation().getLatitude();
|
||||||
double lon = o.getLastLocation() == null ? longitude : o.getLastLocation().getLongitude();
|
double lon = o.getLastLocation() == null ? longitude : o.getLastLocation().getLongitude();
|
||||||
mapActivity.getMapView().setLatLon(lat, lon);
|
mapActivity.getMapView().setLatLon(lat, lon);
|
||||||
MapActivity.getMapViewTrackingUtilities().setMapLinkedToLocation(false);
|
MapActivity.getMapViewTrackingUtilities().setMapLinkedToLocation(false);
|
||||||
OsMoPositionLayer.setFollowTrackerId(o);
|
OsMoPositionLayer.setFollowTrackerId(o);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).position(0).reg();
|
}).position(0).reg();
|
||||||
if(OsMoPositionLayer.getFollowDestinationId() != null) {
|
if(OsMoPositionLayer.getFollowDestinationId() != null) {
|
||||||
|
@ -150,9 +151,10 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
|
||||||
R.drawable.ic_action_close_light).listen(new OnContextMenuClick() {
|
R.drawable.ic_action_close_light).listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked,
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked,
|
||||||
DialogInterface dialog) {
|
DialogInterface dialog) {
|
||||||
OsMoPositionLayer.setFollowDestination(null);
|
OsMoPositionLayer.setFollowDestination(null);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}).position(0).reg();
|
}).position(0).reg();
|
||||||
|
@ -161,13 +163,14 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
|
||||||
R.drawable.ic_action_flag_light).listen(new OnContextMenuClick() {
|
R.drawable.ic_action_flag_light).listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
OsMoDevice o = (OsMoDevice) selectedObj;
|
OsMoDevice o = (OsMoDevice) selectedObj;
|
||||||
if(o.getLastLocation() != null) {
|
if(o.getLastLocation() != null) {
|
||||||
TargetPointsHelper targets = mapActivity.getMyApplication().getTargetPointsHelper();
|
TargetPointsHelper targets = mapActivity.getMyApplication().getTargetPointsHelper();
|
||||||
targets.navigateToPoint(new LatLon(o.getLastLocation().getLatitude(), o.getLastLocation().getLongitude()), true, -1);
|
targets.navigateToPoint(new LatLon(o.getLastLocation().getLatitude(), o.getLastLocation().getLongitude()), true, -1);
|
||||||
}
|
}
|
||||||
OsMoPositionLayer.setFollowDestination(o);
|
OsMoPositionLayer.setFollowDestination(o);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).position(1).reg();
|
}).position(1).reg();
|
||||||
}
|
}
|
||||||
|
@ -291,10 +294,11 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
final double lat = view.getLatitude();
|
final double lat = view.getLatitude();
|
||||||
final double lon = view.getLongitude();
|
final double lon = view.getLongitude();
|
||||||
tracker.sendCoordinate(lat, lon);
|
tracker.sendCoordinate(lat, lon);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
}
|
}
|
||||||
|
@ -321,9 +325,10 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
|
||||||
helper.item(R.string.osmo_groups).icons(R.drawable.ic_action_eye_dark, R.drawable.ic_action_eye_light).position(6)
|
helper.item(R.string.osmo_groups).icons(R.drawable.ic_action_eye_dark, R.drawable.ic_action_eye_light).position(6)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
Intent intent = new Intent(mapActivity, OsMoGroupsActivity.class);
|
Intent intent = new Intent(mapActivity, OsMoGroupsActivity.class);
|
||||||
mapActivity.startActivity(intent);
|
mapActivity.startActivity(intent);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,11 +200,12 @@ public class ParkingPositionPlugin extends OsmandPlugin {
|
||||||
if (selectedObj == parkingPosition && parkingPosition != null) {
|
if (selectedObj == parkingPosition && parkingPosition != null) {
|
||||||
OnContextMenuClick removeListener = new OnContextMenuClick() {
|
OnContextMenuClick removeListener = new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int resId, int pos,
|
public boolean onContextMenuClick(int resId, int pos,
|
||||||
boolean isChecked, DialogInterface dialog) {
|
boolean isChecked, DialogInterface dialog) {
|
||||||
if ((resId == R.string.context_menu_item_delete_parking_point)) {
|
if ((resId == R.string.context_menu_item_delete_parking_point)) {
|
||||||
showDeleteDialog(mapActivity);
|
showDeleteDialog(mapActivity);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
adapter.item(R.string.context_menu_item_delete_parking_point)
|
adapter.item(R.string.context_menu_item_delete_parking_point)
|
||||||
|
@ -213,11 +214,12 @@ public class ParkingPositionPlugin extends OsmandPlugin {
|
||||||
|
|
||||||
OnContextMenuClick addListener = new OnContextMenuClick() {
|
OnContextMenuClick addListener = new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int resId, int pos,
|
public boolean onContextMenuClick(int resId, int pos,
|
||||||
boolean isChecked, DialogInterface dialog) {
|
boolean isChecked, DialogInterface dialog) {
|
||||||
if (resId == R.string.context_menu_item_add_parking_point) {
|
if (resId == R.string.context_menu_item_add_parking_point) {
|
||||||
showAddParkingDialog(mapActivity, latitude, longitude);
|
showAddParkingDialog(mapActivity, latitude, longitude);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
adapter.item(R.string.context_menu_item_add_parking_point)
|
adapter.item(R.string.context_menu_item_add_parking_point)
|
||||||
|
@ -419,8 +421,9 @@ public class ParkingPositionPlugin extends OsmandPlugin {
|
||||||
helper.item(R.string.osmand_parking_delete)
|
helper.item(R.string.osmand_parking_delete)
|
||||||
.icons(R.drawable.ic_action_remove_dark, R.drawable.ic_action_remove_light).listen(new OnContextMenuClick() {
|
.icons(R.drawable.ic_action_remove_dark, R.drawable.ic_action_remove_light).listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
showDeleteDialog(mapActivity);
|
showDeleteDialog(mapActivity);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}).reg();
|
}).reg();
|
||||||
|
|
|
@ -186,7 +186,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
|
||||||
final MapActivityLayers layers = mapActivity.getMapLayers();
|
final MapActivityLayers layers = mapActivity.getMapLayers();
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
if (itemId == R.string.layer_map) {
|
if (itemId == R.string.layer_map) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
layers.selectMapLayer(mapView);
|
layers.selectMapLayer(mapView);
|
||||||
|
@ -210,6 +210,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
|
||||||
mapActivity);
|
mapActivity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
adapter.item(R.string.layer_map).icons(R.drawable.ic_action_globus_dark, R.drawable.ic_action_globus_light)
|
adapter.item(R.string.layer_map).icons(R.drawable.ic_action_globus_dark, R.drawable.ic_action_globus_light)
|
||||||
|
@ -228,13 +229,14 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
|
||||||
if (mapView.getMainLayer() instanceof MapTileLayer) {
|
if (mapView.getMainLayer() instanceof MapTileLayer) {
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int resId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int resId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
if (resId == R.string.context_menu_item_update_map) {
|
if (resId == R.string.context_menu_item_update_map) {
|
||||||
mapActivity.getMapActions().reloadTile(mapView.getZoom(), latitude, longitude);
|
mapActivity.getMapActions().reloadTile(mapView.getZoom(), latitude, longitude);
|
||||||
} else if (resId == R.string.context_menu_item_download_map) {
|
} else if (resId == R.string.context_menu_item_download_map) {
|
||||||
DownloadTilesDialog dlg = new DownloadTilesDialog(mapActivity, (OsmandApplication) mapActivity.getApplication(), mapView);
|
DownloadTilesDialog dlg = new DownloadTilesDialog(mapActivity, (OsmandApplication) mapActivity.getApplication(), mapView);
|
||||||
dlg.openDialog();
|
dlg.openDialog();
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
adapter.item(R.string.context_menu_item_update_map).icons(R.drawable.ic_action_refresh_dark, R.drawable.ic_action_refresh_light)
|
adapter.item(R.string.context_menu_item_update_map).icons(R.drawable.ic_action_refresh_dark, R.drawable.ic_action_refresh_light)
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class RoutePointsLayer extends OsmandMapLayer implements ContextMenuLaye
|
||||||
final GPXUtilities.WptPt point = (GPXUtilities.WptPt) o;
|
final GPXUtilities.WptPt point = (GPXUtilities.WptPt) o;
|
||||||
ContextMenuAdapter.OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
ContextMenuAdapter.OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
if (itemId == R.string.mark_as_not_visited){
|
if (itemId == R.string.mark_as_not_visited){
|
||||||
plugin.getCurrentRoute().markPoint(point,false);
|
plugin.getCurrentRoute().markPoint(point,false);
|
||||||
plugin.saveCurrentRoute();
|
plugin.saveCurrentRoute();
|
||||||
|
@ -91,6 +91,7 @@ public class RoutePointsLayer extends OsmandMapLayer implements ContextMenuLaye
|
||||||
plugin.saveCurrentRoute();
|
plugin.saveCurrentRoute();
|
||||||
}
|
}
|
||||||
map.refreshMap();
|
map.refreshMap();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -513,8 +513,9 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
|
||||||
adapter.item(R.string.show_waypoint_information).icons(R.drawable.ic_action_info_dark, R.drawable.ic_action_info_light ).position(0)
|
adapter.item(R.string.show_waypoint_information).icons(R.drawable.ic_action_info_dark, R.drawable.ic_action_info_light ).position(0)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
showFavoriteDialog(mapActivity, selectedStage, sf);
|
showFavoriteDialog(mapActivity, selectedStage, sf);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
|
|
||||||
|
@ -564,19 +565,21 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
|
||||||
R.drawable.ic_action_gremove_dark, R.drawable.ic_action_gremove_light)
|
R.drawable.ic_action_gremove_dark, R.drawable.ic_action_gremove_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
app.getSettings().SHOW_POI_OVER_MAP.set(false);
|
app.getSettings().SHOW_POI_OVER_MAP.set(false);
|
||||||
mapActivity.getMapLayers().updateLayers(mapActivity.getMapView());
|
mapActivity.getMapLayers().updateLayers(mapActivity.getMapView());
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
} else {
|
} else {
|
||||||
adapter.item(R.string.poi).icons(R.drawable.ic_action_layers_dark, R.drawable.ic_action_layers_light)
|
adapter.item(R.string.poi).icons(R.drawable.ic_action_layers_dark, R.drawable.ic_action_layers_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
mapActivity.getMapLayers().selectPOIFilterLayer(mapActivity.getMapView(), null);
|
mapActivity.getMapLayers().selectPOIFilterLayer(mapActivity.getMapView(), null);
|
||||||
app.getSettings().SHOW_POI_OVER_MAP.set(true);
|
app.getSettings().SHOW_POI_OVER_MAP.set(true);
|
||||||
mapActivity.getMapLayers().updateLayers(mapActivity.getMapView());
|
mapActivity.getMapLayers().updateLayers(mapActivity.getMapView());
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
}
|
}
|
||||||
|
@ -584,10 +587,11 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
|
||||||
adapter.item(R.string.sherpafy_tour_info_txt).icons(R.drawable.ic_action_info_dark, R.drawable.ic_action_info_light)
|
adapter.item(R.string.sherpafy_tour_info_txt).icons(R.drawable.ic_action_info_dark, R.drawable.ic_action_info_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
Intent newIntent = new Intent(mapActivity, TourViewActivity.class);
|
Intent newIntent = new Intent(mapActivity, TourViewActivity.class);
|
||||||
// newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
// newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
mapActivity.startActivity(newIntent);
|
mapActivity.startActivity(newIntent);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
//complete stage
|
//complete stage
|
||||||
|
@ -597,9 +601,10 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
|
||||||
.icons(R.drawable.ic_action_finish_flag_dark, R.drawable.ic_action_finish_flag_light)
|
.icons(R.drawable.ic_action_finish_flag_dark, R.drawable.ic_action_finish_flag_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
markStageAsCompleted(stage);
|
markStageAsCompleted(stage);
|
||||||
showCompleteStageFragment(mapActivity, stage, false);
|
showCompleteStageFragment(mapActivity, stage, false);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
}
|
}
|
||||||
|
@ -607,12 +612,13 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
|
||||||
adapter.item(R.string.context_menu_item_share_location).icons(
|
adapter.item(R.string.context_menu_item_share_location).icons(
|
||||||
R.drawable.ic_action_gshare_dark, R.drawable.ic_action_gshare_light).listen(new OnContextMenuClick() {
|
R.drawable.ic_action_gshare_dark, R.drawable.ic_action_gshare_light).listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
if (app.getLocationProvider().getLastKnownLocation() != null) {
|
if (app.getLocationProvider().getLastKnownLocation() != null) {
|
||||||
new ShareLocation(mapActivity).run();
|
new ShareLocation(mapActivity).run();
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(app, R.string.unknown_location, Toast.LENGTH_LONG).show();
|
Toast.makeText(app, R.string.unknown_location, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,11 +95,12 @@ public class SRTMPlugin extends OsmandPlugin {
|
||||||
public void registerLayerContextMenuActions(final OsmandMapTileView mapView, ContextMenuAdapter adapter, final MapActivity mapActivity) {
|
public void registerLayerContextMenuActions(final OsmandMapTileView mapView, ContextMenuAdapter adapter, final MapActivity mapActivity) {
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
if (itemId == R.string.layer_hillshade) {
|
if (itemId == R.string.layer_hillshade) {
|
||||||
HILLSHADE.set(!HILLSHADE.get());
|
HILLSHADE.set(!HILLSHADE.get());
|
||||||
updateLayers(mapView, mapActivity);
|
updateLayers(mapView, mapActivity);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
adapter.item(R.string.layer_hillshade).selected(HILLSHADE.get()? 1 : 0)
|
adapter.item(R.string.layer_hillshade).selected(HILLSHADE.get()? 1 : 0)
|
||||||
|
|
|
@ -198,7 +198,7 @@ public class FavoritesLayer extends OsmandMapLayer implements ContextMenuLayer.
|
||||||
final FavouritePoint a = (FavouritePoint) o;
|
final FavouritePoint a = (FavouritePoint) o;
|
||||||
OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
if (itemId == R.string.favourites_context_menu_delete) {
|
if (itemId == R.string.favourites_context_menu_delete) {
|
||||||
final Resources resources = view.getContext().getResources();
|
final Resources resources = view.getContext().getResources();
|
||||||
Builder builder = new AlertDialog.Builder(view.getContext());
|
Builder builder = new AlertDialog.Builder(view.getContext());
|
||||||
|
@ -213,6 +213,7 @@ public class FavoritesLayer extends OsmandMapLayer implements ContextMenuLayer.
|
||||||
});
|
});
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
adapter.item(R.string.favourites_context_menu_delete)
|
adapter.item(R.string.favourites_context_menu_delete)
|
||||||
|
|
|
@ -256,7 +256,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
||||||
final Amenity a = (Amenity) o;
|
final Amenity a = (Amenity) o;
|
||||||
OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
if (itemId == R.string.poi_context_menu_call) {
|
if (itemId == R.string.poi_context_menu_call) {
|
||||||
try {
|
try {
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
|
@ -278,6 +278,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
||||||
} else if (itemId == R.string.poi_context_menu_showdescription) {
|
} else if (itemId == R.string.poi_context_menu_showdescription) {
|
||||||
showDescriptionDialog(a);
|
showDescriptionDialog(a);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (OsmAndFormatter.getAmenityDescriptionContent(view.getApplication(), a, false).length() > 0) {
|
if (OsmAndFormatter.getAmenityDescriptionContent(view.getApplication(), a, false).length() > 0) {
|
||||||
|
|
|
@ -220,7 +220,7 @@ public class PointNavigationLayer extends OsmandMapLayer implements IContextMenu
|
||||||
final TargetPoint a = (TargetPoint) o;
|
final TargetPoint a = (TargetPoint) o;
|
||||||
OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
if (itemId == R.string.delete_target_point) {
|
if (itemId == R.string.delete_target_point) {
|
||||||
TargetPointsHelper targetPointsHelper = map.getMyApplication().getTargetPointsHelper();
|
TargetPointsHelper targetPointsHelper = map.getMyApplication().getTargetPointsHelper();
|
||||||
if(a.intermediate) {
|
if(a.intermediate) {
|
||||||
|
@ -230,6 +230,7 @@ public class PointNavigationLayer extends OsmandMapLayer implements IContextMenu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
map.getMapLayers().getContextMenuLayer().setLocation(null, "");
|
map.getMapLayers().getContextMenuLayer().setLocation(null, "");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -216,8 +216,9 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
|
||||||
final TransportStop a = (TransportStop) o;
|
final TransportStop a = (TransportStop) o;
|
||||||
OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
showDescriptionDialog(a);
|
showDescriptionDialog(a);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
adapter.item(R.string.poi_context_menu_showdescription)
|
adapter.item(R.string.poi_context_menu_showdescription)
|
||||||
|
|
Loading…
Reference in a new issue