use of com.bilibili.boxing.model.config.BoxingConfig in project boxing by Bilibili.
the class PickerActivityTest method testCreateVideoIntent.
@Test
public void testCreateVideoIntent() {
Intent intent = Boxing.of(new BoxingConfig(BoxingConfig.Mode.VIDEO)).withIntent(mContext, BoxingActivity.class).getIntent();
assertNotNull(intent);
BoxingConfig config = BoxingManager.getInstance().getBoxingConfig();
assertNotNull(config);
assertEquals(config.getMode(), BoxingConfig.Mode.VIDEO);
assertEquals(config.isNeedCamera(), false);
BoxingCropOption cropOptions = config.getCropOption();
assertEquals(cropOptions, null);
ArrayList<BaseMedia> list = intent.getParcelableArrayListExtra(Boxing.EXTRA_SELECTED_MEDIA);
assertEquals(null, list);
}
use of com.bilibili.boxing.model.config.BoxingConfig in project boxing by Bilibili.
the class PickerActivityTest method setup.
@Before
public void setup() {
BoxingManager.getInstance().setBoxingConfig(new BoxingConfig(BoxingConfig.Mode.MULTI_IMG));
mContext = InstrumentationRegistry.getContext();
}
use of com.bilibili.boxing.model.config.BoxingConfig in project boxing by Bilibili.
the class PickerActivityTest method testCreateSingleImageWithCropIntent.
@Test
public void testCreateSingleImageWithCropIntent() {
Uri destUri = new Uri.Builder().scheme("file").appendPath("test").appendPath(String.format(Locale.US, "%s.jpg", System.currentTimeMillis())).build();
Intent intent = Boxing.of(new BoxingConfig(BoxingConfig.Mode.SINGLE_IMG).withCropOption(new BoxingCropOption(destUri))).withIntent(mContext, BoxingActivity.class).getIntent();
assertNotNull(intent);
BoxingConfig config = BoxingManager.getInstance().getBoxingConfig();
assertNotNull(config);
assertEquals(config.getMode(), BoxingConfig.Mode.SINGLE_IMG);
assertEquals(config.isNeedCamera(), false);
BoxingCropOption cropOptions = config.getCropOption();
assertNotNull(cropOptions);
ArrayList<BaseMedia> list = intent.getParcelableArrayListExtra(Boxing.EXTRA_SELECTED_MEDIA);
assertEquals(list, null);
}
use of com.bilibili.boxing.model.config.BoxingConfig in project boxing by Bilibili.
the class FirstActivity method onClick.
@Override
public void onClick(View v) {
int id = v.getId();
switch(id) {
case R.id.single_image_btn:
BoxingConfig singleImgConfig = new BoxingConfig(BoxingConfig.Mode.SINGLE_IMG).withMediaPlaceHolderRes(R.drawable.ic_boxing_default_image);
Boxing.of(singleImgConfig).withIntent(this, BoxingActivity.class).start(this, COMPRESS_REQUEST_CODE);
break;
case R.id.single_image_btn_crop_btn:
String cachePath = BoxingFileHelper.getCacheDir(this);
if (TextUtils.isEmpty(cachePath)) {
Toast.makeText(getApplicationContext(), R.string.boxing_storage_deny, Toast.LENGTH_SHORT).show();
return;
}
Uri destUri = new Uri.Builder().scheme("file").appendPath(cachePath).appendPath(String.format(Locale.US, "%s.png", System.currentTimeMillis())).build();
BoxingConfig singleCropImgConfig = new BoxingConfig(BoxingConfig.Mode.SINGLE_IMG).withCropOption(new BoxingCropOption(destUri)).withMediaPlaceHolderRes(R.drawable.ic_boxing_default_image);
Boxing.of(singleCropImgConfig).withIntent(this, BoxingActivity.class).start(this, REQUEST_CODE);
break;
case R.id.multi_image_btn:
BoxingConfig config = new BoxingConfig(BoxingConfig.Mode.MULTI_IMG).needCamera(R.drawable.ic_boxing_camera_white).needGif();
Boxing.of(config).withIntent(this, BoxingActivity.class).start(this, REQUEST_CODE);
break;
case R.id.video_btn:
BoxingConfig videoConfig = new BoxingConfig(BoxingConfig.Mode.VIDEO).withVideoDurationRes(R.drawable.ic_boxing_play);
Boxing.of(videoConfig).withIntent(this, BoxingActivity.class).start(this, REQUEST_CODE);
break;
case R.id.outside_bs_btn:
BoxingConfig bsConfig = new BoxingConfig(BoxingConfig.Mode.SINGLE_IMG);
Boxing.of(bsConfig).withIntent(this, BoxingBottomSheetActivity.class).start(this, REQUEST_CODE);
break;
default:
break;
}
}
use of com.bilibili.boxing.model.config.BoxingConfig in project boxing by Bilibili.
the class MediaItemLayoutTest method testMediaItemLayout.
@Test
public void testMediaItemLayout() {
MediaItemLayout layout = (MediaItemLayout) LayoutInflater.from(InstrumentationRegistry.getContext()).inflate(R.layout.layout_boxing_recycleview_item, null, false);
assertNotNull(layout);
BoxingManager.getInstance().setBoxingConfig(new BoxingConfig(BoxingConfig.Mode.VIDEO).withVideoDurationRes(R.drawable.ic_boxing_broken_image));
VideoMedia videoMedia = new VideoMedia.Builder("233", "233").build();
layout.setMedia(videoMedia);
View videoLayout = layout.findViewById(R.id.video_layout);
assertNotNull(videoLayout);
assertTrue(videoLayout.getVisibility() == View.VISIBLE);
layout.setChecked(true);
View fontLayout = layout.findViewById(R.id.media_font_layout);
assertNotNull(fontLayout);
assertTrue(fontLayout.getVisibility() == View.VISIBLE);
ImageView checkImg = (ImageView) layout.findViewById(R.id.media_item_check);
assertNotNull(checkImg);
assertTrue(checkImg.getVisibility() == View.VISIBLE);
layout.setChecked(false);
assertNotNull(fontLayout);
assertTrue(fontLayout.getVisibility() == View.GONE);
}
Aggregations