use of com.bilibili.boxing.model.entity.BaseMedia in project boxing by Bilibili.
the class AbsBoxingViewFragment method onCropActivityResult.
/**
* successfully get result from crop in {@link #onActivityResult(int, int, Intent)}
*/
public void onCropActivityResult(int requestCode, int resultCode, @NonNull Intent data) {
Uri output = BoxingCrop.getInstance().onCropFinish(resultCode, data);
if (output != null) {
List<BaseMedia> medias = new ArrayList<>(1);
ImageMedia media = new ImageMedia(String.valueOf(System.currentTimeMillis()), output.getPath());
medias.add(media);
onFinish(medias);
}
}
use of com.bilibili.boxing.model.entity.BaseMedia in project boxing by Bilibili.
the class AbsBoxingViewFragment method onFinish.
/**
* called the job is done.Click the ok button, take a photo from camera, crop a photo.
* most of the time, you do not have to override.
*
* @param medias the list of selection
*/
@Override
public void onFinish(@NonNull List<BaseMedia> medias) {
Intent intent = new Intent();
intent.putParcelableArrayListExtra(Boxing.EXTRA_RESULT, (ArrayList<BaseMedia>) medias);
if (mOnFinishListener != null) {
mOnFinishListener.onBoxingFinish(intent, medias);
}
}
use of com.bilibili.boxing.model.entity.BaseMedia in project boxing by Bilibili.
the class PickerPresenter method checkSelectedMedia.
@Override
public void checkSelectedMedia(List<BaseMedia> allMedias, List<BaseMedia> selectedMedias) {
if (allMedias == null || allMedias.size() == 0) {
return;
}
Map<String, ImageMedia> map = new HashMap<>(allMedias.size());
for (BaseMedia allMedia : allMedias) {
if (!(allMedia instanceof ImageMedia)) {
return;
}
ImageMedia media = (ImageMedia) allMedia;
media.setSelected(false);
map.put(media.getPath(), media);
}
if (selectedMedias == null || selectedMedias.size() < 0) {
return;
}
for (BaseMedia media : selectedMedias) {
if (map.containsKey(media.getPath())) {
map.get(media.getPath()).setSelected(true);
}
}
}
use of com.bilibili.boxing.model.entity.BaseMedia in project boxing by Bilibili.
the class AbsBoxingViewActivity method onFinish.
/**
* called the job is done.Click the ok button, take a photo from camera, crop a photo.
* most of the time, you do not have to override.
*
* @param medias the list of selection
*/
@Override
public void onFinish(@NonNull List<BaseMedia> medias) {
Intent intent = new Intent();
intent.putParcelableArrayListExtra(Boxing.EXTRA_RESULT, (ArrayList<BaseMedia>) medias);
}
use of com.bilibili.boxing.model.entity.BaseMedia in project boxing by Bilibili.
the class PickerActivityTest method testCreateMultiImageIntent.
@Test
public void testCreateMultiImageIntent() {
Intent intent = Boxing.of(new BoxingConfig(BoxingConfig.Mode.MULTI_IMG).needGif()).withIntent(mContext, BoxingActivity.class).getIntent();
assertNotNull(intent);
BoxingConfig config = BoxingManager.getInstance().getBoxingConfig();
assertNotNull(config);
assertEquals(config.getMode(), BoxingConfig.Mode.MULTI_IMG);
assertEquals(config.isNeedCamera(), false);
BoxingCropOption cropOptions = config.getCropOption();
assertNull(cropOptions);
ArrayList<BaseMedia> list = intent.getParcelableArrayListExtra(Boxing.EXTRA_SELECTED_MEDIA);
assertEquals(list, null);
Intent intent1 = Boxing.of(new BoxingConfig(BoxingConfig.Mode.MULTI_IMG).needGif()).withIntent(mContext, BoxingActivity.class, new ArrayList<ImageMedia>()).getIntent();
assertNotNull(intent1);
ArrayList<BaseMedia> list1 = intent.getParcelableArrayListExtra(Boxing.EXTRA_SELECTED_MEDIA);
assertEquals(list1, null);
ArrayList<ImageMedia> medias = new ArrayList<>();
medias.add(new ImageMedia("test", "test"));
Intent intent2 = Boxing.of(new BoxingConfig(BoxingConfig.Mode.MULTI_IMG).needGif()).withIntent(mContext, BoxingActivity.class, medias).getIntent();
assertNotNull(intent2);
ArrayList<BaseMedia> list2 = intent2.getParcelableArrayListExtra(Boxing.EXTRA_SELECTED_MEDIA);
assertEquals(list2, medias);
}
Aggregations