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.maplayer.point.ShowMapPointParams;
import net.osmand.aidl.navdrawer.SetNavDrawerItemsParams; 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.PauseNavigationParams;
import net.osmand.aidl.navigation.ResumeNavigationParams; 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.gpx.AGpxFileDetails;
import net.osmand.aidl.tiles.ASqliteDbFile; import net.osmand.aidl.tiles.ASqliteDbFile;
import net.osmand.aidl.plugins.PluginParams;
// NOTE: Add new methods at the end of file!!! // NOTE: Add new methods at the end of file!!!
@ -161,9 +167,10 @@ interface IOsmAndAidlInterface {
boolean showSqliteDbFile(String fileName); boolean showSqliteDbFile(String fileName);
boolean hideSqliteDbFile(String fileName); boolean hideSqliteDbFile(String fileName);
boolean setNavDrawerLogoWithParams(in String imageUri, String packageName, String intent); boolean setNavDrawerLogoWithParams(in NavDrawerHeaderParams params);
boolean setNavDrawerFooterParams(in String packageName, String intent, String appName); boolean setNavDrawerFooterWithParams(in NavDrawerFooterParams params);
boolean restoreOsmand(); 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.maplayer.point.AMapPoint;
import net.osmand.aidl.mapmarker.AMapMarker; import net.osmand.aidl.mapmarker.AMapMarker;
import net.osmand.aidl.mapwidget.AMapWidget; import net.osmand.aidl.mapwidget.AMapWidget;
import net.osmand.aidl.plugins.PluginParams;
import net.osmand.aidl.search.SearchResult; import net.osmand.aidl.search.SearchResult;
import net.osmand.aidl.tiles.ASqliteDbFile; import net.osmand.aidl.tiles.ASqliteDbFile;
import net.osmand.data.FavouritePoint; import net.osmand.data.FavouritePoint;
@ -1866,7 +1867,7 @@ public class OsmandAidlApi {
return app.getAppCustomization().setNavDrawerLogoWithParams(uri, packageName, intent); 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); return app.getAppCustomization().setNavDrawerFooterAction(packageName, intent, appName);
} }
@ -1874,6 +1875,10 @@ public class OsmandAidlApi {
return app.getAppCustomization().restoreOsmand(); return app.getAppCustomization().restoreOsmand();
} }
boolean changePluginState(PluginParams params) {
return app.getAppCustomization().changePluginStatus(params);
}
private static AGpxFileDetails createGpxFileDetails(@NonNull GPXTrackAnalysis a) { private static AGpxFileDetails createGpxFileDetails(@NonNull GPXTrackAnalysis a) {
return new AGpxFileDetails(a.totalDistance, a.totalTracks, a.startTime, a.endTime, 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.AddMapWidgetParams;
import net.osmand.aidl.mapwidget.RemoveMapWidgetParams; import net.osmand.aidl.mapwidget.RemoveMapWidgetParams;
import net.osmand.aidl.mapwidget.UpdateMapWidgetParams; 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.navdrawer.SetNavDrawerItemsParams;
import net.osmand.aidl.navigation.MuteNavigationParams; import net.osmand.aidl.navigation.MuteNavigationParams;
import net.osmand.aidl.navigation.NavigateGpxParams; 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.StartVideoRecordingParams;
import net.osmand.aidl.note.StopRecordingParams; import net.osmand.aidl.note.StopRecordingParams;
import net.osmand.aidl.note.TakePhotoNoteParams; import net.osmand.aidl.note.TakePhotoNoteParams;
import net.osmand.aidl.plugins.PluginParams;
import net.osmand.aidl.search.SearchParams; import net.osmand.aidl.search.SearchParams;
import net.osmand.aidl.search.SearchResult; import net.osmand.aidl.search.SearchResult;
import net.osmand.aidl.tiles.ASqliteDbFile; import net.osmand.aidl.tiles.ASqliteDbFile;
@ -773,15 +776,17 @@ public class OsmandAidlService extends Service {
} }
@Override @Override
public boolean setNavDrawerLogoWithParams(String imageUri, String packageName, String intent) throws RemoteException { public boolean setNavDrawerLogoWithParams(NavDrawerHeaderParams params) throws RemoteException {
OsmandAidlApi api = getApi("setNavDrawerLogoWithParams"); OsmandAidlApi api = getApi("setNavDrawerLogoWithParams");
return api != null && api.setNavDrawerLogoWithParams(imageUri, packageName, intent); return api != null && api.setNavDrawerLogoWithParams(
params.getImageUri(), params.getPackageName(), params.getIntent());
} }
@Override @Override
public boolean setNavDrawerFooterParams(String packageName, String intent, String appName) throws RemoteException { public boolean setNavDrawerFooterWithParams(NavDrawerFooterParams params) throws RemoteException {
OsmandAidlApi api = getApi ("setNavDrawerFooterParams"); OsmandAidlApi api = getApi ("setNavDrawerFooterParams");
return api != null && api.setNavDrawerFooterParams(packageName, intent, appName); return api != null && api.setNavDrawerFooterWithParams(
params.getPackageName(), params.getIntent(), params.getAppName());
} }
@Override @Override
@ -790,5 +795,11 @@ public class OsmandAidlService extends Service {
return api != null && api.restoreOsmand(); 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; return this;
} }
//todo need night mode icon
public ApplicationModeBuilder nauticalLocation() { public ApplicationModeBuilder nauticalLocation() {
applicationMode.bearingIconDay = R.drawable.map_nautical_bearing; 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; return this;
} }

View file

@ -14,6 +14,7 @@ import android.text.TextUtils;
import net.osmand.IProgress; import net.osmand.IProgress;
import net.osmand.IndexConstants; import net.osmand.IndexConstants;
import net.osmand.aidl.plugins.PluginParams;
import net.osmand.data.LocationPoint; import net.osmand.data.LocationPoint;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.PluginsActivity; import net.osmand.plus.activities.PluginsActivity;
@ -40,341 +41,369 @@ import java.util.Set;
public class OsmAndAppCustomization { public class OsmAndAppCustomization {
protected OsmandApplication app; protected OsmandApplication app;
protected OsmandSettings osmandSettings; protected OsmandSettings osmandSettings;
private Bitmap navDrawerLogo; private Bitmap navDrawerLogo;
private ArrayList<String> navDrawerParams; private ArrayList<String> navDrawerParams;
private Set<String> featuresEnabledIds = new HashSet<>(); private Set<String> featuresEnabledIds = new HashSet<>();
private Set<String> featuresDisabledIds = new HashSet<>(); private Set<String> featuresDisabledIds = new HashSet<>();
private Set<String> featuresEnabledPatterns = new HashSet<>(); private Set<String> featuresEnabledPatterns = new HashSet<>();
private Set<String> featuresDisabledPatterns = new HashSet<>(); private Set<String> featuresDisabledPatterns = new HashSet<>();
private Map<String, Set<ApplicationMode>> widgetsVisibilityMap = new LinkedHashMap<>(); private Map<String, Set<ApplicationMode>> widgetsVisibilityMap = new LinkedHashMap<>();
private Map<String, Set<ApplicationMode>> widgetsAvailabilityMap = new LinkedHashMap<>(); private Map<String, Set<ApplicationMode>> widgetsAvailabilityMap = new LinkedHashMap<>();
private CustomOsmandSettings customOsmandSettings; private CustomOsmandSettings customOsmandSettings;
private boolean featuresCustomized; private boolean featuresCustomized;
private boolean widgetsCustomized; 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 { public static class CustomOsmandSettings {
private String sharedPreferencesName;
private OsmandSettings settings;
CustomOsmandSettings(OsmandApplication app, String sharedPreferencesName, Bundle bundle) { private String sharedPreferencesName;
this.sharedPreferencesName = sharedPreferencesName; private OsmandSettings settings;
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 OsmandSettings getSettings() { CustomOsmandSettings(OsmandApplication app, String sharedPreferencesName, Bundle bundle) {
return settings; 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) { public OsmandSettings getSettings() {
this.app = app; return settings;
this.osmandSettings = new OsmandSettings(app, new net.osmand.plus.api.SettingsAPIImpl(app)); }
} }
public OsmandSettings getOsmandSettings() { public void setup(OsmandApplication app) {
return customOsmandSettings != null ? customOsmandSettings.getSettings() : osmandSettings; this.app = app;
} this.osmandSettings = new OsmandSettings(app, new net.osmand.plus.api.SettingsAPIImpl(app));
}
public void customizeOsmandSettings(@NonNull String sharedPreferencesName, @Nullable Bundle bundle) { public OsmandSettings getOsmandSettings() {
customOsmandSettings = new CustomOsmandSettings(app, sharedPreferencesName, bundle); return customOsmandSettings != null ? customOsmandSettings.getSettings() : osmandSettings;
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 void restoreOsmandSettings() { public void customizeOsmandSettings(@NonNull String sharedPreferencesName,
app.setOsmandSettings(osmandSettings); @Nullable Bundle bundle) {
notifySettingsCustomized(); 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() { public void restoreOsmandSettings() {
navDrawerLogo = null; app.setOsmandSettings(osmandSettings);
featuresCustomized = false; notifySettingsCustomized();
widgetsCustomized = false; }
customOsmandSettings = null;
restoreOsmandSettings();
featuresEnabledIds.clear(); public boolean restoreOsmand() {
featuresDisabledIds.clear(); navDrawerLogo = null;
featuresEnabledPatterns.clear(); featuresCustomized = false;
featuresDisabledPatterns.clear(); widgetsCustomized = false;
widgetsVisibilityMap.clear(); customOsmandSettings = null;
widgetsAvailabilityMap.clear(); restoreOsmandSettings();
return true; featuresEnabledIds.clear();
} featuresDisabledIds.clear();
featuresEnabledPatterns.clear();
featuresDisabledPatterns.clear();
widgetsVisibilityMap.clear();
widgetsAvailabilityMap.clear();
// Activities return true;
public Class<? extends Activity> getSettingsActivity() { }
return SettingsActivity.class;
}
public Class<MapActivity> getMapActivity() { // Activities
return MapActivity.class; public Class<? extends Activity> getSettingsActivity() {
} return SettingsActivity.class;
}
public Class<TrackActivity> getTrackActivity() { public Class<MapActivity> getMapActivity() {
return TrackActivity.class; return MapActivity.class;
} }
public Class<FavoritesActivity> getFavoritesActivity() { public Class<TrackActivity> getTrackActivity() {
return FavoritesActivity.class; return TrackActivity.class;
} }
public Class<? extends Activity> getDownloadIndexActivity() { public Class<FavoritesActivity> getFavoritesActivity() {
return DownloadActivity.class; return FavoritesActivity.class;
} }
public Class<? extends Activity> getPluginsActivity() { public Class<? extends Activity> getDownloadIndexActivity() {
return PluginsActivity.class; return DownloadActivity.class;
} }
public Class<? extends Activity> getDownloadActivity() { public Class<? extends Activity> getPluginsActivity() {
return DownloadActivity.class; return PluginsActivity.class;
} }
public List<String> onIndexingFiles(IProgress progress, Map<String, String> indexFileNames) { public Class<? extends Activity> getDownloadActivity() {
return Collections.emptyList(); return DownloadActivity.class;
} }
public String getIndexesUrl() { public List<String> onIndexingFiles(IProgress progress, Map<String, String> indexFileNames) {
return "http://" + IndexConstants.INDEX_DOWNLOAD_DOMAIN + "/get_indexes?gzip&" + Version.getVersionAsURLParam(app); return Collections.emptyList();
} }
public boolean showDownloadExtraActions() { public String getIndexesUrl() {
return true; return "http://" + IndexConstants.INDEX_DOWNLOAD_DOMAIN + "/get_indexes?gzip&" + Version
} .getVersionAsURLParam(app);
}
public File getTracksDir() { public boolean showDownloadExtraActions() {
return app.getAppPath(IndexConstants.GPX_RECORDED_INDEX_DIR); 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) { public List<? extends LocationPoint> getWaypoints() {
if (waypointType == WaypointHelper.ALARMS) { return Collections.emptyList();
return route != null && !route.getAlarmInfo().isEmpty(); }
} else if (waypointType == WaypointHelper.WAYPOINTS) {
return route != null && !route.getLocationPoints().isEmpty();
}
return true;
}
public boolean onDestinationReached() { public boolean isWaypointGroupVisible(int waypointType, RouteCalculationResult route) {
return true; 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 boolean onDestinationReached() {
public Bitmap getNavDrawerLogo() { return true;
return navDrawerLogo; }
}
@Nullable @Nullable
public ArrayList<String> getNavDrawerLogoParams() {return navDrawerParams; } public Bitmap getNavDrawerLogo() {
return navDrawerLogo;
}
public boolean setNavDrawerLogo(@Nullable String uri, @Nullable String packageName, @Nullable String intent) { @Nullable
if (TextUtils.isEmpty(uri)) { public ArrayList<String> getNavDrawerLogoParams() {
navDrawerLogo = null; return navDrawerParams;
} else { }
try {
InputStream is = app.getContentResolver().openInputStream(Uri.parse(uri));
if (is != null) {
navDrawerLogo = BitmapFactory.decodeStream(is);
is.close();
} public boolean setNavDrawerLogo(@Nullable String uri, @Nullable String packageName,
} catch (FileNotFoundException e) { @Nullable String intent) {
return false; if (TextUtils.isEmpty(uri)) {
} catch (IOException e) { navDrawerLogo = null;
// ignore } else {
} try {
if(packageName!=null && intent!=null) { InputStream is = app.getContentResolver().openInputStream(Uri.parse(uri));
navDrawerParams = new ArrayList<>(); if (is != null) {
navDrawerParams.add(packageName); navDrawerLogo = BitmapFactory.decodeStream(is);
navDrawerParams.add(intent); is.close();
}
} }
return true; } 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) { public void setFeaturesDisabledIds(@NonNull Collection<String> ids) {
featuresEnabledIds.clear(); featuresDisabledIds.clear();
featuresEnabledIds.addAll(ids); featuresDisabledIds.addAll(ids);
setFeaturesCustomized(); setFeaturesCustomized();
} }
public void setFeaturesDisabledIds(@NonNull Collection<String> ids) { public void setFeaturesEnabledPatterns(@NonNull Collection<String> patterns) {
featuresDisabledIds.clear(); featuresEnabledPatterns.clear();
featuresDisabledIds.addAll(ids); featuresEnabledPatterns.addAll(patterns);
setFeaturesCustomized(); setFeaturesCustomized();
} }
public void setFeaturesEnabledPatterns(@NonNull Collection<String> patterns) { public void setFeaturesDisabledPatterns(@NonNull Collection<String> patterns) {
featuresEnabledPatterns.clear(); featuresDisabledPatterns.clear();
featuresEnabledPatterns.addAll(patterns); featuresDisabledPatterns.addAll(patterns);
setFeaturesCustomized(); setFeaturesCustomized();
} }
public void setFeaturesDisabledPatterns(@NonNull Collection<String> patterns) { public Set<ApplicationMode> regWidgetVisibility(@NonNull String widgetId,
featuresDisabledPatterns.clear(); @Nullable List<String> appModeKeys) {
featuresDisabledPatterns.addAll(patterns); HashSet<ApplicationMode> set = getAppModesSet(appModeKeys);
setFeaturesCustomized(); widgetsVisibilityMap.put(widgetId, set);
} setWidgetsCustomized();
return set;
}
public Set<ApplicationMode> regWidgetVisibility(@NonNull String widgetId, @Nullable List<String> appModeKeys) { public Set<ApplicationMode> regWidgetAvailability(@NonNull String widgetId,
HashSet<ApplicationMode> set = getAppModesSet(appModeKeys); @Nullable List<String> appModeKeys) {
widgetsVisibilityMap.put(widgetId, set); HashSet<ApplicationMode> set = getAppModesSet(appModeKeys);
setWidgetsCustomized(); widgetsAvailabilityMap.put(widgetId, set);
return set; setWidgetsCustomized();
} return set;
}
public Set<ApplicationMode> regWidgetAvailability(@NonNull String widgetId, @Nullable List<String> appModeKeys) { public boolean isWidgetVisible(@NonNull String key, ApplicationMode appMode) {
HashSet<ApplicationMode> set = getAppModesSet(appModeKeys); Set<ApplicationMode> set = widgetsVisibilityMap.get(key);
widgetsAvailabilityMap.put(widgetId, set); if (set == null) {
setWidgetsCustomized(); return false;
return set; }
} return set.contains(appMode);
}
public boolean isWidgetVisible(@NonNull String key, ApplicationMode appMode) { public boolean isWidgetAvailable(@NonNull String key, ApplicationMode appMode) {
Set<ApplicationMode> set = widgetsVisibilityMap.get(key); Set<ApplicationMode> set = widgetsAvailabilityMap.get(key);
if (set == null) { if (set == null) {
return false; return true;
} }
return set.contains(appMode); return set.contains(appMode);
} }
public boolean isWidgetAvailable(@NonNull String key, ApplicationMode appMode) { public boolean setNavDrawerLogoWithParams(String uri, @Nullable String packageName,
Set<ApplicationMode> set = widgetsAvailabilityMap.get(key); @Nullable String intent) {
if (set == null) { return setNavDrawerLogo(uri, packageName, intent);
return true; }
}
return set.contains(appMode);
}
public boolean setNavDrawerLogoWithParams(String uri, @Nullable String packageName, @Nullable String intent) { public boolean setNavDrawerFooterAction(String packageName, String intent, String appName) {
LOG.info("setNavDrawerLogoWithParams called"); //todo implement custom action to "Powered by Osmand" action in NavDrawer
return setNavDrawerLogo(uri, packageName, intent); return true;
} }
public boolean setNavDrawerFooterAction(String packageName, String intent, String appName) { public boolean changePluginStatus(PluginParams params) {
//todo implement custom action to "Powered by Osmand" action in NavDrawer if (params.getNewState() == 0) {
return true; for (OsmandPlugin plugin : OsmandPlugin.getEnabledPlugins()) {
} if(plugin.getId().equals(params.getPluginId())) plugin.setActive(false);
}
return true;
}
@NonNull if (params.getNewState() == 1) {
private HashSet<ApplicationMode> getAppModesSet(@Nullable List<String> appModeKeys) { for (OsmandPlugin plugin : OsmandPlugin.getAvailablePlugins()) {
HashSet<ApplicationMode> set = new HashSet<>(); if (plugin.getId().equals(params.getPluginId())) {
List<ApplicationMode> values = ApplicationMode.allPossibleValues(); plugin.setActive(true);
if (appModeKeys == null) { }
set.addAll(values); }
} else { return true;
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;
}
public boolean isFeatureEnabled(@NonNull String id) { return false;
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);
}
public boolean areWidgetsCustomized() { @NonNull
return widgetsCustomized; 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() { public boolean isFeatureEnabled(@NonNull String id) {
featuresCustomized = true; 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() { public boolean areWidgetsCustomized() {
widgetsCustomized = true; return widgetsCustomized;
} }
private boolean isMatchesPattern(@NonNull String id, @NonNull Set<String> patterns) { private void setFeaturesCustomized() {
for (String pattern : patterns) { featuresCustomized = true;
if (id.startsWith(pattern)) { }
return true;
}
}
return false;
}
private void notifySettingsCustomized() { private void setWidgetsCustomized() {
app.uiHandler.post(new Runnable() { widgetsCustomized = true;
}
@Override private boolean isMatchesPattern(@NonNull String id, @NonNull Set<String> patterns) {
public void run() { for (String pattern : patterns) {
for (OsmAndAppCustomizationListener l : listeners) { if (id.startsWith(pattern)) {
l.onOsmAndSettingsCustomized(); return true;
} }
} }
}); return false;
} }
public void addListener(OsmAndAppCustomizationListener listener) { private void notifySettingsCustomized() {
this.listeners.add(listener); app.uiHandler.post(new Runnable() {
}
public void removeListener(OsmAndAppCustomizationListener listener) { @Override
this.listeners.remove(listener); 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_IN_HUD_ID = HUD_BTN_ID_SCHEME + "zoom_id";
String ZOOM_OUT_HUD_ID = HUD_BTN_ID_SCHEME + "zoom_out"; String ZOOM_OUT_HUD_ID = HUD_BTN_ID_SCHEME + "zoom_out";
//Point's Context Action Menu: //Map Context Menu Actions:
String POINTS_ACTION_MENU = "point.actions."; String MAP_CONTEXT_MENU_ACTIONS = "point.actions.";
String POINT_DIRECTIONS_FROM_ID = POINTS_ACTION_MENU + "directions_from"; String MAP_CONTEXT_MENU_DIRECTIONS_FROM_ID = MAP_CONTEXT_MENU_ACTIONS + "directions_from";
String POINT_SEARCH_NEARBY = POINTS_ACTION_MENU + "search_nearby"; String MAP_CONTEXT_MENU_SEARCH_NEARBY = MAP_CONTEXT_MENU_ACTIONS + "search_nearby";
String POINT_CHANGE_MARKER_POSITION = POINTS_ACTION_MENU + "change_m_position"; String MAP_CONTEXT_MENU_CHANGE_MARKER_POSITION = MAP_CONTEXT_MENU_ACTIONS + "change_m_position";
String POINT_MARK_AS_PARKING_LOC = POINTS_ACTION_MENU + "mark_as_parking"; String MAP_CONTEXT_MENU_MARK_AS_PARKING_LOC = MAP_CONTEXT_MENU_ACTIONS + "mark_as_parking";
String POINT_MEASURE_DISTANCE = POINTS_ACTION_MENU + "measure_distance"; String MAP_CONTEXT_MENU_MEASURE_DISTANCE = MAP_CONTEXT_MENU_ACTIONS + "measure_distance";
String POINT_EDIT_GPX_WP = POINTS_ACTION_MENU + "edit_gpx_waypoint"; String MAP_CONTEXT_MENU_EDIT_GPX_WP = MAP_CONTEXT_MENU_ACTIONS + "edit_gpx_waypoint";
String POINT_ADD_GPX_WAYPOINT = POINTS_ACTION_MENU + "add_gpx_waypoint"; String MAP_CONTEXT_MENU_ADD_GPX_WAYPOINT = MAP_CONTEXT_MENU_ACTIONS + "add_gpx_waypoint";
String POINT_UPDATE_MAP = POINTS_ACTION_MENU + "update_map"; String MAP_CONTEXT_MENU_UPDATE_MAP = MAP_CONTEXT_MENU_ACTIONS + "update_map";
String POINT_DOWNLOAD_MAP = POINTS_ACTION_MENU + "download_map"; String MAP_CONTEXT_MENU_DOWNLOAD_MAP = MAP_CONTEXT_MENU_ACTIONS + "download_map";
String POINT_MODIFY_POI = POINTS_ACTION_MENU + "modify_poi"; String MAP_CONTEXT_MENU_MODIFY_POI = MAP_CONTEXT_MENU_ACTIONS + "modify_poi";
String POINT_MODIFY_OSM_CHANGE = POINTS_ACTION_MENU + "modify_osm_change"; String MAP_CONTEXT_MENU_MODIFY_OSM_CHANGE = MAP_CONTEXT_MENU_ACTIONS + "modify_osm_change";
String POINT_CREATE_POI = POINTS_ACTION_MENU + "create_poi"; String MAP_CONTEXT_MENU_CREATE_POI = MAP_CONTEXT_MENU_ACTIONS + "create_poi";
String POINT_MODIFY_OSM_NOTE = POINTS_ACTION_MENU + "modify_osm_note"; String MAP_CONTEXT_MENU_MODIFY_OSM_NOTE = MAP_CONTEXT_MENU_ACTIONS + "modify_osm_note";
String POINT_OPEN_OSM_NOTE = POINTS_ACTION_MENU + "open_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.Date;
import java.util.List; import java.util.List;
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_ADD_GPX_WAYPOINT; import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_ADD_GPX_WAYPOINT;
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_DIRECTIONS_FROM_ID; 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_MAP_ID;
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_CONFIGURE_SCREEN_ID; import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_CONFIGURE_SCREEN_ID;
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_DASHBOARD_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_SEARCH_ID;
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_SETTINGS_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.DRAWER_TRAVEL_GUIDES_ID;
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_EDIT_GPX_WP; import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_EDIT_GPX_WP;
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_MEASURE_DISTANCE; import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MEASURE_DISTANCE;
import static net.osmand.plus.OsmAndCustomizationConstants.POINT_SEARCH_NEARBY; import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_SEARCH_NEARBY;
import static net.osmand.plus.helpers.ImportHelper.GPX_SUFFIX; import static net.osmand.plus.helpers.ImportHelper.GPX_SUFFIX;
public class MapActivityActions implements DialogProvider { public class MapActivityActions implements DialogProvider {
@ -324,13 +324,13 @@ public class MapActivityActions implements DialogProvider {
adapter.addItem(itemBuilder adapter.addItem(itemBuilder
.setTitleId(R.string.context_menu_item_directions_from, mapActivity) .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) .setIcon(R.drawable.ic_action_route_direction_from_here)
.setOrder(DIRECTIONS_FROM_ITEM_ORDER) .setOrder(DIRECTIONS_FROM_ITEM_ORDER)
.createItem()); .createItem());
adapter.addItem(itemBuilder adapter.addItem(itemBuilder
.setTitleId(R.string.context_menu_item_search, mapActivity) .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) .setIcon(R.drawable.ic_action_search_dark)
.setOrder(SEARCH_NEAR_ITEM_ORDER) .setOrder(SEARCH_NEAR_ITEM_ORDER)
.createItem()); .createItem());
@ -353,7 +353,7 @@ public class MapActivityActions implements DialogProvider {
&& getMyApplication().getSelectedGpxHelper().getSelectedGPXFile((WptPt) selectedObj) != null) { && getMyApplication().getSelectedGpxHelper().getSelectedGPXFile((WptPt) selectedObj) != null) {
adapter.addItem(new ContextMenuItem.ItemBuilder() adapter.addItem(new ContextMenuItem.ItemBuilder()
.setTitleId(R.string.context_menu_item_edit_waypoint, mapActivity) .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) .setIcon(R.drawable.ic_action_edit_dark)
.setOrder(EDIT_GPX_WAYPOINT_ITEM_ORDER) .setOrder(EDIT_GPX_WAYPOINT_ITEM_ORDER)
.setListener(listener).createItem()); .setListener(listener).createItem());
@ -361,7 +361,7 @@ public class MapActivityActions implements DialogProvider {
|| (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null)) { || (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null)) {
adapter.addItem(new ContextMenuItem.ItemBuilder() adapter.addItem(new ContextMenuItem.ItemBuilder()
.setTitleId(R.string.context_menu_item_add_waypoint, mapActivity) .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) .setIcon(R.drawable.ic_action_gnew_label_dark)
.setOrder(ADD_GPX_WAYPOINT_ITEM_ORDER) .setOrder(ADD_GPX_WAYPOINT_ITEM_ORDER)
.setListener(listener).createItem()); .setListener(listener).createItem());
@ -369,7 +369,7 @@ public class MapActivityActions implements DialogProvider {
adapter.addItem(itemBuilder adapter.addItem(itemBuilder
.setTitleId(R.string.measurement_tool, mapActivity) .setTitleId(R.string.measurement_tool, mapActivity)
.setId(POINT_MEASURE_DISTANCE) .setId(MAP_CONTEXT_MENU_MEASURE_DISTANCE)
.setIcon(R.drawable.ic_action_ruler) .setIcon(R.drawable.ic_action_ruler)
.setOrder(MEASURE_DISTANCE_ITEM_ORDER) .setOrder(MEASURE_DISTANCE_ITEM_ORDER)
.createItem()); .createItem());

View file

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

View file

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

View file

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

View file

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