use of com.bilibili.boxing_impl.ui.BoxingBottomSheetFragment 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);
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, null);
}
}
});
}
}
Aggregations