Merge branch 'master' into plan_route_bugs_ui_widgets

# Conflicts:
#	OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java
This commit is contained in:
Vitaliy 2020-09-11 19:19:37 +03:00
commit d5b1ed852b
8 changed files with 48 additions and 24 deletions

View file

@ -484,11 +484,17 @@
<data android:host="map.wap.qq.com" />
<data android:host="map.qq.com" />
<data android:host="maps.apple.com" />
<data android:host="ge0.me" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<intent-filter>
<data android:host="ge0.me" android:scheme="https"/>
<data android:host="ge0.me" android:scheme="http"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
<intent-filter>
<data android:scheme="http" android:host="openstreetmap.de" android:pathPrefix="/karte" />
<data android:scheme="https" android:host="openstreetmap.de" android:pathPrefix="/karte" />

View file

@ -150,7 +150,7 @@
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/address_button"
android:layout_width="wrap_content"
android:layout_height="@dimen/context_menu_buttons_bottom_height"
android:layout_height="@dimen/setting_list_item_small_height"
android:layout_marginStart="@dimen/content_padding_half"
android:layout_marginLeft="@dimen/content_padding_half"
android:layout_marginTop="@dimen/content_padding_small"
@ -166,6 +166,13 @@
osmand:typeface="@string/font_roboto_medium"
tools:text="@string/add_address" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:background="?attr/dashboard_divider" />
<LinearLayout
android:id="@+id/description"
android:layout_width="match_parent"
@ -206,7 +213,7 @@
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/description_button"
android:layout_width="wrap_content"
android:layout_height="@dimen/context_menu_buttons_bottom_height"
android:layout_height="@dimen/setting_list_item_small_height"
android:layout_marginStart="@dimen/content_padding_half"
android:layout_marginLeft="@dimen/content_padding_half"
android:drawablePadding="8dp"

View file

@ -53,7 +53,7 @@
<string name="pass_whole_track_descr">Point of the track to navigate</string>
<string name="navigate_to_track_descr">Navigate from my location to the track</string>
<string name="select_another_track">Select another track</string>
<string name="import_track_descr">Choose track file to follow, or import one.</string>
<string name="import_track_descr">Choose track file to follow or import it from your device.</string>
<string name="follow_track_descr">Choose track file to follow</string>
<string name="follow_track">Follow track</string>
<string name="marker_save_as_track">Save as track file</string>
@ -70,22 +70,22 @@
<string name="add_segment_to_the_track">Add to a track file</string>
<string name="shared_string_save_as_gpx">Save as new track file</string>
<string name="in_case_of_reverse_direction">In case of reverse direction</string>
<string name="plan_route_exit_dialog_descr">Are you sure you want to close Plan route without saving? You will lose all changes.</string>
<string name="plan_route_exit_dialog_descr">Are you sure you want discard all changes in the planned route by closing it?</string>
<string name="street_level_imagery">Street-level imagery</string>
<string name="route_between_points_add_track_desc">Select a track file for which a new segment will be added.</string>
<string name="rourte_between_points_add_track_desc">Select a track file to add the new segment to.</string>
<string name="navigation_profile">Navigation profile</string>
<string name="threshold_distance">Threshold distance</string>
<string name="route_between_points_warning_desc">To use this option OsmAnd need to snap your track to the map roads. \n\n On the next step you will need to select navigation profile to detect allowed roads and threshold distance to approximate you track with roads.</string>
<string name="rourte_between_points_warning_desc">Next, snap your track to the nearest allowed road with one of your navigation profiles to use this option.</string>
<string name="next_segment">Next segment</string>
<string name="whole_track">Whole track</string>
<string name="route_between_points_desc">Select how to connect points, with a straight line, or calculate a route between them with selected profile.</string>
<string name="route_between_points_next_segment_button_desc">Only next segment will be recalculated using selected profile.</string>
<string name="route_between_points_whole_track_button_desc">Whole track will be recalculated using selected profile.</string>
<string name="route_between_points_next_segment_button_desc">Only the next segment will be recalculated using selected profile.</string>
<string name="route_between_points_whole_track_button_desc">The whole track will be recalculated using the selected profile.</string>
<string name="reverse_route">Reverse route</string>
<string name="save_as_new_track">Save as new Track</string>
<string name="save_as_new_track">Save as new track</string>
<string name="overwrite_track">Overwrite track</string>
<string name="shared_string_done">Done</string>
<string name="plan_route_select_track_file_for_open">Select a track file for open.</string>
<string name="plan_route_select_track_file_for_open">Select a track file to open.</string>
<string name="plan_route_create_new_route">Create new route</string>
<string name="plan_route_open_existing_track">Open existing track</string>
<string name="plan_route_import_track">Import track</string>
@ -96,29 +96,29 @@
<string name="gpx_split_interval_none_descr">Select the desired splitting option: by time or by distance.</string>
<string name="gpx_split_interval_descr">Select the interval at which marks with distance or time on the track will be displayed.</string>
<string name="select_track_width">Select width</string>
<string name="track_show_start_finish_icons">Show start finish icons</string>
<string name="add_to_a_track">Add to a Track</string>
<string name="track_show_start_finish_icons">Show start and finish icons</string>
<string name="add_to_a_track">Add to a track</string>
<string name="plan_a_route">Plan a route</string>
<string name="route_between_points">Route between points</string>
<string name="set_working_days_to_continue">You need to set working days to continue</string>
<string name="osm_edit_closed_note">Closed OSM Note</string>
<string name="set_working_days_to_continue">Set working days to continue</string>
<string name="osm_edit_closed_note">Closed OSM note</string>
<string name="app_mode_go_cart">Go-cart</string>
<string name="app_mode_wheelchair_forward">Wheelchair forward</string>
<string name="app_mode_wheelchair">Wheelchair</string>
<string name="app_mode_motor_scooter">Motor scooter</string>
<string name="app_mode_enduro_motorcycle">Enduro motorcycle</string>
<string name="add_hidden_group_info">The added point will not be visible on the map, since the selected group is hidden, you can find it in \"%s\".</string>
<string name="plugin_wikipedia_description">Get information about points of interest from Wikipedia. It is your pocket offline guide - just enable Wikipedia plugin and enjoy articles about objects around you.</string>
<string name="plugin_wikipedia_description">Get info about points of interest from Wikipedia. It is your pocket offline guide - just turn on the Wikipedia plugin and enjoy articles about objects around you.</string>
<string name="search_download_wikipedia_maps">Download Wikipedia maps</string>
<string name="quick_action_remove_next_destination_descr">The current destination point on the route will be deleted. If it will be the Destination, navigation will stop.</string>
<string name="please_provide_point_name_error">Please provide a name for the point</string>
<string name="use_volume_buttons_as_zoom">Volume buttons as zoom</string>
<string name="use_volume_buttons_as_zoom_descr">Enable to control the map zoom level with device volume buttons.</string>
<string name="quick_action_remove_next_destination">Delete next destination point</string>
<string name="use_volume_buttons_as_zoom_descr">Control the map-zoom level using the volume buttons on the device.</string>
<string name="quick_action_remove_next_destination">Delete nearest destination point</string>
<string name="app_mode_inline_skates">Inline skates</string>
<string name="speed_cameras_removed_descr">This device doesn\'t have speed cameras.</string>
<string name="shared_string_uninstall_and_restart">Uninstall and Restart</string>
<string name="speed_cameras_restart_descr">Restart is needed to completely delete speed camera data.</string>
<string name="speed_cameras_restart_descr">Restart the app to delete all speed camera data.</string>
<string name="item_deleted">%1$s deleted</string>
<string name="shared_string_bearing">Bearing</string>
<string name="routing_attr_length_name">Length limit</string>

View file

@ -38,6 +38,7 @@ import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.textfield.TextInputEditText;
import com.google.android.material.textfield.TextInputLayout;
import net.osmand.AndroidUtils;
@ -276,8 +277,9 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
if (addressCaption.getVisibility() != View.VISIBLE) {
addressCaption.setVisibility(View.VISIBLE);
addAddressBtn.setText(view.getResources().getString(R.string.delete_address));
View addressEdit = view.findViewById(R.id.address_edit);
TextInputEditText addressEdit = view.findViewById(R.id.address_edit);
addressEdit.requestFocus();
addressEdit.setSelection(addressEdit.getText().length());
AndroidUtils.softKeyboardDelayed(requireActivity(),addressEdit);
} else {
addressCaption.setVisibility(View.GONE);

View file

@ -743,7 +743,7 @@ public class MeasurementEditingContext {
locations.add(l);
}
pair.second.setTrkPtIndex(locations.size() - 1);
if (i < size - 2) {
if (i < size - 2 && !locations.isEmpty()) {
locations.remove(locations.size() - 1);
}
route.addAll(data.segments);

View file

@ -166,6 +166,10 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
this.planRouteMode = planRouteMode;
}
private void setDirectionMode(boolean directionMode) {
this.directionMode = directionMode;
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@ -1894,10 +1898,12 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
return showFragment(fragment, fragmentManager);
}
public static boolean showInstance(FragmentManager fragmentManager, MeasurementEditingContext editingCtx, boolean planRoute) {
public static boolean showInstance(FragmentManager fragmentManager, MeasurementEditingContext editingCtx,
boolean planRoute, boolean directionMode) {
MeasurementToolFragment fragment = new MeasurementToolFragment();
fragment.setEditingCtx(editingCtx);
fragment.setPlanRouteMode(planRoute);
fragment.setDirectionMode(directionMode);
return showFragment(fragment, fragmentManager);
}

View file

@ -82,6 +82,7 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
private GPXFile gpxFile;
private boolean editingTrack;
private boolean selectingTrack;
private int menuTitleHeight;
@ -529,6 +530,7 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
public void openPlanRoute(boolean useAppMode) {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null && gpxFile != null) {
editingTrack = true;
QuadRect rect = gpxFile.getRect();
TrkSegment segment = gpxFile.getNonEmptyTrkSegment();
ActionType actionType = segment == null ? ActionType.ADD_ROUTE_POINTS : ActionType.EDIT_SEGMENT;
@ -538,7 +540,7 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
if (useAppMode) {
editingContext.setAppMode(app.getRoutingHelper().getAppMode());
}
MeasurementToolFragment.showInstance(mapActivity.getSupportFragmentManager(), editingContext, true);
MeasurementToolFragment.showInstance(mapActivity.getSupportFragmentManager(), editingContext, true, true);
}
}
@ -609,7 +611,7 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
private void onDismiss() {
try {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
if (mapActivity != null && !editingTrack) {
if (!mapActivity.isChangingConfigurations()) {
mapActivity.getMapRouteInfoMenu().cancelSelectionFromTracks();
}

View file

@ -1566,6 +1566,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
if (mapActivity != null) {
GPXRouteParamsBuilder routeParams = mapActivity.getRoutingHelper().getCurrentGPXRoute();
if (routeParams != null) {
hide();
selectTrack();
}
}