use of com.google.android.material.bottomsheet.BottomSheetDialog in project DiscreteScrollView by yarolegovich.
the class DiscreteScrollViewOptions method configureTransitionTime.
public static void configureTransitionTime(DiscreteScrollView scrollView) {
final BottomSheetDialog bsd = new BottomSheetDialog(scrollView.getContext());
final TransitionTimeChangeListener timeChangeListener = new TransitionTimeChangeListener(scrollView);
bsd.setContentView(R.layout.dialog_transition_time);
defaultPrefs().registerOnSharedPreferenceChangeListener(timeChangeListener);
bsd.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
defaultPrefs().unregisterOnSharedPreferenceChangeListener(timeChangeListener);
}
});
View dismissBtn = bsd.findViewById(R.id.dialog_btn_dismiss);
if (dismissBtn != null) {
dismissBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
bsd.dismiss();
}
});
}
bsd.show();
}
use of com.google.android.material.bottomsheet.BottomSheetDialog in project Signal-Android by signalapp.
the class ReactWithAnyEmojiBottomSheetDialogFragment method onCreateDialog.
@Override
@NonNull
public Dialog onCreateDialog(Bundle savedInstanceState) {
BottomSheetDialog dialog = (BottomSheetDialog) super.onCreateDialog(savedInstanceState);
dialog.getBehavior().setPeekHeight((int) (getResources().getDisplayMetrics().heightPixels * 0.50));
ShapeAppearanceModel shapeAppearanceModel = ShapeAppearanceModel.builder().setTopLeftCorner(CornerFamily.ROUNDED, ViewUtil.dpToPx(requireContext(), 18)).setTopRightCorner(CornerFamily.ROUNDED, ViewUtil.dpToPx(requireContext(), 18)).build();
MaterialShapeDrawable dialogBackground = new MaterialShapeDrawable(shapeAppearanceModel);
dialogBackground.setTint(ContextCompat.getColor(requireContext(), R.color.react_with_any_background));
dialog.getBehavior().addBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
@Override
public void onStateChanged(@NonNull View bottomSheet, int newState) {
if (bottomSheet.getBackground() != dialogBackground) {
ViewCompat.setBackground(bottomSheet, dialogBackground);
}
}
@Override
public void onSlide(@NonNull View bottomSheet, float slideOffset) {
}
});
boolean shadows = requireArguments().getBoolean(ARG_SHADOWS, true);
if (!shadows) {
Window window = dialog.getWindow();
if (window != null) {
window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
}
}
return dialog;
}
use of com.google.android.material.bottomsheet.BottomSheetDialog in project Signal-Android by signalapp.
the class ConfirmPaymentFragment method onCreateDialog.
@Override
@NonNull
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
BottomSheetDialog dialog = (BottomSheetDialog) super.onCreateDialog(savedInstanceState);
dialog.getBehavior().setHideable(false);
return dialog;
}
use of com.google.android.material.bottomsheet.BottomSheetDialog in project android-client by GenesisVision.
the class ProgramFinancialStatisticsDetailsBottomSheetFragment method setupDialog.
@SuppressLint("RestrictedApi")
@Override
public void setupDialog(Dialog dialog, int style) {
super.setupDialog(dialog, style);
getDialog().setOnShowListener(dialog1 -> {
BottomSheetDialog d = (BottomSheetDialog) dialog1;
View bottomSheetInternal = d.findViewById(com.google.android.material.R.id.design_bottom_sheet);
if (bottomSheetInternal != null) {
BottomSheetBehavior.from(bottomSheetInternal).setState(BottomSheetBehavior.STATE_EXPANDED);
}
});
View contentView = View.inflate(getContext(), R.layout.fragment_bottomsheet_program_financial_statistics_details, null);
dialog.setContentView(contentView);
ButterKnife.bind(this, contentView);
successFeeLabel.setText(StringFormatUtil.capitalize(dialog.getContext().getString(R.string.success_fee)));
updateView();
}
use of com.google.android.material.bottomsheet.BottomSheetDialog in project android-client by GenesisVision.
the class ProgramAnalyticsDetailsBottomSheetFragment method setupDialog.
@SuppressLint("RestrictedApi")
@Override
public void setupDialog(Dialog dialog, int style) {
super.setupDialog(dialog, style);
getDialog().setOnShowListener(dialog1 -> {
BottomSheetDialog d = (BottomSheetDialog) dialog1;
View bottomSheetInternal = d.findViewById(com.google.android.material.R.id.design_bottom_sheet);
if (bottomSheetInternal != null) {
BottomSheetBehavior.from(bottomSheetInternal).setState(BottomSheetBehavior.STATE_EXPANDED);
}
});
View contentView = View.inflate(getContext(), R.layout.fragment_bottomsheet_program_analytics_details, null);
dialog.setContentView(contentView);
ButterKnife.bind(this, contentView);
setFonts();
updateView();
}
Aggregations