use of android.support.design.widget.BottomSheetBehavior 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 android.support.design.widget.BottomSheetBehavior in project mapbox-navigation-android by mapbox.
the class FeedbackBottomSheet method onCreateDialog.
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
BottomSheetDialog dialog = (BottomSheetDialog) super.onCreateDialog(savedInstanceState);
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
BottomSheetDialog bottomSheetDialog = (BottomSheetDialog) dialog;
FrameLayout bottomSheet = bottomSheetDialog.findViewById(android.support.design.R.id.design_bottom_sheet);
if (bottomSheet != null) {
BottomSheetBehavior<FrameLayout> behavior = BottomSheetBehavior.from(bottomSheet);
behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
behavior.setSkipCollapsed(true);
}
}
});
return dialog;
}
Aggregations