Add silent setting
This commit is contained in:
parent
92217cba9f
commit
65facb4af3
3 changed files with 14 additions and 5 deletions
|
@ -15,16 +15,18 @@ public class ProfileSettingsParams extends AidlParams {
|
||||||
|
|
||||||
public static final String VERSION_KEY = "version";
|
public static final String VERSION_KEY = "version";
|
||||||
public static final String REPLACE_KEY = "replace";
|
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 LATEST_CHANGES_KEY = "latestChanges";
|
||||||
public static final String PROFILE_SETTINGS_URI_KEY = "profileSettingsUri";
|
public static final String PROFILE_SETTINGS_URI_KEY = "profileSettingsUri";
|
||||||
private Uri profileSettingsUri;
|
private Uri profileSettingsUri;
|
||||||
private String latestChanges;
|
private String latestChanges;
|
||||||
private int version;
|
private int version;
|
||||||
private ArrayList<String> settingsTypeKeyList = new ArrayList<>();
|
private ArrayList<String> settingsTypeKeyList = new ArrayList<>();
|
||||||
boolean replace;
|
private boolean silent;
|
||||||
|
private boolean replace;
|
||||||
|
|
||||||
public ProfileSettingsParams(Uri profileSettingsUri, ArrayList<AExportSettingsType> settingsTypeList, boolean replace,
|
public ProfileSettingsParams(Uri profileSettingsUri, ArrayList<AExportSettingsType> settingsTypeList, boolean replace,
|
||||||
String latestChanges, int version) {
|
boolean silent, String latestChanges, int version) {
|
||||||
this.profileSettingsUri = profileSettingsUri;
|
this.profileSettingsUri = profileSettingsUri;
|
||||||
for (AExportSettingsType settingsType : settingsTypeList) {
|
for (AExportSettingsType settingsType : settingsTypeList) {
|
||||||
settingsTypeKeyList.add(settingsType.name());
|
settingsTypeKeyList.add(settingsType.name());
|
||||||
|
@ -32,6 +34,7 @@ public class ProfileSettingsParams extends AidlParams {
|
||||||
this.replace = replace;
|
this.replace = replace;
|
||||||
this.latestChanges = latestChanges;
|
this.latestChanges = latestChanges;
|
||||||
this.version = version;
|
this.version = version;
|
||||||
|
this.silent = silent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProfileSettingsParams(Parcel in) {
|
public ProfileSettingsParams(Parcel in) {
|
||||||
|
@ -70,6 +73,10 @@ public class ProfileSettingsParams extends AidlParams {
|
||||||
return replace;
|
return replace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isSilent() {
|
||||||
|
return silent;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToBundle(Bundle bundle) {
|
public void writeToBundle(Bundle bundle) {
|
||||||
bundle.putInt(VERSION_KEY, version);
|
bundle.putInt(VERSION_KEY, version);
|
||||||
|
@ -77,6 +84,7 @@ public class ProfileSettingsParams extends AidlParams {
|
||||||
bundle.putParcelable(PROFILE_SETTINGS_URI_KEY, profileSettingsUri);
|
bundle.putParcelable(PROFILE_SETTINGS_URI_KEY, profileSettingsUri);
|
||||||
bundle.putStringArrayList(SETTINGS_TYPE_KEY, settingsTypeKeyList);
|
bundle.putStringArrayList(SETTINGS_TYPE_KEY, settingsTypeKeyList);
|
||||||
bundle.putBoolean(REPLACE_KEY, replace);
|
bundle.putBoolean(REPLACE_KEY, replace);
|
||||||
|
bundle.putBoolean(SILENT_IMPORT_KEY, silent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -86,5 +94,6 @@ public class ProfileSettingsParams extends AidlParams {
|
||||||
profileSettingsUri = bundle.getParcelable(PROFILE_SETTINGS_URI_KEY);
|
profileSettingsUri = bundle.getParcelable(PROFILE_SETTINGS_URI_KEY);
|
||||||
settingsTypeKeyList = bundle.getStringArrayList(SETTINGS_TYPE_KEY);
|
settingsTypeKeyList = bundle.getStringArrayList(SETTINGS_TYPE_KEY);
|
||||||
replace = bundle.getBoolean(REPLACE_KEY);
|
replace = bundle.getBoolean(REPLACE_KEY);
|
||||||
|
silent = bundle.getBoolean(SILENT_IMPORT_KEY);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2297,12 +2297,12 @@ public class OsmandAidlApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean importProfileV2(final Uri profileUri, ArrayList<String> settingsTypeKeys, boolean replace,
|
public boolean importProfileV2(final Uri profileUri, ArrayList<String> settingsTypeKeys, boolean replace,
|
||||||
String latestChanges, int version) {
|
boolean silent, String latestChanges, int version) {
|
||||||
if (profileUri != null) {
|
if (profileUri != null) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putStringArrayList(SettingsHelper.SETTINGS_TYPE_LIST_KEY, settingsTypeKeys);
|
bundle.putStringArrayList(SettingsHelper.SETTINGS_TYPE_LIST_KEY, settingsTypeKeys);
|
||||||
bundle.putBoolean(REPLACE_KEY, replace);
|
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.putString(SettingsHelper.SETTINGS_LATEST_CHANGES_KEY, latestChanges);
|
||||||
bundle.putInt(SettingsHelper.SETTINGS_VERSION_KEY, version);
|
bundle.putInt(SettingsHelper.SETTINGS_VERSION_KEY, version);
|
||||||
|
|
||||||
|
|
|
@ -1270,7 +1270,7 @@ public class OsmandAidlServiceV2 extends Service implements AidlCallbackListener
|
||||||
try {
|
try {
|
||||||
OsmandAidlApi api = getApi("importProfile");
|
OsmandAidlApi api = getApi("importProfile");
|
||||||
return api != null && api.importProfileV2(params.getProfileSettingsUri(), params.getSettingsTypeKeys(),
|
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) {
|
} catch (Exception e) {
|
||||||
handleException(e);
|
handleException(e);
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue