當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。