use of com.bilibili.boxing.model.config.BoxingConfig in project boxing by Bilibili.
the class MainActivity method onClick.
@Override
public void onClick(View v) {
int id = v.getId();
switch(id) {
case R.id.first_btn:
Intent intent1 = new Intent(MainActivity.this, FirstActivity.class);
startActivity(intent1);
break;
case R.id.second_btn:
BoxingConfig singleImgConfig = new BoxingConfig(BoxingConfig.Mode.SINGLE_IMG);
Boxing.of(singleImgConfig).withIntent(this, SecondActivity.class).start(this);
break;
default:
break;
}
}
use of com.bilibili.boxing.model.config.BoxingConfig in project boxing by Bilibili.
the class IntentFilterActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
// in DCIM/bili/boxing
String cropPath = BoxingFileHelper.getBoxingPathInDCIM();
if (TextUtils.isEmpty(cropPath)) {
Toast.makeText(getApplicationContext(), R.string.boxing_storage_deny, Toast.LENGTH_SHORT).show();
return;
}
Uri destUri = new Uri.Builder().scheme("file").appendPath(cropPath).appendPath(String.format(Locale.US, "%s.jpg", System.currentTimeMillis())).build();
BoxingConfig config = new BoxingConfig(BoxingConfig.Mode.SINGLE_IMG).needCamera(R.drawable.ic_boxing_camera_white).withCropOption(new BoxingCropOption(destUri));
BoxingManager.getInstance().setBoxingConfig(config);
super.onCreate(savedInstanceState);
}
use of com.bilibili.boxing.model.config.BoxingConfig in project boxing by Bilibili.
the class SecondActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second);
createToolbar();
findViewById(R.id.inside_bs_btn).setOnClickListener(this);
mResultImg = (ImageView) findViewById(R.id.media_result);
mResultImg.setOnClickListener(this);
mInsideBottomSheet = (FrameLayout) findViewById(R.id.content_layout);
BoxingBottomSheetFragment fragment = (BoxingBottomSheetFragment) getSupportFragmentManager().findFragmentByTag(BoxingBottomSheetFragment.TAG);
if (fragment == null) {
fragment = BoxingBottomSheetFragment.newInstance();
getSupportFragmentManager().beginTransaction().add(R.id.content_layout, fragment, BoxingBottomSheetFragment.TAG).commit();
BoxingConfig singleImgConfig = new BoxingConfig(BoxingConfig.Mode.SINGLE_IMG).withMediaPlaceHolderRes(R.drawable.ic_boxing_default_image).withAlbumPlaceHolderRes(R.drawable.ic_boxing_default_image);
Boxing.of(singleImgConfig).setupFragment(fragment, new Boxing.OnBoxingFinishListener() {
@Override
public void onBoxingFinish(Intent intent, List<BaseMedia> medias) {
BottomSheetBehavior behavior = BottomSheetBehavior.from(mInsideBottomSheet);
behavior.setState(BottomSheetBehavior.STATE_HIDDEN);
if (medias != null && medias.size() > 0) {
BaseMedia media = mMedia = medias.get(0);
String path = media.getPath();
BoxingMediaLoader.getInstance().displayRaw(mResultImg, path, 1080, 720, null);
}
}
});
} else {
fragment.setPresenter(new PickerPresenter(fragment));
}
}
use of com.bilibili.boxing.model.config.BoxingConfig in project boxing by Bilibili.
the class AbsBoxingViewFragment method initCameraPhotoPicker.
private void initCameraPhotoPicker(Bundle savedInstanceState) {
BoxingConfig config = BoxingManager.getInstance().getBoxingConfig();
if (config == null || !config.isNeedCamera()) {
return;
}
mCameraPicker = new CameraPickerHelper(savedInstanceState);
mCameraPicker.setPickCallback(new CameraListener(this));
}
use of com.bilibili.boxing.model.config.BoxingConfig in project boxing by Bilibili.
the class AbsBoxingViewActivity method onCreate.
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
BoxingConfig config;
if (savedInstanceState != null) {
config = savedInstanceState.getParcelable(Boxing.EXTRA_CONFIG);
} else {
config = BoxingManager.getInstance().getBoxingConfig();
}
setPickerConfig(config);
parseSelectedMedias(savedInstanceState, getIntent());
setPresenter(new PickerPresenter(this));
}
Aggregations