From 65facb4af39b7e41a9e37ed720cc2896ed6e1878 Mon Sep 17 00:00:00 2001 From: cepprice Date: Thu, 28 Jan 2021 18:11:24 +0500 Subject: [PATCH] Add silent setting --- .../customization/ProfileSettingsParams.java | 13 +++++++++++-- OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java | 4 ++-- OsmAnd/src/net/osmand/aidl/OsmandAidlServiceV2.java | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/OsmAnd-api/src/net/osmand/aidlapi/customization/ProfileSettingsParams.java b/OsmAnd-api/src/net/osmand/aidlapi/customization/ProfileSettingsParams.java index 00c68851e7..afca79aa0e 100644 --- a/OsmAnd-api/src/net/osmand/aidlapi/customization/ProfileSettingsParams.java +++ b/OsmAnd-api/src/net/osmand/aidlapi/customization/ProfileSettingsParams.java @@ -15,16 +15,18 @@ public class ProfileSettingsParams extends AidlParams { public static final String VERSION_KEY = "version"; public static final String REPLACE_KEY = "replace"; + public static final String SILENT_IMPORT_KEY = "silent_import"; public static final String LATEST_CHANGES_KEY = "latestChanges"; public static final String PROFILE_SETTINGS_URI_KEY = "profileSettingsUri"; private Uri profileSettingsUri; private String latestChanges; private int version; private ArrayList settingsTypeKeyList = new ArrayList<>(); - boolean replace; + private boolean silent; + private boolean replace; public ProfileSettingsParams(Uri profileSettingsUri, ArrayList settingsTypeList, boolean replace, - String latestChanges, int version) { + boolean silent, String latestChanges, int version) { this.profileSettingsUri = profileSettingsUri; for (AExportSettingsType settingsType : settingsTypeList) { settingsTypeKeyList.add(settingsType.name()); @@ -32,6 +34,7 @@ public class ProfileSettingsParams extends AidlParams { this.replace = replace; this.latestChanges = latestChanges; this.version = version; + this.silent = silent; } public ProfileSettingsParams(Parcel in) { @@ -70,6 +73,10 @@ public class ProfileSettingsParams extends AidlParams { return replace; } + public boolean isSilent() { + return silent; + } + @Override public void writeToBundle(Bundle bundle) { bundle.putInt(VERSION_KEY, version); @@ -77,6 +84,7 @@ public class ProfileSettingsParams extends AidlParams { bundle.putParcelable(PROFILE_SETTINGS_URI_KEY, profileSettingsUri); bundle.putStringArrayList(SETTINGS_TYPE_KEY, settingsTypeKeyList); bundle.putBoolean(REPLACE_KEY, replace); + bundle.putBoolean(SILENT_IMPORT_KEY, silent); } @Override @@ -86,5 +94,6 @@ public class ProfileSettingsParams extends AidlParams { profileSettingsUri = bundle.getParcelable(PROFILE_SETTINGS_URI_KEY); settingsTypeKeyList = bundle.getStringArrayList(SETTINGS_TYPE_KEY); replace = bundle.getBoolean(REPLACE_KEY); + silent = bundle.getBoolean(SILENT_IMPORT_KEY); } } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java index 1dc3e00d98..033fceff1a 100644 --- a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java +++ b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java @@ -2297,12 +2297,12 @@ public class OsmandAidlApi { } public boolean importProfileV2(final Uri profileUri, ArrayList settingsTypeKeys, boolean replace, - String latestChanges, int version) { + boolean silent, String latestChanges, int version) { if (profileUri != null) { Bundle bundle = new Bundle(); bundle.putStringArrayList(SettingsHelper.SETTINGS_TYPE_LIST_KEY, settingsTypeKeys); bundle.putBoolean(REPLACE_KEY, replace); - bundle.putBoolean(SILENT_IMPORT_KEY, true); + bundle.putBoolean(SILENT_IMPORT_KEY, silent); bundle.putString(SettingsHelper.SETTINGS_LATEST_CHANGES_KEY, latestChanges); bundle.putInt(SettingsHelper.SETTINGS_VERSION_KEY, version); diff --git a/OsmAnd/src/net/osmand/aidl/OsmandAidlServiceV2.java b/OsmAnd/src/net/osmand/aidl/OsmandAidlServiceV2.java index ed7ab614f3..fcd5d5159e 100644 --- a/OsmAnd/src/net/osmand/aidl/OsmandAidlServiceV2.java +++ b/OsmAnd/src/net/osmand/aidl/OsmandAidlServiceV2.java @@ -1270,7 +1270,7 @@ public class OsmandAidlServiceV2 extends Service implements AidlCallbackListener try { OsmandAidlApi api = getApi("importProfile"); return api != null && api.importProfileV2(params.getProfileSettingsUri(), params.getSettingsTypeKeys(), - params.isReplace(), params.getLatestChanges(), params.getVersion()); + params.isReplace(), params.isSilent(), params.getLatestChanges(), params.getVersion()); } catch (Exception e) { handleException(e); return false;