use of com.bilibili.boxing.model.config.BoxingConfig in project boxing by Bilibili.
the class ConfigTest method testCameraRes.
@Test
public void testCameraRes() {
mPickerManager.setBoxingConfig(new BoxingConfig(BoxingConfig.Mode.MULTI_IMG));
BoxingConfig config = mPickerManager.getBoxingConfig();
assertEquals(config.getCameraRes(), 0);
assertEquals(BoxingResHelper.getCameraRes(), 0);
mPickerManager.setBoxingConfig(new BoxingConfig(BoxingConfig.Mode.MULTI_IMG).needCamera(R.drawable.ic_boxing_broken_image));
config = mPickerManager.getBoxingConfig();
assertEquals(config.getCameraRes(), R.drawable.ic_boxing_broken_image);
assertEquals(BoxingResHelper.getCameraRes(), R.drawable.ic_boxing_broken_image);
}
use of com.bilibili.boxing.model.config.BoxingConfig in project boxing by Bilibili.
the class Boxing method get.
/**
* call {@link #of(BoxingConfig)} first to specify the mode otherwise {@link BoxingConfig.Mode#MULTI_IMG} is used.<br/>
*/
public static Boxing get() {
BoxingConfig config = BoxingManager.getInstance().getBoxingConfig();
if (config == null) {
config = new BoxingConfig(BoxingConfig.Mode.MULTI_IMG).needGif();
BoxingManager.getInstance().setBoxingConfig(config);
}
return new Boxing(config);
}
use of com.bilibili.boxing.model.config.BoxingConfig 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);
}
use of com.bilibili.boxing.model.config.BoxingConfig in project boxing by Bilibili.
the class PickerActivityTest method testCreateCustomIntent.
@Test
public void testCreateCustomIntent() {
BoxingConfig pickerConfig = new BoxingConfig(BoxingConfig.Mode.MULTI_IMG).needCamera(R.drawable.ic_boxing_broken_image);
Uri destUri = new Uri.Builder().scheme("file").appendPath("test").appendPath(String.format(Locale.US, "%s.jpg", System.currentTimeMillis())).build();
BoxingCropOption cropOptions = new BoxingCropOption(destUri);
ArrayList<ImageMedia> medias = new ArrayList<>();
medias.add(new ImageMedia("test", "test"));
medias.add(new ImageMedia("test1", "test1"));
pickerConfig.withCropOption(cropOptions);
Intent intent = Boxing.of(pickerConfig).withIntent(mContext, BoxingActivity.class, medias).getIntent();
assertNotNull(intent);
BoxingConfig config = BoxingManager.getInstance().getBoxingConfig();
assertNotNull(config);
assertEquals(config.getMode(), BoxingConfig.Mode.MULTI_IMG);
assertEquals(config.isNeedCamera(), true);
assertEquals(config.isNeedGif(), false);
BoxingCropOption cropOptionsResult = pickerConfig.getCropOption();
assertEquals(cropOptions, cropOptionsResult);
ArrayList<BaseMedia> list = intent.getParcelableArrayListExtra(Boxing.EXTRA_SELECTED_MEDIA);
assertEquals(list, medias);
}
use of com.bilibili.boxing.model.config.BoxingConfig in project boxing by Bilibili.
the class TestBlankActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_boxing);
BoxingMediaLoader.getInstance().init(new IBoxingMediaLoader() {
@Override
public void displayThumbnail(@NonNull ImageView img, @NonNull String absPath, int width, int height) {
}
@Override
public void displayRaw(@NonNull ImageView img, @NonNull String absPath, int width, int height, IBoxingCallback callback) {
}
});
BoxingViewFragment fragment = BoxingViewFragment.newInstance();
fragment.setTitleTxt((TextView) findViewById(R.id.pick_album_txt));
fragment.setPresenter(new PickerPresenter(fragment));
fragment.setPickerConfig(new BoxingConfig(BoxingConfig.Mode.MULTI_IMG));
final FragmentManager manager = getSupportFragmentManager();
manager.beginTransaction().add(R.id.content_layout, fragment).commit();
}
Aggregations