Java Code Examples for com.google.android.material.bottomsheet.BottomSheetDialog#show()
The following examples show how to use
com.google.android.material.bottomsheet.BottomSheetDialog#show() .
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: ChatFragment.java From Twire with GNU General Public License v3.0 | 7 votes |
@Override public void onMessageClicked(SpannableStringBuilder formattedMessage, final String userName, final String message) { View v = LayoutInflater.from(getContext()).inflate(R.layout.chat_message_options, null); bottomSheetDialog = new BottomSheetDialog(getContext()); bottomSheetDialog.setContentView(v); final BottomSheetBehavior behavior = BottomSheetBehavior.from((View) v.getParent()); behavior.setPeekHeight(getContext().getResources().getDisplayMetrics().heightPixels / 3); bottomSheetDialog.setOnDismissListener(dialogInterface -> behavior.setState(BottomSheetBehavior.STATE_COLLAPSED)); TextView mMessage = v.findViewById(R.id.text_chat_message); TextView mMention = v.findViewById(R.id.text_mention); TextView mDuplicateMessage = v.findViewById(R.id.text_duplicate_message); mMessage.setText(formattedMessage); mMention.setOnClickListener(view -> { insertSendText("@" + userName); bottomSheetDialog.dismiss(); }); mDuplicateMessage.setOnClickListener(view -> { insertSendText(message); bottomSheetDialog.dismiss(); }); bottomSheetDialog.show(); }
Example 2
Source File: ChatFragment.java From Pocket-Plays-for-Twitch with GNU General Public License v3.0 | 6 votes |
@Override public void onMessageClicked(SpannableStringBuilder formattedMessage, final String userName, final String message) { View v = LayoutInflater.from(getContext()).inflate(R.layout.chat_message_options, null); final BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(getContext()); bottomSheetDialog.setContentView(v); final BottomSheetBehavior behavior = BottomSheetBehavior.from((View) v.getParent()); behavior.setPeekHeight(getContext().getResources().getDisplayMetrics().heightPixels/3); bottomSheetDialog.setOnDismissListener(dialogInterface -> behavior.setState(BottomSheetBehavior.STATE_COLLAPSED)); TextView mMessage = v.findViewById(R.id.text_chat_message); TextView mMention = v.findViewById(R.id.text_mention); TextView mDuplicateMessage = v.findViewById(R.id.text_duplicate_message); mMessage.setText(formattedMessage); mMention.setOnClickListener(view -> { insertSendText("@" + userName); bottomSheetDialog.dismiss(); }); mDuplicateMessage.setOnClickListener(view -> { insertSendText(message); bottomSheetDialog.dismiss(); }); bottomSheetDialog.show(); }
Example 3
Source File: BottomSheetDialogActivity.java From AndroidAnimationExercise with Apache License 2.0 | 6 votes |
private void showBSDialog() { final BottomSheetDialog dialog = new BottomSheetDialog(this); View view = LayoutInflater.from(this).inflate(R.layout.dialog_layout, null); RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.bs_rv); recyclerView.setLayoutManager(new LinearLayoutManager(this)); SimpleStringRecyclerViewAdapter adapter = new SimpleStringRecyclerViewAdapter(this); adapter.setItemClickListener(new SimpleStringRecyclerViewAdapter.ItemClickListener() { @Override public void onItemClick(int pos) { dialog.dismiss(); Toast.makeText(BottomSheetDialogActivity.this, "pos--->" + pos, Toast.LENGTH_LONG).show(); } }); recyclerView.setAdapter(adapter); dialog.setContentView(view); dialog.show(); }
Example 4
Source File: ObservationFeedFragment.java From mage-android with Apache License 2.0 | 6 votes |
public void onObservationImportant(Observation observation) { ObservationImportant important = observation.getImportant(); boolean isImportant = important != null && important.isImportant(); if (isImportant) { BottomSheetDialog dialog = new BottomSheetDialog(requireActivity()); View view = getLayoutInflater().inflate(R.layout.view_important_bottom_sheet, null); view.findViewById(R.id.update_button).setOnClickListener(v -> { onUpdateImportantClick(observation); dialog.dismiss(); }); view.findViewById(R.id.remove_button).setOnClickListener(v -> { onRemoveImportantClick(observation); dialog.dismiss(); }); dialog.setContentView(view); dialog.show(); } else { onUpdateImportantClick(observation); } }
Example 5
Source File: ObservationViewActivity.java From mage-android with Apache License 2.0 | 6 votes |
private void onImportantClick() { ObservationImportant important = o.getImportant(); boolean isImportant = important != null && important.isImportant(); if (isImportant) { BottomSheetDialog dialog = new BottomSheetDialog(this); View view = getLayoutInflater().inflate(R.layout.view_important_bottom_sheet, null); view.findViewById(R.id.update_button).setOnClickListener(v -> { onUpdateImportantClick(); dialog.dismiss(); }); view.findViewById(R.id.remove_button).setOnClickListener(v -> { onRemoveImportantClick(); dialog.dismiss(); }); dialog.setContentView(view); dialog.show(); } else { onUpdateImportantClick(); } }
Example 6
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 7
Source File: EditObservationFragment.java From ground-android with Apache License 2.0 | 5 votes |
private void onShowPhotoSelectorDialog(Field field) { EditObservationBottomSheetBinding addPhotoBottomSheetBinding = EditObservationBottomSheetBinding.inflate(getLayoutInflater()); addPhotoBottomSheetBinding.setViewModel(viewModel); addPhotoBottomSheetBinding.setField(field); BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(getContext()); bottomSheetDialog.setContentView(addPhotoBottomSheetBinding.getRoot()); bottomSheetDialog.setCancelable(true); bottomSheetDialog.show(); AddPhotoDialogAdapter.ItemClickListener listener = type -> { bottomSheetDialog.dismiss(); switch (type) { case PHOTO_SOURCE_CAMERA: viewModel.showPhotoCapture(field); break; case PHOTO_SOURCE_STORAGE: viewModel.showPhotoSelector(field); break; default: throw new IllegalArgumentException("Unknown type: " + type); } }; RecyclerView recyclerView = addPhotoBottomSheetBinding.recyclerView; recyclerView.setHasFixedSize(true); recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); recyclerView.setAdapter(new AddPhotoDialogAdapter(listener)); }
Example 8
Source File: LauncherActivity.java From HgLauncher with GNU General Public License v3.0 | 5 votes |
public void showStartDialog() { DialogStartHintBinding binding = DialogStartHintBinding.inflate(getLayoutInflater()); final BottomSheetDialog startDialog = new BottomSheetDialog(this); startDialog.setContentView(binding.getRoot()); startDialog.setCancelable(false); startDialog.getBehavior().setState(BottomSheetBehavior.STATE_EXPANDED); Button startDismiss = binding.dismiss; startDismiss.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startDialog.dismiss(); PreferenceHelper.update("is_new_user", false); } }); startDialog.show(); }
Example 9
Source File: ContainerTransformConfigurationHelper.java From material-components-android with Apache License 2.0 | 5 votes |
/** * Show configuration chooser associated with a container transform from {@link * TransitionContainerTransformDemoFragment}. */ void showConfigurationChooser(Context context, @Nullable OnDismissListener onDismissListener) { BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(context); bottomSheetDialog.setContentView( createConfigurationBottomSheetView(context, bottomSheetDialog)); bottomSheetDialog.setOnDismissListener(onDismissListener); bottomSheetDialog.show(); }
Example 10
Source File: LauncherActivity.java From HgLauncher with GNU General Public License v3.0 | 5 votes |
public void showStartDialog() { DialogStartHintBinding binding = DialogStartHintBinding.inflate(getLayoutInflater()); final BottomSheetDialog startDialog = new BottomSheetDialog(this); startDialog.setContentView(binding.getRoot()); startDialog.setCancelable(false); startDialog.getBehavior().setState(BottomSheetBehavior.STATE_EXPANDED); Button startDismiss = binding.dismiss; startDismiss.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startDialog.dismiss(); PreferenceHelper.update("is_new_user", false); } }); startDialog.show(); }