Java Code Examples for com.google.android.material.bottomsheet.BottomSheetBehavior#setState()
The following examples show how to use
com.google.android.material.bottomsheet.BottomSheetBehavior#setState() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestRecyclerViewInNestedScrollViewActivity.java From SmoothRefreshLayout with MIT License | 6 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed(); return true; case Menu.FIRST: LinearLayout linearLayout = findViewById(R.id.linearLayout_test_recyclerView_in_nestedScrollView); BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from(linearLayout); if (bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) { bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED); } else { bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); } return true; default: return super.onOptionsItemSelected(item); } }
Example 2
Source File: TestRecyclerViewInNestedScrollViewInSrlActivity.java From SmoothRefreshLayout with MIT License | 6 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed(); return true; case Menu.FIRST: LinearLayout linearLayout = findViewById(R.id.linearLayout_test_recyclerView_in_nestedScrollView); BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from(linearLayout); if (bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) { bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED); } else { bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); } return true; default: return super.onOptionsItemSelected(item); } }
Example 3
Source File: ThreadListFragment.java From hipda with GNU General Public License v2.0 | 6 votes |
private void showThreadListSettingsDialog() { final LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View view = inflater.inflate(R.layout.dialog_thread_list_settings, null); final ValueChagerView valueChagerView = view.findViewById(R.id.value_changer); valueChagerView.setCurrentValue(HiSettingsHelper.getInstance().getTitleTextSizeAdj()); final BottomSheetDialog dialog = new BottomDialog(getActivity()); valueChagerView.setOnChangeListener(new ValueChagerView.OnChangeListener() { @Override public void onChange(int currentValue) { HiSettingsHelper.getInstance().setTitleTextSizeAdj(currentValue); if (mThreadListAdapter != null) mThreadListAdapter.notifyDataSetChanged(); } }); dialog.setContentView(view); BottomSheetBehavior mBehavior = BottomSheetBehavior.from((View) view.getParent()); mBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); dialog.show(); }
Example 4
Source File: RoundedBottomSheetDialogFragment.java From zephyr with MIT License | 5 votes |
public void onShow(DialogInterface dialog) { BottomSheetDialog d = (BottomSheetDialog) dialog; FrameLayout bottomSheet = d.findViewById(com.google.android.material.R.id.design_bottom_sheet); if (bottomSheet != null) { BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from(bottomSheet); bottomSheetBehavior.setSkipCollapsed(shouldSkipCollapsedState()); bottomSheetBehavior.setState(getInitialBottomSheetState()); } }
Example 5
Source File: BaseLibraryActivity.java From Jockey with Apache License 2.0 | 5 votes |
@Override public void onBackPressed() { BottomSheetBehavior<View> bottomSheet = BottomSheetBehavior.from(mBinding.miniplayerHolder); if (bottomSheet.getState() == BottomSheetBehavior.STATE_EXPANDED) { bottomSheet.setState(BottomSheetBehavior.STATE_COLLAPSED); } else { super.onBackPressed(); } }
Example 6
Source File: BaseLibraryActivityViewModel.java From Jockey with Apache License 2.0 | 5 votes |
@Bindable public View.OnClickListener getMiniplayerClickListener() { return v -> { View bottomSheet = (View) v.getParent(); BottomSheetBehavior<View> behavior = BottomSheetBehavior.from(bottomSheet); behavior.setState(BottomSheetBehavior.STATE_EXPANDED); }; }
Example 7
Source File: BottomSheetBindingAdapter.java From deagle with Apache License 2.0 | 5 votes |
@BindingAdapter("behavior_state") public static void setBottomSheetState(final View view, final @BottomSheetBehavior.State int state) { final BottomSheetBehavior<View> behavior = BottomSheetBehavior.from(view); if (behavior == null) return; try { behavior.setState(state); } catch (final RuntimeException e) { new Handler().post(new Runnable() { @Override public void run() { try { behavior.setState(state); } catch (final RuntimeException ignored) {} }}); } }
Example 8
Source File: BaseModalBottomSheet.java From CommonUtils with Apache License 2.0 | 4 votes |
@CallSuper protected void attachedBehavior(@NonNull Context context, @NonNull BottomSheetBehavior<?> behavior) { behavior.setPeekHeight(getPeekHeight()); behavior.setState(BottomSheetBehavior.STATE_COLLAPSED); prepareCollapsed(); }
Example 9
Source File: BaseBottomSheetDialogFragment.java From SAI with GNU General Public License v3.0 | 4 votes |
protected void revealBottomSheet() { FrameLayout bottomSheet = mDialog.findViewById(R.id.design_bottom_sheet); BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from(bottomSheet); bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); }
Example 10
Source File: BaseLibraryActivity.java From Jockey with Apache License 2.0 | 4 votes |
public void expandBottomSheet() { BottomSheetBehavior<View> bottomSheet = BottomSheetBehavior.from(mBinding.miniplayerHolder); bottomSheet.setState(BottomSheetBehavior.STATE_EXPANDED); }