com.google.android.material.bottomsheet.BottomSheetDialog Java Examples
The following examples show how to use
com.google.android.material.bottomsheet.BottomSheetDialog.
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: BaseBottomSheetDialogFragment.java From SAI with GNU General Public License v3.0 | 6 votes |
@NonNull @Override public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { mDialog = new BottomSheetDialog(requireContext(), Theme.getInstance(requireContext()).getCurrentTheme().isDark() ? R.style.SAIBottomSheetDialog_Backup : R.style.SAIBottomSheetDialog_Backup_Light); View dialogView = LayoutInflater.from(requireContext()).inflate(R.layout.dialog_bottom_sheet_base, null); mPositiveButton = dialogView.findViewById(R.id.button_bottom_sheet_dialog_base_ok); mNegativeButton = dialogView.findViewById(R.id.button_bottom_sheet_dialog_base_cancel); mDialog.setContentView(dialogView); FrameLayout container = dialogView.findViewById(R.id.container_bottom_sheet_dialog_base_content); View contentView = onCreateContentView(LayoutInflater.from(requireContext()), container, savedInstanceState); if (contentView != null) { onContentViewCreated(contentView, savedInstanceState); container.addView(contentView); } return mDialog; }
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: MessageBoxDialog.java From Stylish-Widget-for-Android with Apache License 2.0 | 6 votes |
public BottomSheetDialog create() { final MessageBox messageBox = new MessageBox(context); messageBox.setMessage(message); final BottomSheetDialog dialog = new BottomSheetDialog(context); dialog.setContentView(messageBox); if (listener==null){ listener = new View.OnClickListener() { @Override public void onClick(View view) { dialog.hide(); } }; } if (text == null) messageBox.setCloseButton(listener); else messageBox.setActionButton(text, listener); return dialog; }
Example #5
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 #6
Source File: ShapeThemingDemoFragment.java From material-components-android with Apache License 2.0 | 6 votes |
@Nullable @Override public View onCreateDemoView( LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) { View view = layoutInflater.inflate( R.layout.cat_shape_theming_container, viewGroup, false /* attachToRoot */); ViewGroup container = view.findViewById(R.id.container); layoutInflater.inflate(R.layout.cat_shape_theming_content, container, true /* attachToRoot */); MaterialButton materialButton = container.findViewById(R.id.material_button); MaterialAlertDialogBuilder materialAlertDialogBuilder = new MaterialAlertDialogBuilder(getContext(), getShapeTheme()) .setTitle(R.string.cat_shape_theming_dialog_title) .setMessage(R.string.cat_shape_theming_dialog_message) .setPositiveButton(R.string.cat_shape_theming_dialog_ok, null); materialButton.setOnClickListener(v -> materialAlertDialogBuilder.show()); BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(wrappedContext); bottomSheetDialog.setContentView(R.layout.cat_shape_theming_bottomsheet_content); View bottomSheetInternal = bottomSheetDialog.findViewById(R.id.design_bottom_sheet); BottomSheetBehavior.from(bottomSheetInternal).setPeekHeight(300); MaterialButton button = container.findViewById(R.id.material_button_2); button.setOnClickListener(v -> bottomSheetDialog.show()); return view; }
Example #7
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 #8
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 #9
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 #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(); }
Example #11
Source File: ContainerTransformConfigurationHelper.java From material-components-android with Apache License 2.0 | 5 votes |
/** Set up buttons to apply and validate configuration values and dismiss the bottom sheet */ private void setUpBottomSheetConfirmationButtons(View view, BottomSheetDialog dialog) { view.findViewById(R.id.apply_button) .setOnClickListener( v -> { // Capture and update interpolation RadioGroup interpolationGroup = view.findViewById(R.id.interpolation_radio_group); if (interpolationGroup != null && interpolationGroup.getCheckedRadioButtonId() == R.id.radio_custom) { Float x1 = getTextFloat(view.findViewById(R.id.x1_edit_text)); Float y1 = getTextFloat(view.findViewById(R.id.y1_edit_text)); Float x2 = getTextFloat(view.findViewById(R.id.x2_edit_text)); Float y2 = getTextFloat(view.findViewById(R.id.y2_edit_text)); if (areValidCubicBezierControls(view, x1, y1, x2, y2)) { interpolator = new CustomCubicBezier(x1, y1, x2, y2); dialog.dismiss(); } } else { interpolator = new FastOutSlowInInterpolator(); dialog.dismiss(); } }); view.findViewById(R.id.clear_button) .setOnClickListener( v -> { setUpDefaultValues(); dialog.dismiss(); }); }
Example #12
Source File: RoundedBottomSheetDialogFragment.java From zephyr with MIT License | 5 votes |
@Override @NonNull public Dialog onCreateDialog(@NonNull Bundle savedInstanceState) { BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(requireContext(), getTheme()); bottomSheetDialog.setOnShowListener(this); return bottomSheetDialog; }
Example #13
Source File: ContainerTransformConfigurationHelper.java From material-components-android with Apache License 2.0 | 5 votes |
/** Create a bottom sheet dialog that displays controls to configure a container transform. */ private View createConfigurationBottomSheetView(Context context, BottomSheetDialog dialog) { View layout = LayoutInflater.from(context).inflate(R.layout.cat_transition_configuration_layout, null); setUpBottomSheetPathMotionButtonGroup(layout); setUpBottomSheetEnterDurationSlider(layout); setUpBottomSheetReturnDurationSlider(layout); setUpBottomSheetInterpolation(layout); setUpBottomSheetFadeModeButtonGroup(layout); setUpBottomSheetDebugging(layout); setUpBottomSheetConfirmationButtons(layout, dialog); return layout; }
Example #14
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 #15
Source File: BottomSheetScrollableContentDemoFragment.java From material-components-android with Apache License 2.0 | 5 votes |
@Override public View onCreateDemoView( LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) { View view = layoutInflater.inflate(getDemoContent(), viewGroup, false /* attachToRoot */); // Set up BottomSheetDialog BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(getContext()); bottomSheetDialog.setContentView(R.layout.cat_bottomsheet_scrollable_content); View bottomSheetInternal = bottomSheetDialog.findViewById(R.id.design_bottom_sheet); BottomSheetBehavior.from(bottomSheetInternal).setPeekHeight(400); View button = view.findViewById(R.id.bottomsheet_button); button.setOnClickListener(v -> bottomSheetDialog.show()); return view; }
Example #16
Source File: BottomSheetDecorationDialog.java From FlexibleAdapter with Apache License 2.0 | 5 votes |
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { mBottomSheetDialog = new BottomSheetDialog(getActivity(), R.style.AppTheme_BottomSheetDialog); mBottomSheetDialog.setContentView(getArguments().getInt(ARG_LAYOUT)); setListener(); configureEdges(); configureDividers(); return mBottomSheetDialog; }
Example #17
Source File: BottomSheetSectionDialog.java From FlexibleAdapter with Apache License 2.0 | 5 votes |
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { mBottomSheetDialog = new BottomSheetDialog(getActivity(), R.style.AppTheme_BottomSheetDialog); mBottomSheetDialog.setContentView(getArguments().getInt(ARG_LAYOUT)); mBottomSheetDialog.findViewById(R.id.select_item_type).setOnClickListener(this); mBottomSheetDialog.findViewById(R.id.select_item_type).setOnTouchListener(new SimpleOnTouchListener(getContext())); mBottomSheetDialog.findViewById(R.id.select_reference_button).setOnClickListener(this); mBottomSheetDialog.findViewById(R.id.select_reference_button).setOnTouchListener(new SimpleOnTouchListener(getContext())); mBottomSheetDialog.findViewById(R.id.new_item).setOnClickListener(this); createPopUps(); return mBottomSheetDialog; }
Example #18
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 #19
Source File: BottomSheetDetailDialog.java From TwistyTimer with GNU General Public License v3.0 | 5 votes |
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { BottomSheetDialog dialog = (BottomSheetDialog) super.onCreateDialog(savedInstanceState); // This makes the bottomSheet dialog start in the expanded state dialog.setOnShowListener(dia -> { BottomSheetDialog bottomDialog = (BottomSheetDialog) dia; FrameLayout bottomSheet = bottomDialog .findViewById(com.google.android.material.R.id.design_bottom_sheet); BottomSheetBehavior.from(bottomSheet).setState(BottomSheetBehavior.STATE_EXPANDED); BottomSheetBehavior.from(bottomSheet).setSkipCollapsed(true); BottomSheetBehavior.from(bottomSheet).setHideable(true); }); return dialog; }
Example #20
Source File: StreamFragment.java From Twire with GNU General Public License v3.0 | 5 votes |
private void setupProfileBottomSheet() { View v = LayoutInflater.from(getContext()).inflate(R.layout.stream_profile_preview, null); mProfileBottomSheet = new BottomSheetDialog(getContext()); mProfileBottomSheet.setContentView(v); final BottomSheetBehavior behavior = getDefaultBottomSheetBehaviour(v); mProfileBottomSheet.setOnDismissListener(dialogInterface -> behavior.setState(BottomSheetBehavior.STATE_COLLAPSED)); TextView mNameView = mProfileBottomSheet.findViewById(R.id.twitch_name); TextView mFollowers = mProfileBottomSheet.findViewById(R.id.txt_followers); TextView mViewers = mProfileBottomSheet.findViewById(R.id.txt_viewers); ImageView mFollowButton = mProfileBottomSheet.findViewById(R.id.follow_unfollow_icon); ImageView mFullProfileButton = mProfileBottomSheet.findViewById(R.id.full_profile_icon); RecyclerView mPanelsRecyclerView = mProfileBottomSheet.findViewById(R.id.panel_recyclerview); mNameView.setText(mChannelInfo.getDisplayName()); mFollowers.setText(mChannelInfo.getFollowers() + ""); mViewers.setText(mChannelInfo.getViews() + ""); mFullProfileButton.setOnClickListener(view -> { mProfileBottomSheet.dismiss(); final Intent intent = new Intent(getContext(), ChannelActivity.class); intent.putExtra(getContext().getResources().getString(R.string.channel_info_intent_object), mChannelInfo); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); getContext().startActivity(intent); }); setupFollowButton(mFollowButton); setupPanels(mPanelsRecyclerView); }
Example #21
Source File: PostsAdapter.java From Hify with MIT License | 5 votes |
public PostsAdapter(List<Post> postList, Context context, Activity activity, BottomSheetDialog mmBottomSheetDialog, View statsheetView, boolean forComment) { this.postList = postList; this.activity=activity; this.context = context; this.mmBottomSheetDialog=mmBottomSheetDialog; this.statsheetView=statsheetView; this.forComment=forComment; }
Example #22
Source File: Home.java From Hify with MIT License | 5 votes |
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { mFirestore = FirebaseFirestore.getInstance(); mAuth = FirebaseAuth.getInstance(); currentUser = mAuth.getCurrentUser(); refreshLayout=view.findViewById(R.id.refreshLayout); statsheetView = ((AppCompatActivity)getActivity()).getLayoutInflater().inflate(R.layout.stat_bottom_sheet_dialog, null); mmBottomSheetDialog = new BottomSheetDialog(view.getContext()); mmBottomSheetDialog.setContentView(statsheetView); mmBottomSheetDialog.setCanceledOnTouchOutside(true); mPostsRecyclerView = view.findViewById(R.id.posts_recyclerview); mPostsList = new ArrayList<>(); mAdapter_v19 = new PostsAdapter(mPostsList, view.getContext(), getActivity(), mmBottomSheetDialog, statsheetView, false); mPostsRecyclerView.setItemAnimator(new DefaultItemAnimator()); mPostsRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); mPostsRecyclerView.setHasFixedSize(true); mPostsRecyclerView.addItemDecoration(new DividerItemDecoration(view.getContext(),DividerItemDecoration.VERTICAL)); mPostsRecyclerView.setAdapter(mAdapter_v19); refreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { mPostsList.clear(); mAdapter_v19.notifyDataSetChanged(); getAllPosts(); } }); getAllPosts(); }
Example #23
Source File: FriendProfile.java From Hify with MIT License | 5 votes |
@Override public void onViewCreated(View view,@Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); Bundle bundle = this.getArguments(); if (bundle != null) { id = bundle.getString("id"); }else{ Toasty.error(rootView.getContext(), "Error retrieving information.", Toasty.LENGTH_SHORT,true).show(); getActivity().finish(); } refreshLayout=rootView.findViewById(R.id.refreshLayout); statsheetView = ((AppCompatActivity)getActivity()).getLayoutInflater().inflate(R.layout.stat_bottom_sheet_dialog, null); mmBottomSheetDialog = new BottomSheetDialog(rootView.getContext()); mmBottomSheetDialog.setContentView(statsheetView); mmBottomSheetDialog.setCanceledOnTouchOutside(true); postList=new ArrayList<>(); mAdapter=new PostsAdapter(postList, rootView.getContext(),getActivity(),mmBottomSheetDialog,statsheetView,false); mRecyclerView=rootView.findViewById(R.id.recyclerView); mRecyclerView.setItemAnimator(new DefaultItemAnimator()); mRecyclerView.setLayoutManager(new LinearLayoutManager(rootView.getContext(), VERTICAL, false)); mRecyclerView.addItemDecoration(new DividerItemDecoration(view.getContext(),DividerItemDecoration.VERTICAL)); mRecyclerView.setHasFixedSize(true); mRecyclerView.setAdapter(mAdapter); refreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { postList.clear(); mAdapter.notifyDataSetChanged(); getPosts(id); } }); getPosts(id); }
Example #24
Source File: FormBottomDialog.java From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); view.getViewTreeObserver().addOnGlobalLayoutListener(() -> { BottomSheetDialog dialog = (BottomSheetDialog) getDialog(); FrameLayout bottomSheet = dialog.findViewById(com.google.android.material.R.id.design_bottom_sheet); BottomSheetBehavior behavior = BottomSheetBehavior.from(bottomSheet); behavior.setState(BottomSheetBehavior.STATE_EXPANDED); behavior.setPeekHeight(0); }); }
Example #25
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 #26
Source File: StreamFragment.java From Pocket-Plays-for-Twitch with GNU General Public License v3.0 | 5 votes |
private void setupProfileBottomSheet() { View v = LayoutInflater.from(getContext()).inflate(R.layout.stream_profile_preview, null); mProfileBottomSheet = new BottomSheetDialog(getContext()); mProfileBottomSheet.setContentView(v); final BottomSheetBehavior behavior = getDefaultBottomSheetBehaviour(v); mProfileBottomSheet.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialogInterface) { behavior.setState(BottomSheetBehavior.STATE_COLLAPSED); } }); TextView mNameView = mProfileBottomSheet.findViewById(R.id.twitch_name); TextView mFollowers = mProfileBottomSheet.findViewById(R.id.txt_followers); TextView mViewers = mProfileBottomSheet.findViewById(R.id.txt_viewers); ImageView mFollowButton = mProfileBottomSheet.findViewById(R.id.follow_unfollow_icon); ImageView mFullProfileButton = mProfileBottomSheet.findViewById(R.id.full_profile_icon); RecyclerView mPanelsRecyclerView = mProfileBottomSheet.findViewById(R.id.panel_recyclerview); mNameView.setText(mChannelInfo.getDisplayName()); mFollowers.setText(mChannelInfo.getFollowers() + ""); mViewers.setText(mChannelInfo.getViews() + ""); mFullProfileButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mProfileBottomSheet.dismiss(); final Intent intent = new Intent(getContext(), ChannelActivity.class); intent.putExtra(getContext().getResources().getString(R.string.channel_info_intent_object), mChannelInfo); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); getContext().startActivity(intent); } }); setupFollowButton(mFollowButton); setupPanels(mPanelsRecyclerView); }
Example #27
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 #28
Source File: BottomSheetSpinnerDialog.java From TwistyTimer with GNU General Public License v3.0 | 5 votes |
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { BottomSheetDialog dialog = (BottomSheetDialog) super.onCreateDialog(savedInstanceState); // This makes the bottomSheet dialog start in the expanded state dialog.setOnShowListener(dia -> { BottomSheetDialog bottomDialog = (BottomSheetDialog) dia; FrameLayout bottomSheet = bottomDialog .findViewById(com.google.android.material.R.id.design_bottom_sheet); BottomSheetBehavior.from(bottomSheet).setState(BottomSheetBehavior.STATE_EXPANDED); BottomSheetBehavior.from(bottomSheet).setSkipCollapsed(true); BottomSheetBehavior.from(bottomSheet).setHideable(true); }); return dialog; }
Example #29
Source File: OptionBottomSheet.java From MusicPlayer with GNU General Public License v3.0 | 4 votes |
@NotNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { return new BottomSheetDialog(requireContext(),getTheme()); }
Example #30
Source File: UserBottomSheetDialog.java From revolution-irc with GNU General Public License v3.0 | 4 votes |
public BottomSheetDialog show() { if (mDialog == null) create(); mDialog.show(); return mDialog; }