本文整理汇总了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;
}
}
示例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;
}
}
示例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);
}
示例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();
}
示例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);
}
}
}
示例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);
}
});
}
示例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();
}
}
}
示例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);
}
}
示例9: onBackPressed
@Override
public void onBackPressed() {
if (bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) {
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
return;
}
super.onBackPressed();
sLuhnCallback.onFinished(false);
}
示例10: onBackPressed
@Override
public void onBackPressed() {
switch (bottomSheetBehavior.getState()) {
case BottomSheetBehavior.STATE_EXPANDED:
hideBottomSheet();
break;
default:
super.onBackPressed();
}
}
示例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;
}
示例12: onBackPressed
@Override
public void onBackPressed() {
if (behavior.getState() == BottomSheetBehavior.STATE_EXPANDED)
behavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
else
super.onBackPressed();
}
示例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;
}
}
示例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);
}
示例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);
}