route profile naming changes

This commit is contained in:
madwasp79 2019-05-23 15:29:38 +03:00
parent 35bd2ede3d
commit baf0fb4294
2 changed files with 45 additions and 30 deletions

View file

@ -709,12 +709,12 @@ public class EditProfileFragment extends BaseOsmAndFragment {
int iconRes = R.drawable.ic_action_gdirections_dark;
String name = e.getValue().getProfileName();
String description = context.getString(R.string.osmand_default_routing);
if (RoutingProfilesResources.isRpValue(name.toUpperCase())){
if (!Algorithms.isEmpty(e.getValue().getFilename())) {
description = e.getValue().getFilename();
} else if (RoutingProfilesResources.isRpValue(name.toUpperCase())){
iconRes = RoutingProfilesResources.valueOf(name.toUpperCase()).getIconRes();
name = context
.getString(RoutingProfilesResources.valueOf(name.toUpperCase()).getStringRes());
} else if (!Algorithms.isEmpty(e.getValue().getFilename())) {
description = e.getValue().getFilename();
}
profilesObjects.add(new RoutingProfileDataObject(e.getKey(), name, description,
iconRes, false, e.getValue().getFilename()));

View file

@ -1,11 +1,15 @@
package net.osmand.plus.routepreparationmenu;
import android.Manifest;
import android.Manifest.permission;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
@ -27,6 +31,7 @@ import net.osmand.data.PointDescription;
import net.osmand.plus.FavouritesDbHelper;
import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.OsmAndLocationProvider;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.TargetPointsHelper;
@ -212,6 +217,8 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment {
}
private void createMyLocItem() {
BaseBottomSheetItem myLocationItem = new SimpleBottomSheetItem.Builder()
.setIcon(getIcon(R.drawable.ic_action_location_color, 0))
.setTitle(getString(R.string.shared_string_my_location))
@ -221,33 +228,39 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment {
public void onClick(View v) {
OsmandApplication app = getMyApplication();
if (app != null) {
TargetPointsHelper targetPointsHelper = app.getTargetPointsHelper();
Location myLocation = app.getLocationProvider().getLastKnownLocation();
if (myLocation != null) {
LatLon ll = new LatLon(myLocation.getLatitude(), myLocation.getLongitude());
switch (pointType) {
case START:
if (targetPointsHelper.getPointToStart() != null) {
targetPointsHelper.clearStartPoint(true);
app.getSettings().backupPointToStart();
}
break;
case TARGET:
app.showShortToastMessage(R.string.add_destination_point);
targetPointsHelper.navigateToPoint(ll, true, -1);
break;
case INTERMEDIATE:
app.showShortToastMessage(R.string.add_intermediate_point);
targetPointsHelper.navigateToPoint(ll, true, targetPointsHelper.getIntermediatePoints().size());
break;
case HOME:
app.showShortToastMessage(R.string.add_intermediate_point);
targetPointsHelper.setHomePoint(ll, null);
break;
case WORK:
app.showShortToastMessage(R.string.add_intermediate_point);
targetPointsHelper.setWorkPoint(ll, null);
break;
if (getActivity() != null && !OsmAndLocationProvider.isLocationPermissionAvailable(getActivity())) {
ActivityCompat.requestPermissions(getActivity(),
new String[] {Manifest.permission.ACCESS_FINE_LOCATION},
OsmAndLocationProvider.REQUEST_LOCATION_PERMISSION);
} else {
TargetPointsHelper targetPointsHelper = app.getTargetPointsHelper();
Location myLocation = app.getLocationProvider().getLastKnownLocation();
if (myLocation != null) {
LatLon ll = new LatLon(myLocation.getLatitude(), myLocation.getLongitude());
switch (pointType) {
case START:
if (targetPointsHelper.getPointToStart() != null) {
targetPointsHelper.clearStartPoint(true);
app.getSettings().backupPointToStart();
}
break;
case TARGET:
app.showShortToastMessage(R.string.add_destination_point);
targetPointsHelper.navigateToPoint(ll, true, -1);
break;
case INTERMEDIATE:
app.showShortToastMessage(R.string.add_intermediate_point);
targetPointsHelper.navigateToPoint(ll, true, targetPointsHelper.getIntermediatePoints().size());
break;
case HOME:
app.showShortToastMessage(R.string.add_intermediate_point);
targetPointsHelper.setHomePoint(ll, null);
break;
case WORK:
app.showShortToastMessage(R.string.add_intermediate_point);
targetPointsHelper.setWorkPoint(ll, null);
break;
}
}
}
}
@ -257,6 +270,8 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment {
items.add(myLocationItem);
}
private void createSelectOnTheMapItem() {
BaseBottomSheetItem selectOnTheMapItem = new SimpleBottomSheetItem.Builder()
.setIcon(getContentIcon(R.drawable.ic_show_on_map))