use of com.chute.sdk.v2.model.AssetModel in project photo-picker-plus-android by chute.
the class AssetUtil method getMediaModel.
/**
* Creates and {@link AssetModel} out of the given {@link DeliverMediaModel}
* .
*
* @param model
* {@link DeliverMediaModel}
* @return {@link AssetModel}
*/
public static AssetModel getMediaModel(DeliverMediaModel model) {
final AssetModel asset = new AssetModel();
asset.setId(model.getLocalMediaUri().toString());
asset.setThumbnail(Uri.fromFile(new File(model.getThumbnail())).toString());
asset.setUrl(Uri.fromFile(new File(model.getImageUrl())).toString());
if (model.getVideoUrl() != null) {
asset.setVideoUrl(Uri.fromFile(new File(model.getVideoUrl())).toString());
}
asset.setType(model.getMediaType().name().toLowerCase());
return asset;
}
use of com.chute.sdk.v2.model.AssetModel in project photo-picker-plus-android by chute.
the class MediaScannerWrapper method onScanCompleted.
public void onScanCompleted(String path, Uri uri) {
File file = new File(path);
Uri uriFromFile = Uri.fromFile(file);
String imagePath = "";
if (mMimeType == MediaType.IMAGE) {
if (AppUtil.hasImageCaptureBug() == false) {
imagePath = uriFromFile.toString();
} else {
imagePath = Uri.fromFile(new File(AppUtil.getPath(context, intent.getData()))).toString();
}
} else if (mMimeType == MediaType.VIDEO) {
imagePath = uriFromFile.toString();
}
final AssetModel model = new AssetModel();
if (uri != null) {
model.setId(uri.toString());
}
if (mMimeType == MediaType.VIDEO) {
Bitmap thumbnail = ThumbnailUtils.createVideoThumbnail(file.getAbsolutePath(), MediaStore.Images.Thumbnails.MINI_KIND);
model.setThumbnail(thumbnail != null ? (AppUtil.getImagePath(context.getApplicationContext(), thumbnail)) : null);
model.setVideoUrl(imagePath);
} else {
model.setThumbnail(imagePath);
}
model.setUrl(imagePath);
model.setType(mMimeType.name().toLowerCase());
IntentUtil.deliverDataToInitialActivity((ServicesActivity) context, model, null);
}
use of com.chute.sdk.v2.model.AssetModel in project photo-picker-plus-android by chute.
the class PhotoPickerPlusTutorialActivity method onActivityResult.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode != Activity.RESULT_OK) {
return;
}
final PhotoPickerPlusIntentWrapper wrapper = new PhotoPickerPlusIntentWrapper(data);
List<AssetModel> accountMediaList = wrapper.getMediaCollection();
AccountModel accountModel = wrapper.getAccountModel();
Log.d(TAG, accountMediaList.toString());
Intent intent = new Intent(getApplicationContext(), PhotoGridActivity.class);
intent.putParcelableArrayListExtra(KEY_MEDIA_LSIT, (ArrayList) accountMediaList);
startActivity(intent);
}
use of com.chute.sdk.v2.model.AssetModel in project photo-picker-plus-android by chute.
the class AssetUtil method getPhotoCollection.
/**
* Creates a list of {@link AssetModel}s from the given
* {@link DeliverMediaModel} list.
*
* @param resultList
* List of {@link DeliverMediaModel}s
* @return List of {@link AssetModel}s
*/
public static List<AssetModel> getPhotoCollection(List<DeliverMediaModel> resultList) {
final List<AssetModel> collection = new ArrayList<AssetModel>();
for (DeliverMediaModel result : resultList) {
AssetModel asset = getMediaModel(result);
collection.add(asset);
}
return collection;
}
use of com.chute.sdk.v2.model.AssetModel in project photo-picker-plus-android by chute.
the class GridAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
AssetModel asset = getItem(position);
int orientation = resolveImageOrientation(asset);
Picasso.with(holder.itemView.getContext()).load(asset.getThumbnail()).placeholder(R.drawable.placeholder).into(holder.imageView);
if (asset.getType().equalsIgnoreCase(MediaType.VIDEO.name().toLowerCase())) {
holder.videoIcon.setVisibility(View.VISIBLE);
} else {
holder.videoIcon.setVisibility(View.GONE);
}
}
Aggregations