Add import profile to new aidl api
This commit is contained in:
parent
4f49721194
commit
ee2ff5f017
4 changed files with 80 additions and 0 deletions
|
@ -73,6 +73,7 @@ import net.osmand.aidlapi.customization.SetWidgetsParams;
|
|||
import net.osmand.aidlapi.customization.OsmandSettingsParams;
|
||||
import net.osmand.aidlapi.customization.OsmandSettingsInfoParams;
|
||||
import net.osmand.aidlapi.customization.CustomizationInfoParams;
|
||||
import net.osmand.aidlapi.customization.ProfileSettingsParams;
|
||||
|
||||
import net.osmand.aidlapi.gpx.AGpxFile;
|
||||
import net.osmand.aidlapi.gpx.AGpxFileDetails;
|
||||
|
@ -831,4 +832,6 @@ interface IOsmAndAidlInterface {
|
|||
* Empty class of params
|
||||
*/
|
||||
boolean removeAllActiveMapMarkers(in RemoveMapMarkersParams params);
|
||||
|
||||
boolean importProfile(in ProfileSettingsParams params);
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
package net.osmand.aidlapi.customization;
|
||||
|
||||
parcelable ProfileSettingsParams;
|
|
@ -0,0 +1,62 @@
|
|||
package net.osmand.aidlapi.customization;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcel;
|
||||
|
||||
import net.osmand.aidlapi.AidlParams;
|
||||
|
||||
public class ProfileSettingsParams extends AidlParams {
|
||||
|
||||
private Uri profileSettingsUri;
|
||||
private String latestChanges;
|
||||
private int version;
|
||||
|
||||
public ProfileSettingsParams(Uri profileSettingsUri, String latestChanges, int version) {
|
||||
this.profileSettingsUri = profileSettingsUri;
|
||||
this.latestChanges = latestChanges;
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public ProfileSettingsParams(Parcel in) {
|
||||
readFromParcel(in);
|
||||
}
|
||||
|
||||
public static final Creator<ProfileSettingsParams> CREATOR = new Creator<ProfileSettingsParams>() {
|
||||
@Override
|
||||
public ProfileSettingsParams createFromParcel(Parcel in) {
|
||||
return new ProfileSettingsParams(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProfileSettingsParams[] newArray(int size) {
|
||||
return new ProfileSettingsParams[size];
|
||||
}
|
||||
};
|
||||
|
||||
public int getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public String getLatestChanges() {
|
||||
return latestChanges;
|
||||
}
|
||||
|
||||
public Uri getProfileSettingsUri() {
|
||||
return profileSettingsUri;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToBundle(Bundle bundle) {
|
||||
bundle.putInt("version", version);
|
||||
bundle.putString("latestChanges", latestChanges);
|
||||
bundle.putParcelable("profileSettingsUri", profileSettingsUri);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readFromBundle(Bundle bundle) {
|
||||
version = bundle.getInt("version");
|
||||
latestChanges = bundle.getString("latestChanges");
|
||||
profileSettingsUri = bundle.getParcelable("profileSettingsUri");
|
||||
}
|
||||
}
|
|
@ -24,6 +24,7 @@ import net.osmand.aidlapi.copyfile.CopyFileParams;
|
|||
import net.osmand.aidlapi.customization.CustomizationInfoParams;
|
||||
import net.osmand.aidlapi.customization.OsmandSettingsInfoParams;
|
||||
import net.osmand.aidlapi.customization.OsmandSettingsParams;
|
||||
import net.osmand.aidlapi.customization.ProfileSettingsParams;
|
||||
import net.osmand.aidlapi.customization.SetWidgetsParams;
|
||||
import net.osmand.aidlapi.favorite.AFavorite;
|
||||
import net.osmand.aidlapi.favorite.AddFavoriteParams;
|
||||
|
@ -1213,6 +1214,17 @@ public class OsmandAidlServiceV2 extends Service implements AidlCallbackListener
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean importProfile(ProfileSettingsParams params) {
|
||||
try {
|
||||
OsmandAidlApi api = getApi("importProfile");
|
||||
return api != null && api.importProfile(params.getProfileSettingsUri(), params.getLatestChanges(), params.getVersion());
|
||||
} catch (Exception e) {
|
||||
handleException(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private void setCustomization(OsmandAidlApi api, CustomizationInfoParams params) {
|
||||
|
|
Loading…
Reference in a new issue