Search in sources :

Example 16 with BottomSheetDialog

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();
}
Also used : BottomSheetDialog(com.google.android.material.bottomsheet.BottomSheetDialog) DialogInterface(android.content.DialogInterface) DiscreteScrollView(com.yarolegovich.discretescrollview.DiscreteScrollView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView)

Example 17 with BottomSheetDialog

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;
}
Also used : Window(android.view.Window) BottomSheetDialog(com.google.android.material.bottomsheet.BottomSheetDialog) MaterialShapeDrawable(com.google.android.material.shape.MaterialShapeDrawable) BottomSheetBehavior(com.google.android.material.bottomsheet.BottomSheetBehavior) KeyboardPageSearchView(org.thoughtcrime.securesms.keyboard.emoji.KeyboardPageSearchView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) EmojiPageView(org.thoughtcrime.securesms.components.emoji.EmojiPageView) ShapeAppearanceModel(com.google.android.material.shape.ShapeAppearanceModel) NonNull(androidx.annotation.NonNull)

Example 18 with BottomSheetDialog

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;
}
Also used : BottomSheetDialog(com.google.android.material.bottomsheet.BottomSheetDialog) NonNull(androidx.annotation.NonNull)

Example 19 with BottomSheetDialog

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();
}
Also used : BottomSheetDialog(com.google.android.material.bottomsheet.BottomSheetDialog) BindView(butterknife.BindView) TextView(android.widget.TextView) View(android.view.View) SuppressLint(android.annotation.SuppressLint)

Example 20 with BottomSheetDialog

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();
}
Also used : BottomSheetDialog(com.google.android.material.bottomsheet.BottomSheetDialog) BindView(butterknife.BindView) TextView(android.widget.TextView) View(android.view.View) SuppressLint(android.annotation.SuppressLint)

Aggregations

BottomSheetDialog (com.google.android.material.bottomsheet.BottomSheetDialog)25 View (android.view.View)20 TextView (android.widget.TextView)13 SuppressLint (android.annotation.SuppressLint)12 BindView (butterknife.BindView)12 NonNull (androidx.annotation.NonNull)8 RecyclerView (androidx.recyclerview.widget.RecyclerView)7 BottomSheetBehavior (com.google.android.material.bottomsheet.BottomSheetBehavior)4 ProgramLogoView (vision.genesis.clientapp.ui.ProgramLogoView)4 Window (android.view.Window)3 FrameLayout (android.widget.FrameLayout)3 ListView (android.widget.ListView)3 SearchView (androidx.appcompat.widget.SearchView)3 DialogInterface (android.content.DialogInterface)2 AdapterView (android.widget.AdapterView)2 Nullable (androidx.annotation.Nullable)2 DefaultItemAnimator (androidx.recyclerview.widget.DefaultItemAnimator)2 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)2 MaterialShapeDrawable (com.google.android.material.shape.MaterialShapeDrawable)2 SortDialogAdapter (org.odk.collect.android.adapters.SortDialogAdapter)2