Search in sources :

Example 1 with BoxingBottomSheetFragment

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);
                }
            }
        });
    }
}
Also used : BoxingBottomSheetFragment(com.bilibili.boxing_impl.ui.BoxingBottomSheetFragment) BottomSheetBehavior(android.support.design.widget.BottomSheetBehavior) Boxing(com.bilibili.boxing.Boxing) BoxingConfig(com.bilibili.boxing.model.config.BoxingConfig) Intent(android.content.Intent) BaseMedia(com.bilibili.boxing.model.entity.BaseMedia)

Aggregations

Intent (android.content.Intent)1 BottomSheetBehavior (android.support.design.widget.BottomSheetBehavior)1 Boxing (com.bilibili.boxing.Boxing)1 BoxingConfig (com.bilibili.boxing.model.config.BoxingConfig)1 BaseMedia (com.bilibili.boxing.model.entity.BaseMedia)1 BoxingBottomSheetFragment (com.bilibili.boxing_impl.ui.BoxingBottomSheetFragment)1