use of net.osmand.plus.activities.MapActivity in project Osmand by osmandapp.
the class MeasurementToolFragment method enterMeasurementMode.
private void enterMeasurementMode() {
MapActivity mapActivity = getMapActivity();
MeasurementToolLayer measurementLayer = getMeasurementLayer();
if (mapActivity != null && measurementLayer != null) {
measurementLayer.setInMeasurementMode(true);
mapActivity.refreshMap();
mapActivity.disableDrawer();
mark(portrait ? View.INVISIBLE : View.GONE, R.id.map_left_widgets_panel, R.id.map_right_widgets_panel, R.id.map_center_info);
mark(View.GONE, R.id.map_route_info_button, R.id.map_menu_button, R.id.map_compass_button, R.id.map_layers_button, R.id.map_search_button, R.id.map_quick_actions_button);
View collapseButton = mapActivity.findViewById(R.id.map_collapse_button);
if (collapseButton != null && collapseButton.getVisibility() == View.VISIBLE) {
wasCollapseButtonVisible = true;
collapseButton.setVisibility(View.INVISIBLE);
} else {
wasCollapseButtonVisible = false;
}
updateText();
}
}
use of net.osmand.plus.activities.MapActivity in project Osmand by osmandapp.
the class MeasurementToolFragment method showPointsList.
private void showPointsList() {
pointsListOpened = true;
upDownBtn.setImageDrawable(downIcon);
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
if (portrait && pointsListContainer != null) {
pointsListContainer.setVisibility(View.VISIBLE);
} else {
showPointsListFragment();
}
OsmandMapTileView tileView = mapActivity.getMapView();
previousMapPosition = tileView.getMapPosition();
if (portrait) {
tileView.setMapPosition(MIDDLE_TOP_CONSTANT);
} else {
tileView.setMapPosition(LANDSCAPE_MIDDLE_RIGHT_CONSTANT);
}
mapActivity.refreshMap();
}
}
use of net.osmand.plus.activities.MapActivity in project Osmand by osmandapp.
the class MeasurementToolFragment method setPreviousMapPosition.
private void setPreviousMapPosition() {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
mapActivity.getMapView().setMapPosition(previousMapPosition);
mapActivity.refreshMap();
}
}
use of net.osmand.plus.activities.MapActivity in project Osmand by osmandapp.
the class MeasurementToolFragment method createOptionsFragmentListener.
private OptionsFragmentListener createOptionsFragmentListener() {
return new OptionsFragmentListener() {
final MapActivity mapActivity = getMapActivity();
final MeasurementToolLayer measurementLayer = getMeasurementLayer();
@Override
public void snapToRoadOnCLick() {
if (!editingCtx.isInSnapToRoadMode()) {
showSnapToRoadMenu(true);
} else {
disableSnapToRoadMode();
}
}
@Override
public void addToGpxOnClick() {
if (mapActivity != null && measurementLayer != null) {
if (editingCtx.getPointsCount() > 0) {
addToGpx(mapActivity);
} else {
Toast.makeText(mapActivity, getString(R.string.none_point_error), Toast.LENGTH_SHORT).show();
}
}
}
@Override
public void saveAsNewTrackOnClick() {
if (mapActivity != null && measurementLayer != null) {
if (editingCtx.getPointsCount() > 0) {
openSaveAsNewTrackMenu(mapActivity);
} else {
Toast.makeText(mapActivity, getString(R.string.none_point_error), Toast.LENGTH_SHORT).show();
}
}
}
@Override
public void addToTheTrackOnClick() {
if (mapActivity != null && measurementLayer != null) {
if (editingCtx.getPointsCount() > 0) {
showAddToTrackDialog(mapActivity);
} else {
Toast.makeText(mapActivity, getString(R.string.none_point_error), Toast.LENGTH_SHORT).show();
}
}
}
@Override
public void clearAllOnClick() {
editingCtx.getCommandManager().execute(new ClearPointsCommand(measurementLayer));
editingCtx.cancelSnapToRoad();
if (pointsListOpened) {
hidePointsList();
}
disable(redoBtn, upDownBtn);
updateText();
saved = false;
}
};
}
use of net.osmand.plus.activities.MapActivity in project Osmand by osmandapp.
the class MeasurementToolFragment method switchMovePointMode.
private void switchMovePointMode(boolean enable) {
if (enable) {
toolBarController.setBackBtnIconIds(R.drawable.ic_action_mode_back, R.drawable.ic_action_mode_back);
} else {
toolBarController.setBackBtnIconIds(R.drawable.ic_action_remove_dark, R.drawable.ic_action_remove_dark);
}
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
mapActivity.showTopToolbar(toolBarController);
}
markGeneralComponents(enable ? View.GONE : View.VISIBLE);
mark(enable ? View.VISIBLE : View.GONE, R.id.move_point_text, R.id.move_point_controls);
mainIcon.setImageDrawable(getActiveIcon(enable ? R.drawable.ic_action_move_point : R.drawable.ic_action_ruler));
}
Aggregations