use of com.getchute.android.photopickerplus.models.MediaModel in project photo-picker-plus-android by chute.
the class ImageDataResponseLoader method postImageData.
public static void postImageData(Context context, ArrayList<AccountMediaModel> selectedImages, ListenerFilesAccount accountListener, AccountModel accountModel) {
String token = TokenAuthenticationProvider.getInstance().getToken();
AuthConstants authConstants = AuthenticationFactory.getInstance().getAuthConstants();
String clientId = authConstants.clientId;
String clientSecret = authConstants.clientSecret;
Chute.init(context, new AuthConstants(clientId, clientSecret), token);
ArrayList<MediaDataModel> mediaModelList = new ArrayList<MediaDataModel>();
for (AccountMediaModel accountMediaModel : selectedImages) {
MediaDataModel mediaModel = new MediaDataModel();
if (accountMediaModel.getVideoUrl() != null) {
mediaModel.setFileType(MediaType.VIDEO.name().toLowerCase());
} else {
mediaModel.setFileType(MediaType.IMAGE.name().toLowerCase());
}
mediaModel.setVideoUrl(accountMediaModel.getVideoUrl());
mediaModel.setImageUrl(accountMediaModel.getImageUrl());
mediaModel.setThumbnail(accountMediaModel.getThumbnail());
mediaModelList.add(mediaModel);
}
OptionsModel options = new OptionsModel();
options.setCliendId(clientId);
MediaModel imageDataModel = new MediaModel();
imageDataModel.setOptions(options);
imageDataModel.setMedia(mediaModelList);
getImageData(imageDataModel, new ImageDataCallback(context, accountListener, accountModel)).executeAsync();
}
Aggregations