Search in sources :

Example 16 with BottomSheetBehavior

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));
    }
}
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) PickerPresenter(com.bilibili.boxing.presenter.PickerPresenter)

Example 17 with BottomSheetBehavior

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;
}
Also used : BottomSheetDialog(android.support.design.widget.BottomSheetDialog) BottomSheetBehavior(android.support.design.widget.BottomSheetBehavior) DialogInterface(android.content.DialogInterface) FrameLayout(android.widget.FrameLayout) NonNull(android.support.annotation.NonNull)

Aggregations

BottomSheetBehavior (android.support.design.widget.BottomSheetBehavior)17 View (android.view.View)14 CoordinatorLayout (android.support.design.widget.CoordinatorLayout)9 TextView (android.widget.TextView)7 DialogInterface (android.content.DialogInterface)4 ImageView (android.widget.ImageView)4 Dialog (android.app.Dialog)3 RecyclerView (android.support.v7.widget.RecyclerView)3 NestedScrollView (android.support.v4.widget.NestedScrollView)2 AlertDialog (android.support.v7.app.AlertDialog)2 GridLayoutManager (android.support.v7.widget.GridLayoutManager)2 CompoundButton (android.widget.CompoundButton)2 EditText (android.widget.EditText)2 BindView (butterknife.BindView)2 SpringViewAnimatorManager (io.codetail.animation.SpringViewAnimatorManager)2 ViewRevealManager (io.codetail.animation.ViewRevealManager)2 File (java.io.File)2 AlertDialog (android.app.AlertDialog)1 Intent (android.content.Intent)1 Point (android.graphics.Point)1