当前位置: 首页>>代码示例>>Java>>正文


Java BottomSheetBehavior.STATE_EXPANDED属性代码示例

本文整理汇总了Java中android.support.design.widget.BottomSheetBehavior.STATE_EXPANDED属性的典型用法代码示例。如果您正苦于以下问题:Java BottomSheetBehavior.STATE_EXPANDED属性的具体用法?Java BottomSheetBehavior.STATE_EXPANDED怎么用?Java BottomSheetBehavior.STATE_EXPANDED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.support.design.widget.BottomSheetBehavior的用法示例。


在下文中一共展示了BottomSheetBehavior.STATE_EXPANDED属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onClick

@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.btnBehavior:
            int state = behavior.getState();
            if (state == BottomSheetBehavior.STATE_EXPANDED) {
                behavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
            } else if(state == BottomSheetBehavior.STATE_COLLAPSED){
                behavior.setState(BottomSheetBehavior.STATE_HIDDEN);
            }else if(state == BottomSheetBehavior.STATE_HIDDEN){
                behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
            }
            break;
        case R.id.btnDialog:
            BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this);
            bottomSheetDialog.setContentView(R.layout.include_bottom_sheet_layout);
            bottomSheetDialog.show();
            break;
        case R.id.btn_baidumap:
            readyGo(BaiduMapSample.class);
            break;
    }
}
 
开发者ID:zuoni1018,项目名称:CoordinatorLayoutExample-master,代码行数:23,代码来源:BottomSheetActivity.java

示例2: toggleBottomSheet

private static void toggleBottomSheet(View bottomSheet) {

        BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from(bottomSheet);

        int state = bottomSheetBehavior.getState();

        switch (state) {
            case BottomSheetBehavior.STATE_COLLAPSED:
                bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
                break;
            case BottomSheetBehavior.STATE_HIDDEN:
                bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
                break;
            case BottomSheetBehavior.STATE_EXPANDED:
                bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
                break;

        }
    }
 
开发者ID:enricocid,项目名称:Gallery-example,代码行数:19,代码来源:BottomSheetMediaActions.java

示例3: onStart

@Override
public void onStart() {
    super.onStart();
    mState.setOnClickListener(this);

    if(negative == 0)
        mNegative.setVisibility(View.GONE);
    else {
        mNegative.setOnClickListener(this);
        mNegative.setText(negative);
    }

    if(positive == 0)
        mPositive.setVisibility(View.GONE);
    else {
        mPositive.setOnClickListener(this);
        mPositive.setText(positive);
    }

    mTitle.setText(title);
    mText.setMovementMethod(LinkMovementMethod.getInstance());
    mText.setText(Html.fromHtml(getString(text)));
    if(bottomSheetBehavior.getState() != BottomSheetBehavior.STATE_EXPANDED)
        bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
}
 
开发者ID:wax911,项目名称:anitrend-app,代码行数:25,代码来源:BottomSheetMessage.java

示例4: onBackPressed

/**
 * Take care of popping the fragment back stack or finishing the activity
 * as appropriate.
 */
@Override
public void onBackPressed() {
    if(mBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED)
        mBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
    else if(editText.hasFocus())
        editText.clearFocus();
    else if(!isClosing) {
        isClosing = true;
        mPresenter.createSuperToast(ComposerActivity.this,
                getString(R.string.text_confirm_exit),
                R.drawable.ic_info_outline_white_18dp,
                Style.TYPE_STANDARD, Style.DURATION_MEDIUM,
                PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_TEAL));
    }
    else
        super.onBackPressed();
}
 
开发者ID:wax911,项目名称:anitrend-app,代码行数:21,代码来源:ComposerActivity.java

示例5: showFragment

private void showFragment() {
    if (mInsideBottomSheet != null) {
        BottomSheetBehavior behavior = BottomSheetBehavior.from(mInsideBottomSheet);
        if (behavior.getState() != BottomSheetBehavior.STATE_EXPANDED) {
            behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
        } else {
            behavior.setState(BottomSheetBehavior.STATE_HIDDEN);
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:SecondActivity.java

示例6: initGestureDetector

private void initGestureDetector() {
    //这里使用的是界面手势识别器,可以识别界面的单击事件,来给Behavior设置相应的属性来控制隐藏.
    mGestureDetector = new GestureDetector(MainActivity.this,
            new GestureDetector.SimpleOnGestureListener(){
                //处理单击事件 -- 控制面板的显示or隐藏
                @Override
                public boolean onSingleTapConfirmed(MotionEvent e) {
                    if (mBottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED){
                        mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
                        return true;
                    }
                    return super.onSingleTapConfirmed(e);
                }
            });
}
 
开发者ID:AweiLoveAndroid,项目名称:BottomSheetDialogDemo,代码行数:15,代码来源:MainActivity.java

示例7: onBackPressed

@Override
public void onBackPressed() {
    if (mMainFragment.mSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) {
        mMainFragment.mSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
    } else {
        if ((System.currentTimeMillis() - exitTime) > 3000) {
            Toast.makeText(this, getString(R.string.quit_again), Toast.LENGTH_SHORT).show();
            exitTime = System.currentTimeMillis();
        } else {
            super.onBackPressed();
        }
    }
}
 
开发者ID:XYScience,项目名称:StopApp,代码行数:13,代码来源:MainActivity.java

示例8: getRefresh

@OnClick(R.id.animation_refresh)
public void getRefresh(){
    if(!isInternetConnected()) {
        Toast.makeText(getContext(), "به اینترنت متصل نیستید :(", Toast.LENGTH_SHORT).show();
        return;
    }
    if (lAnimation.isAnimating() || mBottomSheetBehavior.getState()==BottomSheetBehavior.STATE_EXPANDED){
        return;
    }
    if(chanceFromPreference > 0) {
        lAnimation.playAnimation();
        setChanceCounterText(chanceFromPreference);
    }
}
 
开发者ID:01sadra,项目名称:Detoxiom,代码行数:14,代码来源:NewQuoteFragment.java

示例9: onBackPressed

@Override
public void onBackPressed() {
    if (bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) {
        bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
        return;
    }
    super.onBackPressed();
    sLuhnCallback.onFinished(false);
}
 
开发者ID:KingsMentor,项目名称:Luhn,代码行数:9,代码来源:Luhn.java

示例10: onBackPressed

@Override
public void onBackPressed() {
    switch (bottomSheetBehavior.getState()) {
        case BottomSheetBehavior.STATE_EXPANDED:
            hideBottomSheet();
            break;
        default:
            super.onBackPressed();
    }
}
 
开发者ID:vicky7230,项目名称:Paprika,代码行数:10,代码来源:HomeActivity.java

示例11: collapseBottomSheet

@Override
public boolean collapseBottomSheet() {
    if (BottomSheetBehavior.from(contactBottomSheet).getState() == BottomSheetBehavior.STATE_EXPANDED) {
        BottomSheetBehavior.from(contactBottomSheet).setState(BottomSheetBehavior.STATE_COLLAPSED);
        return true;
    }
    return false;
}
 
开发者ID:Nulltilus,项目名称:Appmatic-Android,代码行数:8,代码来源:ContactFragment.java

示例12: onBackPressed

@Override
public void onBackPressed() {
    if (behavior.getState() == BottomSheetBehavior.STATE_EXPANDED)
        behavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
    else
        super.onBackPressed();
}
 
开发者ID:lanyuanxiaoyao,项目名称:PicKing,代码行数:7,代码来源:PicDialog.java

示例13: onStateChanged

@Override
public void onStateChanged(@NonNull View bottomSheet, int newState) {
    if(isVisible() && !isDetached() || !isRemoving())
        switch (newState) {
            case BottomSheetBehavior.STATE_HIDDEN:
                dismiss();
                break;
            case BottomSheetBehavior.STATE_COLLAPSED:
                mSheetStateChangeListener.onStateCollapsed();
                break;
            case BottomSheetBehavior.STATE_EXPANDED:
                mSheetStateChangeListener.onStateExpanded();
                break;
        }
}
 
开发者ID:wax911,项目名称:anitrend-app,代码行数:15,代码来源:BottomSheet.java

示例14: dispatchTouchEvent

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
    if (drawerOpen) {
        return super.dispatchTouchEvent(ev);
    }

    switch (ev.getAction()) {
        case MotionEvent.ACTION_DOWN:
            down_y = ev.getY();
            break;
        case MotionEvent.ACTION_UP:
            if (ev.getY() - down_y > 20) {
                if (mBottomSheetBehavior.getState() != BottomSheetBehavior.STATE_EXPANDED)
                    mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
            }
            if (ev.getY() - down_y < -150) {
                if (mBottomSheetBehavior.getState() != BottomSheetBehavior.STATE_COLLAPSED)
                    mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
            }
            break;
        case MotionEvent.ACTION_MOVE:
            if (ev.getY() - down_y > 20) {
                mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
            }
            if (ev.getY() - down_y < -150) {
                mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
            }
            break;
    }

    return super.dispatchTouchEvent(ev);
}
 
开发者ID:haihaio,项目名称:AmenEye,代码行数:32,代码来源:MainActivity.java

示例15: onStart

@Override
public void onStart() {
    super.onStart();
    // Create an ArrayAdapter using the string array and a default spinner layout
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getContext(), R.array.post_share_types, R.layout.adapter_spinner_item);
    // Specify the layout to use when the list of choices appears
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    // Apply the adapter to the spinner
    mContentType.setAdapter(adapter);

    mContentType.setOnItemSelectedListener(this);
    if(bottomSheetBehavior.getState() != BottomSheetBehavior.STATE_EXPANDED)
        bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
}
 
开发者ID:wax911,项目名称:anitrend-app,代码行数:14,代码来源:BottomSheetShare.java


注:本文中的android.support.design.widget.BottomSheetBehavior.STATE_EXPANDED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。