route profile naming changes
This commit is contained in:
parent
35bd2ede3d
commit
baf0fb4294
2 changed files with 45 additions and 30 deletions
|
@ -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()));
|
||||
|
|
|
@ -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,6 +228,11 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment {
|
|||
public void onClick(View v) {
|
||||
OsmandApplication app = getMyApplication();
|
||||
if (app != null) {
|
||||
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) {
|
||||
|
@ -251,12 +263,15 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
}).create();
|
||||
items.add(myLocationItem);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void createSelectOnTheMapItem() {
|
||||
BaseBottomSheetItem selectOnTheMapItem = new SimpleBottomSheetItem.Builder()
|
||||
.setIcon(getContentIcon(R.drawable.ic_show_on_map))
|
||||
|
|
Loading…
Reference in a new issue