MyPosition icon change depending on permission
This commit is contained in:
parent
68e7c8ef0a
commit
476caf23c8
2 changed files with 9 additions and 2 deletions
|
@ -27,6 +27,7 @@ import net.osmand.data.PointDescription;
|
||||||
import net.osmand.plus.FavouritesDbHelper;
|
import net.osmand.plus.FavouritesDbHelper;
|
||||||
import net.osmand.plus.MapMarkersHelper;
|
import net.osmand.plus.MapMarkersHelper;
|
||||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||||
|
import net.osmand.plus.OsmAndLocationProvider;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.TargetPointsHelper;
|
import net.osmand.plus.TargetPointsHelper;
|
||||||
|
@ -213,7 +214,8 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment {
|
||||||
|
|
||||||
private void createMyLocItem() {
|
private void createMyLocItem() {
|
||||||
BaseBottomSheetItem myLocationItem = new SimpleBottomSheetItem.Builder()
|
BaseBottomSheetItem myLocationItem = new SimpleBottomSheetItem.Builder()
|
||||||
.setIcon(getIcon(R.drawable.ic_action_location_color, 0))
|
.setIcon(getIcon(OsmAndLocationProvider.isLocationPermissionAvailable(getActivity())
|
||||||
|
? R.drawable.ic_action_location_color : R.drawable.ic_action_location_color_lost, 0))
|
||||||
.setTitle(getString(R.string.shared_string_my_location))
|
.setTitle(getString(R.string.shared_string_my_location))
|
||||||
.setLayoutId(R.layout.bottom_sheet_item_simple_56dp)
|
.setLayoutId(R.layout.bottom_sheet_item_simple_56dp)
|
||||||
.setOnClickListener(new OnClickListener() {
|
.setOnClickListener(new OnClickListener() {
|
||||||
|
|
|
@ -1640,9 +1640,14 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
|
|
||||||
public void updateFromIcon(View parentView) {
|
public void updateFromIcon(View parentView) {
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
|
|
||||||
|
int locationIconResByStatus = OsmAndLocationProvider.isLocationPermissionAvailable(mapActivity)
|
||||||
|
? R.drawable.ic_action_location_color : R.drawable.ic_action_location_color_lost;
|
||||||
|
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
((ImageView) parentView.findViewById(R.id.fromIcon)).setImageDrawable(ContextCompat.getDrawable(mapActivity,
|
((ImageView) parentView.findViewById(R.id.fromIcon)).setImageDrawable(ContextCompat.getDrawable(mapActivity,
|
||||||
mapActivity.getMyApplication().getTargetPointsHelper().getPointToStart() == null ? R.drawable.ic_action_location_color : R.drawable.list_startpoint));
|
mapActivity.getMyApplication().getTargetPointsHelper().getPointToStart() == null
|
||||||
|
? locationIconResByStatus : R.drawable.list_startpoint));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue