Formatting fixes

This commit is contained in:
madwasp79 2019-01-16 17:33:28 +02:00
parent ea9a34076a
commit 579891e513
3 changed files with 63 additions and 91 deletions

View file

@ -1646,18 +1646,20 @@ public class OsmandAidlApi {
return true;
}
boolean registerForOsmandInitialization(final OsmandAppInitCallback callback) throws RemoteException {
boolean registerForOsmandInitialization(final OsmandAppInitCallback callback)
throws RemoteException {
if (app.isApplicationInitializing()) {
app.getAppInitializer().addListener(new AppInitializeListener() {
@Override
public void onProgress(AppInitializer init, InitEvents event) {}
public void onProgress(AppInitializer init, InitEvents event) {
}
@Override
public void onFinish(AppInitializer init) {
try{
try {
LOG.debug("AIDL App registerForOsmandInitialization");
callback.onAppInitialized();
} catch(Exception e){
} catch (Exception e) {
e.printStackTrace();
}
}
@ -1889,7 +1891,7 @@ public class OsmandAidlApi {
}
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);
}

View file

@ -170,8 +170,7 @@ public class OsmandAidlService extends Service {
public boolean updateFavoriteGroup(UpdateFavoriteGroupParams params) throws RemoteException {
try {
OsmandAidlApi api = getApi("updateFavoriteGroup");
return params != null && api != null && api
.updateFavoriteGroup(params.getFavoriteGroupPrev(), params.getFavoriteGroupNew());
return params != null && api != null && api.updateFavoriteGroup(params.getFavoriteGroupPrev(), params.getFavoriteGroupNew());
} catch (Exception e) {
handleException(e);
return false;
@ -204,8 +203,7 @@ public class OsmandAidlService extends Service {
public boolean updateFavorite(UpdateFavoriteParams params) throws RemoteException {
try {
OsmandAidlApi api = getApi("updateFavorite");
return params != null && api != null && api
.updateFavorite(params.getFavoritePrev(), params.getFavoriteNew());
return params != null && api != null && api.updateFavorite(params.getFavoritePrev(), params.getFavoriteNew());
} catch (Exception e) {
handleException(e);
return false;
@ -237,8 +235,7 @@ public class OsmandAidlService extends Service {
public boolean updateMapMarker(UpdateMapMarkerParams params) throws RemoteException {
try {
OsmandAidlApi api = getApi("updateMapMarker");
return params != null && api != null && api
.updateMapMarker(params.getMarkerPrev(), params.getMarkerNew());
return params != null && api != null && api.updateMapMarker(params.getMarkerPrev(), params.getMarkerNew());
} catch (Exception e) {
handleException(e);
return false;
@ -281,8 +278,7 @@ public class OsmandAidlService extends Service {
public boolean showMapPoint(ShowMapPointParams params) throws RemoteException {
try {
OsmandAidlApi api = getApi("showMapPoint");
return params != null && api != null && api
.showMapPoint(params.getLayerId(), params.getPoint());
return params != null && api != null && api.showMapPoint(params.getLayerId(), params.getPoint());
} catch (Exception e) {
handleException(e);
return false;
@ -293,8 +289,7 @@ public class OsmandAidlService extends Service {
public boolean addMapPoint(AddMapPointParams params) throws RemoteException {
try {
OsmandAidlApi api = getApi("addMapPoint");
return params != null && api != null && api
.putMapPoint(params.getLayerId(), params.getPoint());
return params != null && api != null && api.putMapPoint(params.getLayerId(), params.getPoint());
} catch (Exception e) {
handleException(e);
return false;
@ -305,8 +300,7 @@ public class OsmandAidlService extends Service {
public boolean removeMapPoint(RemoveMapPointParams params) throws RemoteException {
try {
OsmandAidlApi api = getApi("removeMapPoint");
return params != null && api != null && api
.removeMapPoint(params.getLayerId(), params.getPointId());
return params != null && api != null && api.removeMapPoint(params.getLayerId(), params.getPointId());
} catch (Exception e) {
handleException(e);
return false;
@ -317,8 +311,7 @@ public class OsmandAidlService extends Service {
public boolean updateMapPoint(UpdateMapPointParams params) throws RemoteException {
try {
OsmandAidlApi api = getApi("updateMapPoint");
return params != null && api != null && api
.putMapPoint(params.getLayerId(), params.getPoint());
return params != null && api != null && api.putMapPoint(params.getLayerId(), params.getPoint());
} catch (Exception e) {
handleException(e);
return false;
@ -504,8 +497,7 @@ public class OsmandAidlService extends Service {
public boolean takePhotoNote(TakePhotoNoteParams params) throws RemoteException {
try {
OsmandAidlApi api = getApi("takePhotoNote");
return params != null && api != null && api
.takePhotoNote(params.getLatitude(), params.getLongitude());
return params != null && api != null && api.takePhotoNote(params.getLatitude(), params.getLongitude());
} catch (Exception e) {
handleException(e);
return false;
@ -516,8 +508,7 @@ public class OsmandAidlService extends Service {
public boolean startVideoRecording(StartVideoRecordingParams params) throws RemoteException {
try {
OsmandAidlApi api = getApi("startVideoRecording");
return params != null && api != null && api
.startVideoRecording(params.getLatitude(), params.getLongitude());
return params != null && api != null && api.startVideoRecording(params.getLatitude(), params.getLongitude());
} catch (Exception e) {
handleException(e);
return false;
@ -528,8 +519,7 @@ public class OsmandAidlService extends Service {
public boolean startAudioRecording(StartAudioRecordingParams params) throws RemoteException {
try {
OsmandAidlApi api = getApi("startAudioRecording");
return params != null && api != null && api
.startAudioRecording(params.getLatitude(), params.getLongitude());
return params != null && api != null && api.startAudioRecording(params.getLatitude(), params.getLongitude());
} catch (Exception e) {
handleException(e);
return false;
@ -565,8 +555,7 @@ public class OsmandAidlService extends Service {
public boolean navigateGpx(NavigateGpxParams params) throws RemoteException {
try {
OsmandAidlApi api = getApi("navigateGpx");
return params != null && api != null && api
.navigateGpx(params.getData(), params.getUri(), params.isForce());
return params != null && api != null && api.navigateGpx(params.getData(), params.getUri(), params.isForce());
} catch (Exception e) {
handleException(e);
return false;
@ -632,8 +621,7 @@ public class OsmandAidlService extends Service {
public boolean setNavDrawerItems(SetNavDrawerItemsParams params) throws RemoteException {
try {
OsmandAidlApi api = getApi("setNavDrawerItems");
return params != null && api != null && api
.setNavDrawerItems(params.getAppPackage(), params.getItems());
return params != null && api != null && api.setNavDrawerItems(params.getAppPackage(), params.getItems());
} catch (Exception e) {
handleException(e);
return false;
@ -641,14 +629,11 @@ public class OsmandAidlService extends Service {
}
@Override
public boolean search(SearchParams params, final IOsmAndAidlCallback callback)
throws RemoteException {
public boolean search(SearchParams params, final IOsmAndAidlCallback callback) throws RemoteException {
try {
OsmandAidlApi api = getApi("search");
return params != null && api != null && api
.search(params.getSearchQuery(), params.getSearchType(),
params.getLatitude(), params.getLongitude(), params.getRadiusLevel(),
params.getTotalLimit(), new SearchCompleteCallback() {
return params != null && api != null && api.search(params.getSearchQuery(), params.getSearchType(),
params.getLatitude(), params.getLongitude(), params.getRadiusLevel(), params.getTotalLimit(), new SearchCompleteCallback() {
@Override
public void onSearchComplete(List<SearchResult> resultSet) {
Bundle data = new Bundle();
@ -683,8 +668,7 @@ public class OsmandAidlService extends Service {
}
@Override
public long registerForUpdates(long updateTimeMS, IOsmAndAidlCallback callback)
throws RemoteException {
public long registerForUpdates(long updateTimeMS, IOsmAndAidlCallback callback) throws RemoteException {
if (updateTimeMS >= MIN_UPDATE_TIME_MS) {
updateCallbackId++;
callbacks.put(updateCallbackId, callback);
@ -731,8 +715,7 @@ public class OsmandAidlService extends Service {
return api != null && api.setDisabledPatterns(patterns);
}
void startRemoteUpdates(final long updateTimeMS, final long callbackId,
final IOsmAndAidlCallback callback) {
void startRemoteUpdates(final long updateTimeMS, final long callbackId, final IOsmAndAidlCallback callback) {
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
@ -751,26 +734,22 @@ public class OsmandAidlService extends Service {
}, updateTimeMS);
}
@Override
public boolean regWidgetVisibility(SetWidgetsParams params) throws RemoteException {
OsmandAidlApi api = getApi("regWidgetVisibility");
return api != null && api
.regWidgetVisibility(params.getWidgetKey(), params.getAppModesKeys());
return api != null && api.regWidgetVisibility(params.getWidgetKey(), params.getAppModesKeys());
}
@Override
public boolean regWidgetAvailability(SetWidgetsParams params) throws RemoteException {
OsmandAidlApi api = getApi("regWidgetVisibility");
return api != null && api
.regWidgetAvailability(params.getWidgetKey(), params.getAppModesKeys());
return api != null && api.regWidgetAvailability(params.getWidgetKey(), params.getAppModesKeys());
}
@Override
public boolean customizeOsmandSettings(OsmandSettingsParams params) throws RemoteException {
OsmandAidlApi api = getApi("customizeOsmandSettings");
return api != null && api
.customizeOsmandSettings(params.getSharedPreferencesName(), params.getBundle());
return api != null && api.customizeOsmandSettings(params.getSharedPreferencesName(), params.getBundle());
}
@Override

View file

@ -69,14 +69,12 @@ public class OsmAndAppCustomization {
}
public static class CustomOsmandSettings {
private String sharedPreferencesName;
private OsmandSettings settings;
CustomOsmandSettings(OsmandApplication app, String sharedPreferencesName, Bundle bundle) {
this.sharedPreferencesName = sharedPreferencesName;
this.settings = new OsmandSettings(app, new net.osmand.plus.api.SettingsAPIImpl(app),
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);
@ -99,8 +97,7 @@ public class OsmAndAppCustomization {
return customOsmandSettings != null ? customOsmandSettings.getSettings() : osmandSettings;
}
public void customizeOsmandSettings(@NonNull String sharedPreferencesName,
@Nullable Bundle bundle) {
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) {
@ -174,8 +171,7 @@ public class OsmAndAppCustomization {
}
public String getIndexesUrl() {
return "http://" + IndexConstants.INDEX_DOWNLOAD_DOMAIN + "/get_indexes?gzip&" + Version
.getVersionAsURLParam(app);
return "https://" + IndexConstants.INDEX_DOWNLOAD_DOMAIN + "/get_indexes?gzip&" + Version.getVersionAsURLParam(app);
}
public boolean showDownloadExtraActions() {
@ -213,12 +209,9 @@ public class OsmAndAppCustomization {
}
@Nullable
public ArrayList<String> getNavDrawerLogoParams() {
return navDrawerParams;
}
public ArrayList<String> getNavDrawerLogoParams() {return navDrawerParams; }
public boolean setNavDrawerLogo(@NonNull String uri, @Nullable String packageName,
@Nullable String intent) {
public boolean setNavDrawerLogo(String uri, @Nullable String packageName, @Nullable String intent) {
if (TextUtils.isEmpty(uri)) {
navDrawerLogo = null;
} else {
@ -276,16 +269,14 @@ public class OsmAndAppCustomization {
setFeaturesCustomized();
}
public Set<ApplicationMode> regWidgetVisibility(@NonNull String widgetId,
@Nullable List<String> appModeKeys) {
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) {
public Set<ApplicationMode> regWidgetAvailability(@NonNull String widgetId, @Nullable List<String> appModeKeys) {
HashSet<ApplicationMode> set = getAppModesSet(appModeKeys);
widgetsAvailabilityMap.put(widgetId, set);
setWidgetsCustomized();
@ -308,7 +299,7 @@ public class OsmAndAppCustomization {
return set.contains(appMode);
}
public boolean setNavDrawerLogoWithParams(@NonNull String imageUri, @Nullable String packageName,
public boolean setNavDrawerLogoWithParams(String imageUri, @Nullable String packageName,
@Nullable String intent) {
return setNavDrawerLogo(imageUri, packageName, intent);
}