當前位置: 首頁>>代碼示例>>Java>>正文


Java BottomSheetBehavior.STATE_COLLAPSED屬性代碼示例

本文整理匯總了Java中android.support.design.widget.BottomSheetBehavior.STATE_COLLAPSED屬性的典型用法代碼示例。如果您正苦於以下問題:Java BottomSheetBehavior.STATE_COLLAPSED屬性的具體用法?Java BottomSheetBehavior.STATE_COLLAPSED怎麽用?Java BottomSheetBehavior.STATE_COLLAPSED使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.support.design.widget.BottomSheetBehavior的用法示例。


在下文中一共展示了BottomSheetBehavior.STATE_COLLAPSED屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onStateChanged

@Override
public void onStateChanged(@NonNull View bottomSheet, int newState) {
    switch (newState) {
        case BottomSheetBehavior.STATE_HIDDEN: {
            LogUtils.d("Bottom sheet hidden to dismiss");
            dismiss();
            break;
        }
        case BottomSheetBehavior.STATE_EXPANDED: {
            LogUtils.d("expanded");
            break;
        }
        case BottomSheetBehavior.STATE_COLLAPSED: {
            LogUtils.d("collapsed");
            break;
        }

    }

}
 
開發者ID:mengdd,項目名稱:TodoRealm,代碼行數:20,代碼來源:AddListDialogFragment.java

示例2: onClick

@Override
public void onClick(View view) {
    switch (view.getId()) {
        case R.id.btn_dashboard_daily:
            setSelectedStatistics(DCConstants.DCStatisticsType.DAILY);
            break;
        case R.id.btn_dashboard_weekly:
            setSelectedStatistics(DCConstants.DCStatisticsType.WEEKLY);
            break;
        case R.id.btn_dashboard_monthly:
            setSelectedStatistics(DCConstants.DCStatisticsType.MONTHLY);
            break;
        case R.id.btn_dashboard_record:
            toggleRecording();
            break;
        case R.id.rl_dashboard_arrow_holder:
            if (bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_COLLAPSED) {
                bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
            }
            else if (bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) {
                bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
            }
            break;
    }
}
 
開發者ID:Dentacoin,項目名稱:aftercare-app-android,代碼行數:25,代碼來源:DCDashboardFragment.java

示例3: onClick

@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.btn_bottom_dialog_control:
            if (mBottomSheetDialog.isShowing()) {
                mBottomSheetDialog.dismiss();
            } else {
                mBottomSheetDialog.show();
            }
            break;
        case R.id.btn_bottom_sheet_control:
            //如果當前是收縮狀態,變為延展狀態;反之亦然

            if (mBottomSheetBehavior.getState() == BottomSheetBehavior.STATE_COLLAPSED) {
                mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
            } else if (mBottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) {
                mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
            }
            break;
        default:
            break;
    }
}
 
開發者ID:Pingsh,項目名稱:Mix,代碼行數:23,代碼來源:BottomSheetActivity.java

示例4: 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;
    }
}
 
開發者ID:zuoni1018,項目名稱:CoordinatorLayoutExample-master,代碼行數:20,代碼來源:BottomSheetActivity.java

示例5: 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

示例6: onClick

@Override
public void onClick(View view) {
    switch (view.getId()){
        case R.id.theme_selected :
        case R.id.fab:
            // change the state of the bottom sheet
            switch (mBottomSheetBehavior.getState()){
                case BottomSheetBehavior.STATE_HIDDEN :
                    mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
                    break;

                case BottomSheetBehavior.STATE_COLLAPSED :
                    mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
                    break;

                case BottomSheetBehavior.STATE_EXPANDED :
                    mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
                    break;
            }
            break;
    }
}
 
開發者ID:pkjvit,項目名稱:Android-Multi-Theme-UI,代碼行數:22,代碼來源:ScrollingActivity.java

示例7: 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

示例8: collapseBottomSheet

private boolean collapseBottomSheet() {
    if (mBehavior != null && mBehavior.getState() != BottomSheetBehavior.STATE_COLLAPSED) {
        mBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
        return true;
    }
    return false;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:7,代碼來源:BoxingBottomSheetActivity.java

示例9: 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

示例10: onClick

@Override
public void onClick(View v) {
    switch (bottomSheetBehavior.getState()) {
        case BottomSheetBehavior.STATE_COLLAPSED:
            bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
            break;
        case BottomSheetBehavior.STATE_EXPANDED:
            bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
            break;
    }
}
 
開發者ID:wax911,項目名稱:anitrend-app,代碼行數:11,代碼來源:BottomSheetEmoticon.java

示例11: onClick

@OnClick({R.id.sheet_state, R.id.sheet_positive, R.id.sheet_negative})
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.sheet_positive:
            if(result == null)
                result = text;
            if(subject != null)
                mCallback.onPositive(bottomSheetBehavior, String.format("%s %s", result, subject));
            else
                mCallback.onPositive(bottomSheetBehavior, result);
            break;
        case R.id.sheet_negative:
            mCallback.onNegative(bottomSheetBehavior);
            break;
        case R.id.sheet_state:
            switch (bottomSheetBehavior.getState()) {
                case BottomSheetBehavior.STATE_COLLAPSED:
                    bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
                    break;
                case BottomSheetBehavior.STATE_EXPANDED:
                    bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
                    break;
            }
            break;
    }
}
 
開發者ID:wax911,項目名稱:anitrend-app,代碼行數:27,代碼來源:BottomSheetShare.java

示例12: onClick

@Override
public void onClick(View v) {

    if (bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_COLLAPSED) {
        bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
    } else {
        bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
    }
}
 
開發者ID:byvlstr,項目名稱:fluentAppBar,代碼行數:9,代碼來源:FluentAppBar.java

示例13: onStateChanged

@Override
public void onStateChanged(@NonNull View bottomSheet, int newState) {
    if (fluentAppBarType == CLICK_FLUENT) {
        if (newState == BottomSheetBehavior.STATE_EXPANDED) {
            handleShowFluentBlur();
        } else if (newState == BottomSheetBehavior.STATE_COLLAPSED) {
            BlurView blurView = (BlurView) findViewById(R.id.blurview);
            blurView.setBlurEnabled(false);
            setBackgroundColor(backgroundColour);
        }
    }
}
 
開發者ID:byvlstr,項目名稱:fluentAppBar,代碼行數:12,代碼來源:FluentAppBar.java

示例14: onBackPressed

@Override
public boolean onBackPressed() {
    boolean handled = false;
    if(mBottomSheetBehavior.getState() != BottomSheetBehavior.STATE_COLLAPSED){
        mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
        handled = true;
    }
    return handled;
}
 
開發者ID:dvdciri,項目名稱:DeepImagePreview-Project,代碼行數:9,代碼來源:ScanFragment.java

示例15: 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


注:本文中的android.support.design.widget.BottomSheetBehavior.STATE_COLLAPSED屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。