new AIDL method which allow to modify state (on/off) of OsmAnd's plug-ins

AIDL methods fixes (renaiming Customization constants)
This commit is contained in:
madwasp79 2019-01-09 15:05:46 +02:00
parent 45c58c7495
commit c6dc26cb5f
35 changed files with 596 additions and 332 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

@ -54,6 +54,8 @@ import net.osmand.aidl.gpx.RemoveGpxParams;
import net.osmand.aidl.maplayer.point.ShowMapPointParams;
import net.osmand.aidl.navdrawer.SetNavDrawerItemsParams;
import net.osmand.aidl.navdrawer.NavDrawerFooterParams;
import net.osmand.aidl.navdrawer.NavDrawerHeaderParams;
import net.osmand.aidl.navigation.PauseNavigationParams;
import net.osmand.aidl.navigation.ResumeNavigationParams;
@ -74,6 +76,10 @@ import net.osmand.aidl.gpx.AGpxFile;
import net.osmand.aidl.gpx.AGpxFileDetails;
import net.osmand.aidl.tiles.ASqliteDbFile;
import net.osmand.aidl.plugins.PluginParams;
// NOTE: Add new methods at the end of file!!!
@ -161,9 +167,10 @@ interface IOsmAndAidlInterface {
boolean showSqliteDbFile(String fileName);
boolean hideSqliteDbFile(String fileName);
boolean setNavDrawerLogoWithParams(in String imageUri, String packageName, String intent);
boolean setNavDrawerFooterParams(in String packageName, String intent, String appName);
boolean setNavDrawerLogoWithParams(in NavDrawerHeaderParams params);
boolean setNavDrawerFooterWithParams(in NavDrawerFooterParams params);
boolean restoreOsmand();
boolean changePluginState(in PluginParams params);
}

View file

@ -36,6 +36,7 @@ import net.osmand.aidl.maplayer.AMapLayer;
import net.osmand.aidl.maplayer.point.AMapPoint;
import net.osmand.aidl.mapmarker.AMapMarker;
import net.osmand.aidl.mapwidget.AMapWidget;
import net.osmand.aidl.plugins.PluginParams;
import net.osmand.aidl.search.SearchResult;
import net.osmand.aidl.tiles.ASqliteDbFile;
import net.osmand.data.FavouritePoint;
@ -1866,7 +1867,7 @@ public class OsmandAidlApi {
return app.getAppCustomization().setNavDrawerLogoWithParams(uri, packageName, intent);
}
boolean setNavDrawerFooterParams(@Nullable String packageName, @Nullable String intent, @Nullable String appName) {
boolean setNavDrawerFooterWithParams(@NonNull String packageName, @Nullable String intent, @Nullable String appName) {
return app.getAppCustomization().setNavDrawerFooterAction(packageName, intent, appName);
}
@ -1874,6 +1875,10 @@ public class OsmandAidlApi {
return app.getAppCustomization().restoreOsmand();
}
boolean changePluginState(PluginParams params) {
return app.getAppCustomization().changePluginStatus(params);
}
private static AGpxFileDetails createGpxFileDetails(@NonNull GPXTrackAnalysis a) {
return new AGpxFileDetails(a.totalDistance, a.totalTracks, a.startTime, a.endTime,

View file

@ -43,6 +43,8 @@ import net.osmand.aidl.mapmarker.UpdateMapMarkerParams;
import net.osmand.aidl.mapwidget.AddMapWidgetParams;
import net.osmand.aidl.mapwidget.RemoveMapWidgetParams;
import net.osmand.aidl.mapwidget.UpdateMapWidgetParams;
import net.osmand.aidl.navdrawer.NavDrawerFooterParams;
import net.osmand.aidl.navdrawer.NavDrawerHeaderParams;
import net.osmand.aidl.navdrawer.SetNavDrawerItemsParams;
import net.osmand.aidl.navigation.MuteNavigationParams;
import net.osmand.aidl.navigation.NavigateGpxParams;
@ -56,6 +58,7 @@ import net.osmand.aidl.note.StartAudioRecordingParams;
import net.osmand.aidl.note.StartVideoRecordingParams;
import net.osmand.aidl.note.StopRecordingParams;
import net.osmand.aidl.note.TakePhotoNoteParams;
import net.osmand.aidl.plugins.PluginParams;
import net.osmand.aidl.search.SearchParams;
import net.osmand.aidl.search.SearchResult;
import net.osmand.aidl.tiles.ASqliteDbFile;
@ -773,15 +776,17 @@ public class OsmandAidlService extends Service {
}
@Override
public boolean setNavDrawerLogoWithParams(String imageUri, String packageName, String intent) throws RemoteException {
public boolean setNavDrawerLogoWithParams(NavDrawerHeaderParams params) throws RemoteException {
OsmandAidlApi api = getApi("setNavDrawerLogoWithParams");
return api != null && api.setNavDrawerLogoWithParams(imageUri, packageName, intent);
return api != null && api.setNavDrawerLogoWithParams(
params.getImageUri(), params.getPackageName(), params.getIntent());
}
@Override
public boolean setNavDrawerFooterParams(String packageName, String intent, String appName) throws RemoteException {
public boolean setNavDrawerFooterWithParams(NavDrawerFooterParams params) throws RemoteException {
OsmandAidlApi api = getApi ("setNavDrawerFooterParams");
return api != null && api.setNavDrawerFooterParams(packageName, intent, appName);
return api != null && api.setNavDrawerFooterWithParams(
params.getPackageName(), params.getIntent(), params.getAppName());
}
@Override
@ -790,5 +795,11 @@ public class OsmandAidlService extends Service {
return api != null && api.restoreOsmand();
}
@Override
public boolean changePluginState(PluginParams params) {
OsmandAidlApi api = getApi("changePluginState");
return api != null && api.changePluginState(params);
}
};
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.navdrawer;
parcelable NavDrawerFooterParams;

View file

@ -0,0 +1,68 @@
package net.osmand.aidl.navdrawer;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
public class NavDrawerFooterParams implements Parcelable {
@NonNull
private String packageName;
@Nullable
private String intent;
@Nullable
private String appName;
@NonNull
public String getPackageName() {
return packageName;
}
@Nullable
public String getIntent() {
return intent;
}
@Nullable
public String getAppName() {
return appName;
}
public NavDrawerFooterParams(@NonNull String packageName, @Nullable String intent,
@Nullable String appName) {
this.packageName = packageName;
this.intent = intent;
this.appName = appName;
}
protected NavDrawerFooterParams(Parcel in) {
packageName = in.readString();
intent = in.readString();
appName = in.readString();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(packageName);
dest.writeString(intent);
dest.writeString(appName);
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<NavDrawerFooterParams> CREATOR = new Creator<NavDrawerFooterParams>() {
@Override
public NavDrawerFooterParams createFromParcel(Parcel in) {
return new NavDrawerFooterParams(in);
}
@Override
public NavDrawerFooterParams[] newArray(int size) {
return new NavDrawerFooterParams[size];
}
};
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.navdrawer;
parcelable NavDrawerHeaderParams;

View file

@ -0,0 +1,68 @@
package net.osmand.aidl.navdrawer;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
public class NavDrawerHeaderParams implements Parcelable {
@NonNull
private String imageUri;
@NonNull
private String packageName;
@Nullable
private String intent;
@NonNull
public String getImageUri() {
return imageUri;
}
@NonNull
public String getPackageName() {
return packageName;
}
@Nullable
public String getIntent() {
return intent;
}
public NavDrawerHeaderParams(@NonNull String imageUri, @NonNull String packageName,
@Nullable String intent) {
this.imageUri = imageUri;
this.packageName = packageName;
this.intent = intent;
}
public NavDrawerHeaderParams(Parcel in) {
imageUri = in.readString();
packageName = in.readString();
intent = in.readString();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(imageUri);
dest.writeString(packageName);
dest.writeString(intent);
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<NavDrawerHeaderParams> CREATOR = new Creator<NavDrawerHeaderParams>() {
@Override
public NavDrawerHeaderParams createFromParcel(Parcel in) {
return new NavDrawerHeaderParams(in);
}
@Override
public NavDrawerHeaderParams[] newArray(int size) {
return new NavDrawerHeaderParams[size];
}
};
}

View file

@ -0,0 +1,5 @@
// PluginParams.aidl
package net.osmand.aidl.plugins;
parcelable PluginParams;

View file

@ -0,0 +1,51 @@
package net.osmand.aidl.plugins;
import android.os.Parcel;
import android.os.Parcelable;
public class PluginParams implements Parcelable {
private String pluginId;
private int newState; //0- off, 1 - on
public PluginParams(String pluginId, int newState) {
this.pluginId = pluginId;
this.newState = newState;
}
public String getPluginId() {
return pluginId;
}
public int getNewState() {
return newState;
}
protected PluginParams(Parcel in) {
pluginId = in.readString();
newState = in.readInt();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(pluginId);
dest.writeInt(newState);
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<PluginParams> CREATOR = new Creator<PluginParams>() {
@Override
public PluginParams createFromParcel(Parcel in) {
return new PluginParams(in);
}
@Override
public PluginParams[] newArray(int size) {
return new PluginParams[size];
}
};
}

View file

@ -159,10 +159,13 @@ public class ApplicationMode {
return this;
}
//todo need night mode icon
public ApplicationModeBuilder nauticalLocation() {
applicationMode.bearingIconDay = R.drawable.map_nautical_bearing;
applicationMode.bearingIconNight = R.drawable.map_nautical_bearing;
applicationMode.bearingIconNight = R.drawable.map_nautical_bearing_night;
applicationMode.headingIconDay = R.drawable.map_nautical_location_view_angle;
applicationMode.headingIconNight = R.drawable.map_nautical_location_view_angle_night;
applicationMode.locationIconDay = R.drawable.map_nautical_location;
applicationMode.locationIconNight = R.drawable.map_nautical_location_night;
return this;
}

View file

@ -14,6 +14,7 @@ import android.text.TextUtils;
import net.osmand.IProgress;
import net.osmand.IndexConstants;
import net.osmand.aidl.plugins.PluginParams;
import net.osmand.data.LocationPoint;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.PluginsActivity;
@ -40,341 +41,369 @@ import java.util.Set;
public class OsmAndAppCustomization {
protected OsmandApplication app;
protected OsmandSettings osmandSettings;
protected OsmandApplication app;
protected OsmandSettings osmandSettings;
private Bitmap navDrawerLogo;
private ArrayList<String> navDrawerParams;
private Bitmap navDrawerLogo;
private ArrayList<String> navDrawerParams;
private Set<String> featuresEnabledIds = new HashSet<>();
private Set<String> featuresDisabledIds = new HashSet<>();
private Set<String> featuresEnabledPatterns = new HashSet<>();
private Set<String> featuresDisabledPatterns = new HashSet<>();
private Map<String, Set<ApplicationMode>> widgetsVisibilityMap = new LinkedHashMap<>();
private Map<String, Set<ApplicationMode>> widgetsAvailabilityMap = new LinkedHashMap<>();
private CustomOsmandSettings customOsmandSettings;
private Set<String> featuresEnabledIds = new HashSet<>();
private Set<String> featuresDisabledIds = new HashSet<>();
private Set<String> featuresEnabledPatterns = new HashSet<>();
private Set<String> featuresDisabledPatterns = new HashSet<>();
private Map<String, Set<ApplicationMode>> widgetsVisibilityMap = new LinkedHashMap<>();
private Map<String, Set<ApplicationMode>> widgetsAvailabilityMap = new LinkedHashMap<>();
private CustomOsmandSettings customOsmandSettings;
private boolean featuresCustomized;
private boolean widgetsCustomized;
private boolean featuresCustomized;
private boolean widgetsCustomized;
private List<OsmAndAppCustomizationListener> listeners = new ArrayList<>();
private List<OsmAndAppCustomizationListener> listeners = new ArrayList<>();
public interface OsmAndAppCustomizationListener {
public interface OsmAndAppCustomizationListener {
void onOsmAndSettingsCustomized();
}
void onOsmAndSettingsCustomized();
}
public static class CustomOsmandSettings {
private String sharedPreferencesName;
private OsmandSettings settings;
public static class CustomOsmandSettings {
CustomOsmandSettings(OsmandApplication app, String sharedPreferencesName, Bundle bundle) {
this.sharedPreferencesName = sharedPreferencesName;
this.settings = new OsmandSettings(app, new net.osmand.plus.api.SettingsAPIImpl(app), sharedPreferencesName);
if (bundle != null) {
for (String key : bundle.keySet()) {
Object object = bundle.get(key);
this.settings.setPreference(key, object);
}
}
}
private String sharedPreferencesName;
private OsmandSettings settings;
public OsmandSettings getSettings() {
return settings;
}
}
CustomOsmandSettings(OsmandApplication app, String sharedPreferencesName, Bundle bundle) {
this.sharedPreferencesName = sharedPreferencesName;
this.settings = new OsmandSettings(app, new net.osmand.plus.api.SettingsAPIImpl(app),
sharedPreferencesName);
if (bundle != null) {
for (String key : bundle.keySet()) {
Object object = bundle.get(key);
this.settings.setPreference(key, object);
}
}
}
public void setup(OsmandApplication app) {
this.app = app;
this.osmandSettings = new OsmandSettings(app, new net.osmand.plus.api.SettingsAPIImpl(app));
}
public OsmandSettings getSettings() {
return settings;
}
}
public OsmandSettings getOsmandSettings() {
return customOsmandSettings != null ? customOsmandSettings.getSettings() : osmandSettings;
}
public void setup(OsmandApplication app) {
this.app = app;
this.osmandSettings = new OsmandSettings(app, new net.osmand.plus.api.SettingsAPIImpl(app));
}
public void customizeOsmandSettings(@NonNull String sharedPreferencesName, @Nullable Bundle bundle) {
customOsmandSettings = new CustomOsmandSettings(app, sharedPreferencesName, bundle);
OsmandSettings newSettings = customOsmandSettings.getSettings();
if (Build.VERSION.SDK_INT < 19) {
if (osmandSettings.isExternalStorageDirectorySpecifiedPre19()) {
File externalStorageDirectory = osmandSettings.getExternalStorageDirectoryPre19();
newSettings.setExternalStorageDirectoryPre19(externalStorageDirectory.getAbsolutePath());
}
} else if (osmandSettings.isExternalStorageDirectoryTypeSpecifiedV19()
&& osmandSettings.isExternalStorageDirectorySpecifiedV19()) {
int type = osmandSettings.getExternalStorageDirectoryTypeV19();
String directory = osmandSettings.getExternalStorageDirectoryV19();
newSettings.setExternalStorageDirectoryV19(type, directory);
}
app.setOsmandSettings(newSettings);
notifySettingsCustomized();
}
public OsmandSettings getOsmandSettings() {
return customOsmandSettings != null ? customOsmandSettings.getSettings() : osmandSettings;
}
public void restoreOsmandSettings() {
app.setOsmandSettings(osmandSettings);
notifySettingsCustomized();
}
public void customizeOsmandSettings(@NonNull String sharedPreferencesName,
@Nullable Bundle bundle) {
customOsmandSettings = new CustomOsmandSettings(app, sharedPreferencesName, bundle);
OsmandSettings newSettings = customOsmandSettings.getSettings();
if (Build.VERSION.SDK_INT < 19) {
if (osmandSettings.isExternalStorageDirectorySpecifiedPre19()) {
File externalStorageDirectory = osmandSettings.getExternalStorageDirectoryPre19();
newSettings.setExternalStorageDirectoryPre19(externalStorageDirectory.getAbsolutePath());
}
} else if (osmandSettings.isExternalStorageDirectoryTypeSpecifiedV19()
&& osmandSettings.isExternalStorageDirectorySpecifiedV19()) {
int type = osmandSettings.getExternalStorageDirectoryTypeV19();
String directory = osmandSettings.getExternalStorageDirectoryV19();
newSettings.setExternalStorageDirectoryV19(type, directory);
}
app.setOsmandSettings(newSettings);
notifySettingsCustomized();
}
public boolean restoreOsmand() {
navDrawerLogo = null;
featuresCustomized = false;
widgetsCustomized = false;
customOsmandSettings = null;
restoreOsmandSettings();
public void restoreOsmandSettings() {
app.setOsmandSettings(osmandSettings);
notifySettingsCustomized();
}
featuresEnabledIds.clear();
featuresDisabledIds.clear();
featuresEnabledPatterns.clear();
featuresDisabledPatterns.clear();
widgetsVisibilityMap.clear();
widgetsAvailabilityMap.clear();
public boolean restoreOsmand() {
navDrawerLogo = null;
featuresCustomized = false;
widgetsCustomized = false;
customOsmandSettings = null;
restoreOsmandSettings();
return true;
}
featuresEnabledIds.clear();
featuresDisabledIds.clear();
featuresEnabledPatterns.clear();
featuresDisabledPatterns.clear();
widgetsVisibilityMap.clear();
widgetsAvailabilityMap.clear();
// Activities
public Class<? extends Activity> getSettingsActivity() {
return SettingsActivity.class;
}
return true;
}
public Class<MapActivity> getMapActivity() {
return MapActivity.class;
}
// Activities
public Class<? extends Activity> getSettingsActivity() {
return SettingsActivity.class;
}
public Class<TrackActivity> getTrackActivity() {
return TrackActivity.class;
}
public Class<MapActivity> getMapActivity() {
return MapActivity.class;
}
public Class<FavoritesActivity> getFavoritesActivity() {
return FavoritesActivity.class;
}
public Class<TrackActivity> getTrackActivity() {
return TrackActivity.class;
}
public Class<? extends Activity> getDownloadIndexActivity() {
return DownloadActivity.class;
}
public Class<FavoritesActivity> getFavoritesActivity() {
return FavoritesActivity.class;
}
public Class<? extends Activity> getPluginsActivity() {
return PluginsActivity.class;
}
public Class<? extends Activity> getDownloadIndexActivity() {
return DownloadActivity.class;
}
public Class<? extends Activity> getDownloadActivity() {
return DownloadActivity.class;
}
public Class<? extends Activity> getPluginsActivity() {
return PluginsActivity.class;
}
public List<String> onIndexingFiles(IProgress progress, Map<String, String> indexFileNames) {
return Collections.emptyList();
}
public Class<? extends Activity> getDownloadActivity() {
return DownloadActivity.class;
}
public String getIndexesUrl() {
return "http://" + IndexConstants.INDEX_DOWNLOAD_DOMAIN + "/get_indexes?gzip&" + Version.getVersionAsURLParam(app);
}
public List<String> onIndexingFiles(IProgress progress, Map<String, String> indexFileNames) {
return Collections.emptyList();
}
public boolean showDownloadExtraActions() {
return true;
}
public String getIndexesUrl() {
return "http://" + IndexConstants.INDEX_DOWNLOAD_DOMAIN + "/get_indexes?gzip&" + Version
.getVersionAsURLParam(app);
}
public File getTracksDir() {
return app.getAppPath(IndexConstants.GPX_RECORDED_INDEX_DIR);
}
public boolean showDownloadExtraActions() {
return true;
}
public void createLayers(OsmandMapTileView mapView, MapActivity activity) {
public File getTracksDir() {
return app.getAppPath(IndexConstants.GPX_RECORDED_INDEX_DIR);
}
}
public void createLayers(OsmandMapTileView mapView, MapActivity activity) {
public List<? extends LocationPoint> getWaypoints() {
return Collections.emptyList();
}
}
public boolean isWaypointGroupVisible(int waypointType, RouteCalculationResult route) {
if (waypointType == WaypointHelper.ALARMS) {
return route != null && !route.getAlarmInfo().isEmpty();
} else if (waypointType == WaypointHelper.WAYPOINTS) {
return route != null && !route.getLocationPoints().isEmpty();
}
return true;
}
public List<? extends LocationPoint> getWaypoints() {
return Collections.emptyList();
}
public boolean onDestinationReached() {
return true;
}
public boolean isWaypointGroupVisible(int waypointType, RouteCalculationResult route) {
if (waypointType == WaypointHelper.ALARMS) {
return route != null && !route.getAlarmInfo().isEmpty();
} else if (waypointType == WaypointHelper.WAYPOINTS) {
return route != null && !route.getLocationPoints().isEmpty();
}
return true;
}
@Nullable
public Bitmap getNavDrawerLogo() {
return navDrawerLogo;
}
public boolean onDestinationReached() {
return true;
}
@Nullable
public ArrayList<String> getNavDrawerLogoParams() {return navDrawerParams; }
@Nullable
public Bitmap getNavDrawerLogo() {
return navDrawerLogo;
}
public boolean setNavDrawerLogo(@Nullable String uri, @Nullable String packageName, @Nullable String intent) {
if (TextUtils.isEmpty(uri)) {
navDrawerLogo = null;
} else {
try {
InputStream is = app.getContentResolver().openInputStream(Uri.parse(uri));
if (is != null) {
navDrawerLogo = BitmapFactory.decodeStream(is);
is.close();
@Nullable
public ArrayList<String> getNavDrawerLogoParams() {
return navDrawerParams;
}
}
} catch (FileNotFoundException e) {
return false;
} catch (IOException e) {
// ignore
}
if(packageName!=null && intent!=null) {
navDrawerParams = new ArrayList<>();
navDrawerParams.add(packageName);
navDrawerParams.add(intent);
}
}
return true;
}
public boolean setNavDrawerLogo(@Nullable String uri, @Nullable String packageName,
@Nullable String intent) {
if (TextUtils.isEmpty(uri)) {
navDrawerLogo = null;
} else {
try {
InputStream is = app.getContentResolver().openInputStream(Uri.parse(uri));
if (is != null) {
navDrawerLogo = BitmapFactory.decodeStream(is);
is.close();
}
} catch (FileNotFoundException e) {
return false;
} catch (IOException e) {
// ignore
}
if (packageName != null && intent != null) {
navDrawerParams = new ArrayList<>();
navDrawerParams.add(packageName);
navDrawerParams.add(intent);
}
}
return true;
}
public void setFeaturesEnabledIds(@NonNull Collection<String> ids) {
featuresEnabledIds.clear();
featuresEnabledIds.addAll(ids);
setFeaturesCustomized();
}
public void setFeaturesEnabledIds(@NonNull Collection<String> ids) {
featuresEnabledIds.clear();
featuresEnabledIds.addAll(ids);
setFeaturesCustomized();
}
public void setFeaturesDisabledIds(@NonNull Collection<String> ids) {
featuresDisabledIds.clear();
featuresDisabledIds.addAll(ids);
setFeaturesCustomized();
}
public void setFeaturesDisabledIds(@NonNull Collection<String> ids) {
featuresDisabledIds.clear();
featuresDisabledIds.addAll(ids);
setFeaturesCustomized();
}
public void setFeaturesEnabledPatterns(@NonNull Collection<String> patterns) {
featuresEnabledPatterns.clear();
featuresEnabledPatterns.addAll(patterns);
setFeaturesCustomized();
}
public void setFeaturesEnabledPatterns(@NonNull Collection<String> patterns) {
featuresEnabledPatterns.clear();
featuresEnabledPatterns.addAll(patterns);
setFeaturesCustomized();
}
public void setFeaturesDisabledPatterns(@NonNull Collection<String> patterns) {
featuresDisabledPatterns.clear();
featuresDisabledPatterns.addAll(patterns);
setFeaturesCustomized();
}
public void setFeaturesDisabledPatterns(@NonNull Collection<String> patterns) {
featuresDisabledPatterns.clear();
featuresDisabledPatterns.addAll(patterns);
setFeaturesCustomized();
}
public Set<ApplicationMode> regWidgetVisibility(@NonNull String widgetId,
@Nullable List<String> appModeKeys) {
HashSet<ApplicationMode> set = getAppModesSet(appModeKeys);
widgetsVisibilityMap.put(widgetId, set);
setWidgetsCustomized();
return set;
}
public Set<ApplicationMode> regWidgetVisibility(@NonNull String widgetId, @Nullable List<String> appModeKeys) {
HashSet<ApplicationMode> set = getAppModesSet(appModeKeys);
widgetsVisibilityMap.put(widgetId, set);
setWidgetsCustomized();
return set;
}
public Set<ApplicationMode> regWidgetAvailability(@NonNull String widgetId,
@Nullable List<String> appModeKeys) {
HashSet<ApplicationMode> set = getAppModesSet(appModeKeys);
widgetsAvailabilityMap.put(widgetId, set);
setWidgetsCustomized();
return set;
}
public Set<ApplicationMode> regWidgetAvailability(@NonNull String widgetId, @Nullable List<String> appModeKeys) {
HashSet<ApplicationMode> set = getAppModesSet(appModeKeys);
widgetsAvailabilityMap.put(widgetId, set);
setWidgetsCustomized();
return set;
}
public boolean isWidgetVisible(@NonNull String key, ApplicationMode appMode) {
Set<ApplicationMode> set = widgetsVisibilityMap.get(key);
if (set == null) {
return false;
}
return set.contains(appMode);
}
public boolean isWidgetVisible(@NonNull String key, ApplicationMode appMode) {
Set<ApplicationMode> set = widgetsVisibilityMap.get(key);
if (set == null) {
return false;
}
return set.contains(appMode);
}
public boolean isWidgetAvailable(@NonNull String key, ApplicationMode appMode) {
Set<ApplicationMode> set = widgetsAvailabilityMap.get(key);
if (set == null) {
return true;
}
return set.contains(appMode);
}
public boolean isWidgetAvailable(@NonNull String key, ApplicationMode appMode) {
Set<ApplicationMode> set = widgetsAvailabilityMap.get(key);
if (set == null) {
return true;
}
return set.contains(appMode);
}
public boolean setNavDrawerLogoWithParams(String uri, @Nullable String packageName,
@Nullable String intent) {
return setNavDrawerLogo(uri, packageName, intent);
}
public boolean setNavDrawerLogoWithParams(String uri, @Nullable String packageName, @Nullable String intent) {
LOG.info("setNavDrawerLogoWithParams called");
return setNavDrawerLogo(uri, packageName, intent);
}
public boolean setNavDrawerFooterAction(String packageName, String intent, String appName) {
//todo implement custom action to "Powered by Osmand" action in NavDrawer
return true;
}
public boolean setNavDrawerFooterAction(String packageName, String intent, String appName) {
//todo implement custom action to "Powered by Osmand" action in NavDrawer
return true;
}
public boolean changePluginStatus(PluginParams params) {
if (params.getNewState() == 0) {
for (OsmandPlugin plugin : OsmandPlugin.getEnabledPlugins()) {
if(plugin.getId().equals(params.getPluginId())) plugin.setActive(false);
}
return true;
}
@NonNull
private HashSet<ApplicationMode> getAppModesSet(@Nullable List<String> appModeKeys) {
HashSet<ApplicationMode> set = new HashSet<>();
List<ApplicationMode> values = ApplicationMode.allPossibleValues();
if (appModeKeys == null) {
set.addAll(values);
} else {
for (String key : appModeKeys) {
ApplicationMode am = ApplicationMode.valueOfStringKey(key, null);
if (am != null) {
set.add(am);
}
}
}
for (ApplicationMode m : values) {
// add derived modes
if (set.contains(m.getParent())) {
set.add(m);
}
}
return set;
}
if (params.getNewState() == 1) {
for (OsmandPlugin plugin : OsmandPlugin.getAvailablePlugins()) {
if (plugin.getId().equals(params.getPluginId())) {
plugin.setActive(true);
}
}
return true;
}
public boolean isFeatureEnabled(@NonNull String id) {
if (!featuresCustomized) {
return true;
}
if (featuresEnabledIds.contains(id)) {
return true;
}
if (featuresDisabledIds.contains(id)) {
return false;
}
if (isMatchesPattern(id, featuresEnabledPatterns)) {
return true;
}
return !isMatchesPattern(id, featuresDisabledPatterns);
}
return false;
}
public boolean areWidgetsCustomized() {
return widgetsCustomized;
}
@NonNull
private HashSet<ApplicationMode> getAppModesSet(@Nullable List<String> appModeKeys) {
HashSet<ApplicationMode> set = new HashSet<>();
List<ApplicationMode> values = ApplicationMode.allPossibleValues();
if (appModeKeys == null) {
set.addAll(values);
} else {
for (String key : appModeKeys) {
ApplicationMode am = ApplicationMode.valueOfStringKey(key, null);
if (am != null) {
set.add(am);
}
}
}
for (ApplicationMode m : values) {
// add derived modes
if (set.contains(m.getParent())) {
set.add(m);
}
}
return set;
}
private void setFeaturesCustomized() {
featuresCustomized = true;
}
public boolean isFeatureEnabled(@NonNull String id) {
if (!featuresCustomized) {
return true;
}
if (featuresEnabledIds.contains(id)) {
return true;
}
if (featuresDisabledIds.contains(id)) {
return false;
}
if (isMatchesPattern(id, featuresEnabledPatterns)) {
return true;
}
return !isMatchesPattern(id, featuresDisabledPatterns);
}
private void setWidgetsCustomized() {
widgetsCustomized = true;
}
public boolean areWidgetsCustomized() {
return widgetsCustomized;
}
private boolean isMatchesPattern(@NonNull String id, @NonNull Set<String> patterns) {
for (String pattern : patterns) {
if (id.startsWith(pattern)) {
return true;
}
}
return false;
}
private void setFeaturesCustomized() {
featuresCustomized = true;
}
private void notifySettingsCustomized() {
app.uiHandler.post(new Runnable() {
private void setWidgetsCustomized() {
widgetsCustomized = true;
}
@Override
public void run() {
for (OsmAndAppCustomizationListener l : listeners) {
l.onOsmAndSettingsCustomized();
}
}
});
}
private boolean isMatchesPattern(@NonNull String id, @NonNull Set<String> patterns) {
for (String pattern : patterns) {
if (id.startsWith(pattern)) {
return true;
}
}
return false;
}
public void addListener(OsmAndAppCustomizationListener listener) {
this.listeners.add(listener);
}
private void notifySettingsCustomized() {
app.uiHandler.post(new Runnable() {
public void removeListener(OsmAndAppCustomizationListener listener) {
this.listeners.remove(listener);
}
@Override
public void run() {
for (OsmAndAppCustomizationListener l : listeners) {
l.onOsmAndSettingsCustomized();
}
}
});
}
public void addListener(OsmAndAppCustomizationListener listener) {
this.listeners.add(listener);
}
public void removeListener(OsmAndAppCustomizationListener listener) {
this.listeners.remove(listener);
}
}

View file

@ -71,22 +71,33 @@ public interface OsmAndCustomizationConstants {
String ZOOM_IN_HUD_ID = HUD_BTN_ID_SCHEME + "zoom_id";
String ZOOM_OUT_HUD_ID = HUD_BTN_ID_SCHEME + "zoom_out";
//Point's Context Action Menu:
String POINTS_ACTION_MENU = "point.actions.";
String POINT_DIRECTIONS_FROM_ID = POINTS_ACTION_MENU + "directions_from";
String POINT_SEARCH_NEARBY = POINTS_ACTION_MENU + "search_nearby";
String POINT_CHANGE_MARKER_POSITION = POINTS_ACTION_MENU + "change_m_position";
String POINT_MARK_AS_PARKING_LOC = POINTS_ACTION_MENU + "mark_as_parking";
String POINT_MEASURE_DISTANCE = POINTS_ACTION_MENU + "measure_distance";
String POINT_EDIT_GPX_WP = POINTS_ACTION_MENU + "edit_gpx_waypoint";
String POINT_ADD_GPX_WAYPOINT = POINTS_ACTION_MENU + "add_gpx_waypoint";
String POINT_UPDATE_MAP = POINTS_ACTION_MENU + "update_map";
String POINT_DOWNLOAD_MAP = POINTS_ACTION_MENU + "download_map";
String POINT_MODIFY_POI = POINTS_ACTION_MENU + "modify_poi";
String POINT_MODIFY_OSM_CHANGE = POINTS_ACTION_MENU + "modify_osm_change";
String POINT_CREATE_POI = POINTS_ACTION_MENU + "create_poi";
String POINT_MODIFY_OSM_NOTE = POINTS_ACTION_MENU + "modify_osm_note";
String POINT_OPEN_OSM_NOTE = POINTS_ACTION_MENU + "open_osm_note";
//Map Context Menu Actions:
String MAP_CONTEXT_MENU_ACTIONS = "point.actions.";
String MAP_CONTEXT_MENU_DIRECTIONS_FROM_ID = MAP_CONTEXT_MENU_ACTIONS + "directions_from";
String MAP_CONTEXT_MENU_SEARCH_NEARBY = MAP_CONTEXT_MENU_ACTIONS + "search_nearby";
String MAP_CONTEXT_MENU_CHANGE_MARKER_POSITION = MAP_CONTEXT_MENU_ACTIONS + "change_m_position";
String MAP_CONTEXT_MENU_MARK_AS_PARKING_LOC = MAP_CONTEXT_MENU_ACTIONS + "mark_as_parking";
String MAP_CONTEXT_MENU_MEASURE_DISTANCE = MAP_CONTEXT_MENU_ACTIONS + "measure_distance";
String MAP_CONTEXT_MENU_EDIT_GPX_WP = MAP_CONTEXT_MENU_ACTIONS + "edit_gpx_waypoint";
String MAP_CONTEXT_MENU_ADD_GPX_WAYPOINT = MAP_CONTEXT_MENU_ACTIONS + "add_gpx_waypoint";
String MAP_CONTEXT_MENU_UPDATE_MAP = MAP_CONTEXT_MENU_ACTIONS + "update_map";
String MAP_CONTEXT_MENU_DOWNLOAD_MAP = MAP_CONTEXT_MENU_ACTIONS + "download_map";
String MAP_CONTEXT_MENU_MODIFY_POI = MAP_CONTEXT_MENU_ACTIONS + "modify_poi";
String MAP_CONTEXT_MENU_MODIFY_OSM_CHANGE = MAP_CONTEXT_MENU_ACTIONS + "modify_osm_change";
String MAP_CONTEXT_MENU_CREATE_POI = MAP_CONTEXT_MENU_ACTIONS + "create_poi";
String MAP_CONTEXT_MENU_MODIFY_OSM_NOTE = MAP_CONTEXT_MENU_ACTIONS + "modify_osm_note";
String MAP_CONTEXT_MENU_OPEN_OSM_NOTE = MAP_CONTEXT_MENU_ACTIONS + "open_osm_note";
//Plug-in's IDs:
String PLUGIN_OSMAND_MONITOR = "osmand.monitoring";
String PLUGIN_MAPILLARY = "osmand.mapillary";
String PLUGIN_OSMAND_DEV = "osmand.development";
String PLUGIN_AUDIO_VIDEO_NOTES = "osmand.audionotes";
String PLUGIN_NAUTICAL = "nauticalPlugin.plugin";
String PLUGIN_OSMAND_EDITING = "osm.editing";
String PLUGIN_PARKING_POSITION = "osmand.parking.position";
String PLUGIN_RASTER_MAPS = "osmand.rastermaps";
String PLUGIN_SKI_MAPS = "skimaps.plugin";
String PLUGIN_SRTM = "osmand.srtm";
}

View file

@ -79,8 +79,8 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_ADD_GPX_WAYPOINT;
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_DIRECTIONS_FROM_ID;
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_ADD_GPX_WAYPOINT;
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_DIRECTIONS_FROM_ID;
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_CONFIGURE_MAP_ID;
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_CONFIGURE_SCREEN_ID;
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_DASHBOARD_ID;
@ -96,9 +96,9 @@ import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_PLUGINS_ID;
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_SEARCH_ID;
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_SETTINGS_ID;
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_TRAVEL_GUIDES_ID;
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_EDIT_GPX_WP;
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_MEASURE_DISTANCE;
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_SEARCH_NEARBY;
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_EDIT_GPX_WP;
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MEASURE_DISTANCE;
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_SEARCH_NEARBY;
import static net.osmand.plus.helpers.ImportHelper.GPX_SUFFIX;
public class MapActivityActions implements DialogProvider {
@ -324,13 +324,13 @@ public class MapActivityActions implements DialogProvider {
adapter.addItem(itemBuilder
.setTitleId(R.string.context_menu_item_directions_from, mapActivity)
.setId(POINT_DIRECTIONS_FROM_ID)
.setId(MAP_CONTEXT_MENU_DIRECTIONS_FROM_ID)
.setIcon(R.drawable.ic_action_route_direction_from_here)
.setOrder(DIRECTIONS_FROM_ITEM_ORDER)
.createItem());
adapter.addItem(itemBuilder
.setTitleId(R.string.context_menu_item_search, mapActivity)
.setId(POINT_SEARCH_NEARBY)
.setId(MAP_CONTEXT_MENU_SEARCH_NEARBY)
.setIcon(R.drawable.ic_action_search_dark)
.setOrder(SEARCH_NEAR_ITEM_ORDER)
.createItem());
@ -353,7 +353,7 @@ public class MapActivityActions implements DialogProvider {
&& getMyApplication().getSelectedGpxHelper().getSelectedGPXFile((WptPt) selectedObj) != null) {
adapter.addItem(new ContextMenuItem.ItemBuilder()
.setTitleId(R.string.context_menu_item_edit_waypoint, mapActivity)
.setId(POINT_EDIT_GPX_WP)
.setId(MAP_CONTEXT_MENU_EDIT_GPX_WP)
.setIcon(R.drawable.ic_action_edit_dark)
.setOrder(EDIT_GPX_WAYPOINT_ITEM_ORDER)
.setListener(listener).createItem());
@ -361,7 +361,7 @@ public class MapActivityActions implements DialogProvider {
|| (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null)) {
adapter.addItem(new ContextMenuItem.ItemBuilder()
.setTitleId(R.string.context_menu_item_add_waypoint, mapActivity)
.setTitle(POINT_ADD_GPX_WAYPOINT)
.setTitle(MAP_CONTEXT_MENU_ADD_GPX_WAYPOINT)
.setIcon(R.drawable.ic_action_gnew_label_dark)
.setOrder(ADD_GPX_WAYPOINT_ITEM_ORDER)
.setListener(listener).createItem());
@ -369,7 +369,7 @@ public class MapActivityActions implements DialogProvider {
adapter.addItem(itemBuilder
.setTitleId(R.string.measurement_tool, mapActivity)
.setId(POINT_MEASURE_DISTANCE)
.setId(MAP_CONTEXT_MENU_MEASURE_DISTANCE)
.setIcon(R.drawable.ic_action_ruler)
.setOrder(MEASURE_DISTANCE_ITEM_ORDER)
.createItem());

View file

@ -47,11 +47,11 @@ import org.apache.commons.logging.Log;
import java.util.List;
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_CREATE_POI;
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_MODIFY_OSM_CHANGE;
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_MODIFY_OSM_NOTE;
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_MODIFY_POI;
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_OPEN_OSM_NOTE;
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_CREATE_POI;
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MODIFY_OSM_CHANGE;
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MODIFY_OSM_NOTE;
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MODIFY_POI;
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_OPEN_OSM_NOTE;
import static net.osmand.plus.OsmAndCustomizationConstants.OSM_NOTES;
@ -235,21 +235,21 @@ public class OsmEditingPlugin extends OsmandPlugin {
}
if (isEditable) {
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.poi_context_menu_modify, mapActivity)
.setId(POINT_MODIFY_POI)
.setId(MAP_CONTEXT_MENU_MODIFY_POI)
.setIcon(R.drawable.ic_action_edit_dark)
.setOrder(MODIFY_POI_ITEM_ORDER)
.setListener(listener)
.createItem());
} else if (selectedObj instanceof OpenstreetmapPoint && ((OpenstreetmapPoint) selectedObj).getAction() != Action.DELETE) {
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.poi_context_menu_modify_osm_change, mapActivity)
.setId(POINT_MODIFY_OSM_CHANGE)
.setId(MAP_CONTEXT_MENU_MODIFY_OSM_CHANGE)
.setIcon(R.drawable.ic_action_edit_dark)
.setOrder(MODIFY_OSM_CHANGE_ITEM_ORDER)
.setListener(listener)
.createItem());
} else {
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.context_menu_item_create_poi, mapActivity)
.setId(POINT_CREATE_POI)
.setId(MAP_CONTEXT_MENU_CREATE_POI)
.setIcon(R.drawable.ic_action_plus_dark)
.setOrder(CREATE_POI_ITEM_ORDER)
.setListener(listener)
@ -257,14 +257,14 @@ public class OsmEditingPlugin extends OsmandPlugin {
}
if (selectedObj instanceof OsmNotesPoint) {
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.context_menu_item_modify_note, mapActivity)
.setId(POINT_MODIFY_OSM_NOTE)
.setId(MAP_CONTEXT_MENU_MODIFY_OSM_NOTE)
.setIcon(R.drawable.ic_action_edit_dark)
.setOrder(MODIFY_OSM_NOTE_ITEM_ORDER)
.setListener(listener)
.createItem());
} else {
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.context_menu_item_open_note, mapActivity)
.setId(POINT_OPEN_OSM_NOTE)
.setId(MAP_CONTEXT_MENU_OPEN_OSM_NOTE)
.setIcon(R.drawable.ic_action_bug_dark)
.setOrder(OPEN_OSM_NOTE_ITEM_ORDER)
.setListener(listener)

View file

@ -1,7 +1,7 @@
package net.osmand.plus.parkingpoint;
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_MARK_AS_PARKING_LOC;
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MARK_AS_PARKING_LOC;
import android.app.Activity;
import android.content.DialogInterface;
@ -235,7 +235,7 @@ public class ParkingPositionPlugin extends OsmandPlugin {
};
adapter.addItem(new ContextMenuItem.ItemBuilder()
.setTitleId(R.string.context_menu_item_add_parking_point, mapActivity)
.setId(POINT_MARK_AS_PARKING_LOC)
.setId(MAP_CONTEXT_MENU_MARK_AS_PARKING_LOC)
.setIcon(R.drawable.ic_action_parking_dark)
.setOrder(MARK_AS_PARKING_POS_ITEM_ORDER)
.setListener(addListener)

View file

@ -46,10 +46,10 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_DOWNLOAD_MAP;
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_DOWNLOAD_MAP;
import static net.osmand.plus.OsmAndCustomizationConstants.OVERLAY_MAP;
import static net.osmand.plus.OsmAndCustomizationConstants.UNDERLAY_MAP;
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_UPDATE_MAP;
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_UPDATE_MAP;
public class OsmandRasterMapsPlugin extends OsmandPlugin {
public static final String ID = "osmand.rastermaps";
@ -380,13 +380,13 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
};
adapter.addItem(new ContextMenuItem.ItemBuilder()
.setTitleId(R.string.context_menu_item_update_map, mapActivity)
.setId(POINT_UPDATE_MAP)
.setId(MAP_CONTEXT_MENU_UPDATE_MAP)
.setIcon(R.drawable.ic_action_refresh_dark)
.setOrder(UPDATE_MAP_ITEM_ORDER)
.setListener(listener).createItem());
adapter.addItem(new ContextMenuItem.ItemBuilder()
.setTitleId(R.string.shared_string_download_map, mapActivity)
.setId(POINT_DOWNLOAD_MAP)
.setId(MAP_CONTEXT_MENU_DOWNLOAD_MAP)
.setIcon(R.drawable.ic_action_import)
.setOrder(DOWNLOAD_MAP_ITEM_ORDER)
.setListener(listener).createItem());

View file

@ -75,7 +75,7 @@ import java.util.Set;
import gnu.trove.list.array.TIntArrayList;
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_CHANGE_MARKER_POSITION;
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_CHANGE_MARKER_POSITION;
import static net.osmand.plus.mapcontextmenu.controllers.TransportStopController.SHOW_STOPS_RADIUS_METERS;
public class ContextMenuLayer extends OsmandMapLayer {
@ -280,7 +280,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
};
adapter.addItem(new ContextMenuItem.ItemBuilder()
.setTitleId(R.string.change_markers_position, activity)
.setId(POINT_CHANGE_MARKER_POSITION)
.setId(MAP_CONTEXT_MENU_CHANGE_MARKER_POSITION)
.setIcon(R.drawable.ic_show_on_map)
.setOrder(MapActivityActions.CHANGE_POSITION_ITEM_ORDER)
.setClickable(isObjectMoveable(o))