Formatting fixes
This commit is contained in:
parent
ea9a34076a
commit
579891e513
3 changed files with 63 additions and 91 deletions
|
@ -1646,18 +1646,20 @@ public class OsmandAidlApi {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean registerForOsmandInitialization(final OsmandAppInitCallback callback) throws RemoteException {
|
boolean registerForOsmandInitialization(final OsmandAppInitCallback callback)
|
||||||
|
throws RemoteException {
|
||||||
if (app.isApplicationInitializing()) {
|
if (app.isApplicationInitializing()) {
|
||||||
app.getAppInitializer().addListener(new AppInitializeListener() {
|
app.getAppInitializer().addListener(new AppInitializeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onProgress(AppInitializer init, InitEvents event) {}
|
public void onProgress(AppInitializer init, InitEvents event) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFinish(AppInitializer init) {
|
public void onFinish(AppInitializer init) {
|
||||||
try{
|
try {
|
||||||
LOG.debug("AIDL App registerForOsmandInitialization");
|
LOG.debug("AIDL App registerForOsmandInitialization");
|
||||||
callback.onAppInitialized();
|
callback.onAppInitialized();
|
||||||
} catch(Exception e){
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1889,7 +1891,7 @@ public class OsmandAidlApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean setNavDrawerLogoWithParams(
|
boolean setNavDrawerLogoWithParams(
|
||||||
@NonNull String uri, @Nullable String packageName, @Nullable String intent) {
|
String uri, @Nullable String packageName, @Nullable String intent) {
|
||||||
return app.getAppCustomization().setNavDrawerLogoWithParams(uri, packageName, intent);
|
return app.getAppCustomization().setNavDrawerLogoWithParams(uri, packageName, intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -170,8 +170,7 @@ public class OsmandAidlService extends Service {
|
||||||
public boolean updateFavoriteGroup(UpdateFavoriteGroupParams params) throws RemoteException {
|
public boolean updateFavoriteGroup(UpdateFavoriteGroupParams params) throws RemoteException {
|
||||||
try {
|
try {
|
||||||
OsmandAidlApi api = getApi("updateFavoriteGroup");
|
OsmandAidlApi api = getApi("updateFavoriteGroup");
|
||||||
return params != null && api != null && api
|
return params != null && api != null && api.updateFavoriteGroup(params.getFavoriteGroupPrev(), params.getFavoriteGroupNew());
|
||||||
.updateFavoriteGroup(params.getFavoriteGroupPrev(), params.getFavoriteGroupNew());
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
handleException(e);
|
handleException(e);
|
||||||
return false;
|
return false;
|
||||||
|
@ -204,8 +203,7 @@ public class OsmandAidlService extends Service {
|
||||||
public boolean updateFavorite(UpdateFavoriteParams params) throws RemoteException {
|
public boolean updateFavorite(UpdateFavoriteParams params) throws RemoteException {
|
||||||
try {
|
try {
|
||||||
OsmandAidlApi api = getApi("updateFavorite");
|
OsmandAidlApi api = getApi("updateFavorite");
|
||||||
return params != null && api != null && api
|
return params != null && api != null && api.updateFavorite(params.getFavoritePrev(), params.getFavoriteNew());
|
||||||
.updateFavorite(params.getFavoritePrev(), params.getFavoriteNew());
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
handleException(e);
|
handleException(e);
|
||||||
return false;
|
return false;
|
||||||
|
@ -237,8 +235,7 @@ public class OsmandAidlService extends Service {
|
||||||
public boolean updateMapMarker(UpdateMapMarkerParams params) throws RemoteException {
|
public boolean updateMapMarker(UpdateMapMarkerParams params) throws RemoteException {
|
||||||
try {
|
try {
|
||||||
OsmandAidlApi api = getApi("updateMapMarker");
|
OsmandAidlApi api = getApi("updateMapMarker");
|
||||||
return params != null && api != null && api
|
return params != null && api != null && api.updateMapMarker(params.getMarkerPrev(), params.getMarkerNew());
|
||||||
.updateMapMarker(params.getMarkerPrev(), params.getMarkerNew());
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
handleException(e);
|
handleException(e);
|
||||||
return false;
|
return false;
|
||||||
|
@ -281,8 +278,7 @@ public class OsmandAidlService extends Service {
|
||||||
public boolean showMapPoint(ShowMapPointParams params) throws RemoteException {
|
public boolean showMapPoint(ShowMapPointParams params) throws RemoteException {
|
||||||
try {
|
try {
|
||||||
OsmandAidlApi api = getApi("showMapPoint");
|
OsmandAidlApi api = getApi("showMapPoint");
|
||||||
return params != null && api != null && api
|
return params != null && api != null && api.showMapPoint(params.getLayerId(), params.getPoint());
|
||||||
.showMapPoint(params.getLayerId(), params.getPoint());
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
handleException(e);
|
handleException(e);
|
||||||
return false;
|
return false;
|
||||||
|
@ -293,8 +289,7 @@ public class OsmandAidlService extends Service {
|
||||||
public boolean addMapPoint(AddMapPointParams params) throws RemoteException {
|
public boolean addMapPoint(AddMapPointParams params) throws RemoteException {
|
||||||
try {
|
try {
|
||||||
OsmandAidlApi api = getApi("addMapPoint");
|
OsmandAidlApi api = getApi("addMapPoint");
|
||||||
return params != null && api != null && api
|
return params != null && api != null && api.putMapPoint(params.getLayerId(), params.getPoint());
|
||||||
.putMapPoint(params.getLayerId(), params.getPoint());
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
handleException(e);
|
handleException(e);
|
||||||
return false;
|
return false;
|
||||||
|
@ -305,8 +300,7 @@ public class OsmandAidlService extends Service {
|
||||||
public boolean removeMapPoint(RemoveMapPointParams params) throws RemoteException {
|
public boolean removeMapPoint(RemoveMapPointParams params) throws RemoteException {
|
||||||
try {
|
try {
|
||||||
OsmandAidlApi api = getApi("removeMapPoint");
|
OsmandAidlApi api = getApi("removeMapPoint");
|
||||||
return params != null && api != null && api
|
return params != null && api != null && api.removeMapPoint(params.getLayerId(), params.getPointId());
|
||||||
.removeMapPoint(params.getLayerId(), params.getPointId());
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
handleException(e);
|
handleException(e);
|
||||||
return false;
|
return false;
|
||||||
|
@ -317,8 +311,7 @@ public class OsmandAidlService extends Service {
|
||||||
public boolean updateMapPoint(UpdateMapPointParams params) throws RemoteException {
|
public boolean updateMapPoint(UpdateMapPointParams params) throws RemoteException {
|
||||||
try {
|
try {
|
||||||
OsmandAidlApi api = getApi("updateMapPoint");
|
OsmandAidlApi api = getApi("updateMapPoint");
|
||||||
return params != null && api != null && api
|
return params != null && api != null && api.putMapPoint(params.getLayerId(), params.getPoint());
|
||||||
.putMapPoint(params.getLayerId(), params.getPoint());
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
handleException(e);
|
handleException(e);
|
||||||
return false;
|
return false;
|
||||||
|
@ -504,8 +497,7 @@ public class OsmandAidlService extends Service {
|
||||||
public boolean takePhotoNote(TakePhotoNoteParams params) throws RemoteException {
|
public boolean takePhotoNote(TakePhotoNoteParams params) throws RemoteException {
|
||||||
try {
|
try {
|
||||||
OsmandAidlApi api = getApi("takePhotoNote");
|
OsmandAidlApi api = getApi("takePhotoNote");
|
||||||
return params != null && api != null && api
|
return params != null && api != null && api.takePhotoNote(params.getLatitude(), params.getLongitude());
|
||||||
.takePhotoNote(params.getLatitude(), params.getLongitude());
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
handleException(e);
|
handleException(e);
|
||||||
return false;
|
return false;
|
||||||
|
@ -516,8 +508,7 @@ public class OsmandAidlService extends Service {
|
||||||
public boolean startVideoRecording(StartVideoRecordingParams params) throws RemoteException {
|
public boolean startVideoRecording(StartVideoRecordingParams params) throws RemoteException {
|
||||||
try {
|
try {
|
||||||
OsmandAidlApi api = getApi("startVideoRecording");
|
OsmandAidlApi api = getApi("startVideoRecording");
|
||||||
return params != null && api != null && api
|
return params != null && api != null && api.startVideoRecording(params.getLatitude(), params.getLongitude());
|
||||||
.startVideoRecording(params.getLatitude(), params.getLongitude());
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
handleException(e);
|
handleException(e);
|
||||||
return false;
|
return false;
|
||||||
|
@ -528,8 +519,7 @@ public class OsmandAidlService extends Service {
|
||||||
public boolean startAudioRecording(StartAudioRecordingParams params) throws RemoteException {
|
public boolean startAudioRecording(StartAudioRecordingParams params) throws RemoteException {
|
||||||
try {
|
try {
|
||||||
OsmandAidlApi api = getApi("startAudioRecording");
|
OsmandAidlApi api = getApi("startAudioRecording");
|
||||||
return params != null && api != null && api
|
return params != null && api != null && api.startAudioRecording(params.getLatitude(), params.getLongitude());
|
||||||
.startAudioRecording(params.getLatitude(), params.getLongitude());
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
handleException(e);
|
handleException(e);
|
||||||
return false;
|
return false;
|
||||||
|
@ -565,8 +555,7 @@ public class OsmandAidlService extends Service {
|
||||||
public boolean navigateGpx(NavigateGpxParams params) throws RemoteException {
|
public boolean navigateGpx(NavigateGpxParams params) throws RemoteException {
|
||||||
try {
|
try {
|
||||||
OsmandAidlApi api = getApi("navigateGpx");
|
OsmandAidlApi api = getApi("navigateGpx");
|
||||||
return params != null && api != null && api
|
return params != null && api != null && api.navigateGpx(params.getData(), params.getUri(), params.isForce());
|
||||||
.navigateGpx(params.getData(), params.getUri(), params.isForce());
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
handleException(e);
|
handleException(e);
|
||||||
return false;
|
return false;
|
||||||
|
@ -632,8 +621,7 @@ public class OsmandAidlService extends Service {
|
||||||
public boolean setNavDrawerItems(SetNavDrawerItemsParams params) throws RemoteException {
|
public boolean setNavDrawerItems(SetNavDrawerItemsParams params) throws RemoteException {
|
||||||
try {
|
try {
|
||||||
OsmandAidlApi api = getApi("setNavDrawerItems");
|
OsmandAidlApi api = getApi("setNavDrawerItems");
|
||||||
return params != null && api != null && api
|
return params != null && api != null && api.setNavDrawerItems(params.getAppPackage(), params.getItems());
|
||||||
.setNavDrawerItems(params.getAppPackage(), params.getItems());
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
handleException(e);
|
handleException(e);
|
||||||
return false;
|
return false;
|
||||||
|
@ -641,14 +629,11 @@ public class OsmandAidlService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean search(SearchParams params, final IOsmAndAidlCallback callback)
|
public boolean search(SearchParams params, final IOsmAndAidlCallback callback) throws RemoteException {
|
||||||
throws RemoteException {
|
|
||||||
try {
|
try {
|
||||||
OsmandAidlApi api = getApi("search");
|
OsmandAidlApi api = getApi("search");
|
||||||
return params != null && api != null && api
|
return params != null && api != null && api.search(params.getSearchQuery(), params.getSearchType(),
|
||||||
.search(params.getSearchQuery(), params.getSearchType(),
|
params.getLatitude(), params.getLongitude(), params.getRadiusLevel(), params.getTotalLimit(), new SearchCompleteCallback() {
|
||||||
params.getLatitude(), params.getLongitude(), params.getRadiusLevel(),
|
|
||||||
params.getTotalLimit(), new SearchCompleteCallback() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onSearchComplete(List<SearchResult> resultSet) {
|
public void onSearchComplete(List<SearchResult> resultSet) {
|
||||||
Bundle data = new Bundle();
|
Bundle data = new Bundle();
|
||||||
|
@ -683,8 +668,7 @@ public class OsmandAidlService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long registerForUpdates(long updateTimeMS, IOsmAndAidlCallback callback)
|
public long registerForUpdates(long updateTimeMS, IOsmAndAidlCallback callback) throws RemoteException {
|
||||||
throws RemoteException {
|
|
||||||
if (updateTimeMS >= MIN_UPDATE_TIME_MS) {
|
if (updateTimeMS >= MIN_UPDATE_TIME_MS) {
|
||||||
updateCallbackId++;
|
updateCallbackId++;
|
||||||
callbacks.put(updateCallbackId, callback);
|
callbacks.put(updateCallbackId, callback);
|
||||||
|
@ -731,8 +715,7 @@ public class OsmandAidlService extends Service {
|
||||||
return api != null && api.setDisabledPatterns(patterns);
|
return api != null && api.setDisabledPatterns(patterns);
|
||||||
}
|
}
|
||||||
|
|
||||||
void startRemoteUpdates(final long updateTimeMS, final long callbackId,
|
void startRemoteUpdates(final long updateTimeMS, final long callbackId, final IOsmAndAidlCallback callback) {
|
||||||
final IOsmAndAidlCallback callback) {
|
|
||||||
mHandler.postDelayed(new Runnable() {
|
mHandler.postDelayed(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -751,26 +734,22 @@ public class OsmandAidlService extends Service {
|
||||||
}, updateTimeMS);
|
}, updateTimeMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean regWidgetVisibility(SetWidgetsParams params) throws RemoteException {
|
public boolean regWidgetVisibility(SetWidgetsParams params) throws RemoteException {
|
||||||
OsmandAidlApi api = getApi("regWidgetVisibility");
|
OsmandAidlApi api = getApi("regWidgetVisibility");
|
||||||
return api != null && api
|
return api != null && api.regWidgetVisibility(params.getWidgetKey(), params.getAppModesKeys());
|
||||||
.regWidgetVisibility(params.getWidgetKey(), params.getAppModesKeys());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean regWidgetAvailability(SetWidgetsParams params) throws RemoteException {
|
public boolean regWidgetAvailability(SetWidgetsParams params) throws RemoteException {
|
||||||
OsmandAidlApi api = getApi("regWidgetVisibility");
|
OsmandAidlApi api = getApi("regWidgetVisibility");
|
||||||
return api != null && api
|
return api != null && api.regWidgetAvailability(params.getWidgetKey(), params.getAppModesKeys());
|
||||||
.regWidgetAvailability(params.getWidgetKey(), params.getAppModesKeys());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean customizeOsmandSettings(OsmandSettingsParams params) throws RemoteException {
|
public boolean customizeOsmandSettings(OsmandSettingsParams params) throws RemoteException {
|
||||||
OsmandAidlApi api = getApi("customizeOsmandSettings");
|
OsmandAidlApi api = getApi("customizeOsmandSettings");
|
||||||
return api != null && api
|
return api != null && api.customizeOsmandSettings(params.getSharedPreferencesName(), params.getBundle());
|
||||||
.customizeOsmandSettings(params.getSharedPreferencesName(), params.getBundle());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -69,14 +69,12 @@ public class OsmAndAppCustomization {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class CustomOsmandSettings {
|
public static class CustomOsmandSettings {
|
||||||
|
|
||||||
private String sharedPreferencesName;
|
private String sharedPreferencesName;
|
||||||
private OsmandSettings settings;
|
private OsmandSettings settings;
|
||||||
|
|
||||||
CustomOsmandSettings(OsmandApplication app, String sharedPreferencesName, Bundle bundle) {
|
CustomOsmandSettings(OsmandApplication app, String sharedPreferencesName, Bundle bundle) {
|
||||||
this.sharedPreferencesName = sharedPreferencesName;
|
this.sharedPreferencesName = sharedPreferencesName;
|
||||||
this.settings = new OsmandSettings(app, new net.osmand.plus.api.SettingsAPIImpl(app),
|
this.settings = new OsmandSettings(app, new net.osmand.plus.api.SettingsAPIImpl(app), sharedPreferencesName);
|
||||||
sharedPreferencesName);
|
|
||||||
if (bundle != null) {
|
if (bundle != null) {
|
||||||
for (String key : bundle.keySet()) {
|
for (String key : bundle.keySet()) {
|
||||||
Object object = bundle.get(key);
|
Object object = bundle.get(key);
|
||||||
|
@ -99,8 +97,7 @@ public class OsmAndAppCustomization {
|
||||||
return customOsmandSettings != null ? customOsmandSettings.getSettings() : osmandSettings;
|
return customOsmandSettings != null ? customOsmandSettings.getSettings() : osmandSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void customizeOsmandSettings(@NonNull String sharedPreferencesName,
|
public void customizeOsmandSettings(@NonNull String sharedPreferencesName, @Nullable Bundle bundle) {
|
||||||
@Nullable Bundle bundle) {
|
|
||||||
customOsmandSettings = new CustomOsmandSettings(app, sharedPreferencesName, bundle);
|
customOsmandSettings = new CustomOsmandSettings(app, sharedPreferencesName, bundle);
|
||||||
OsmandSettings newSettings = customOsmandSettings.getSettings();
|
OsmandSettings newSettings = customOsmandSettings.getSettings();
|
||||||
if (Build.VERSION.SDK_INT < 19) {
|
if (Build.VERSION.SDK_INT < 19) {
|
||||||
|
@ -174,8 +171,7 @@ public class OsmAndAppCustomization {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIndexesUrl() {
|
public String getIndexesUrl() {
|
||||||
return "http://" + IndexConstants.INDEX_DOWNLOAD_DOMAIN + "/get_indexes?gzip&" + Version
|
return "https://" + IndexConstants.INDEX_DOWNLOAD_DOMAIN + "/get_indexes?gzip&" + Version.getVersionAsURLParam(app);
|
||||||
.getVersionAsURLParam(app);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean showDownloadExtraActions() {
|
public boolean showDownloadExtraActions() {
|
||||||
|
@ -213,12 +209,9 @@ public class OsmAndAppCustomization {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public ArrayList<String> getNavDrawerLogoParams() {
|
public ArrayList<String> getNavDrawerLogoParams() {return navDrawerParams; }
|
||||||
return navDrawerParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean setNavDrawerLogo(@NonNull String uri, @Nullable String packageName,
|
public boolean setNavDrawerLogo(String uri, @Nullable String packageName, @Nullable String intent) {
|
||||||
@Nullable String intent) {
|
|
||||||
if (TextUtils.isEmpty(uri)) {
|
if (TextUtils.isEmpty(uri)) {
|
||||||
navDrawerLogo = null;
|
navDrawerLogo = null;
|
||||||
} else {
|
} else {
|
||||||
|
@ -276,16 +269,14 @@ public class OsmAndAppCustomization {
|
||||||
setFeaturesCustomized();
|
setFeaturesCustomized();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<ApplicationMode> regWidgetVisibility(@NonNull String widgetId,
|
public Set<ApplicationMode> regWidgetVisibility(@NonNull String widgetId, @Nullable List<String> appModeKeys) {
|
||||||
@Nullable List<String> appModeKeys) {
|
|
||||||
HashSet<ApplicationMode> set = getAppModesSet(appModeKeys);
|
HashSet<ApplicationMode> set = getAppModesSet(appModeKeys);
|
||||||
widgetsVisibilityMap.put(widgetId, set);
|
widgetsVisibilityMap.put(widgetId, set);
|
||||||
setWidgetsCustomized();
|
setWidgetsCustomized();
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<ApplicationMode> regWidgetAvailability(@NonNull String widgetId,
|
public Set<ApplicationMode> regWidgetAvailability(@NonNull String widgetId, @Nullable List<String> appModeKeys) {
|
||||||
@Nullable List<String> appModeKeys) {
|
|
||||||
HashSet<ApplicationMode> set = getAppModesSet(appModeKeys);
|
HashSet<ApplicationMode> set = getAppModesSet(appModeKeys);
|
||||||
widgetsAvailabilityMap.put(widgetId, set);
|
widgetsAvailabilityMap.put(widgetId, set);
|
||||||
setWidgetsCustomized();
|
setWidgetsCustomized();
|
||||||
|
@ -308,7 +299,7 @@ public class OsmAndAppCustomization {
|
||||||
return set.contains(appMode);
|
return set.contains(appMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean setNavDrawerLogoWithParams(@NonNull String imageUri, @Nullable String packageName,
|
public boolean setNavDrawerLogoWithParams(String imageUri, @Nullable String packageName,
|
||||||
@Nullable String intent) {
|
@Nullable String intent) {
|
||||||
return setNavDrawerLogo(imageUri, packageName, intent);
|
return setNavDrawerLogo(imageUri, packageName, intent);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue