本文整理匯總了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);
}