Search in sources :

Example 6 with BottomSheetDialog

use of com.google.android.material.bottomsheet.BottomSheetDialog in project android-client by GenesisVision.

the class ProgramReportsDetailsBottomSheetFragment 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_reports_details, null);
    dialog.setContentView(contentView);
    ButterKnife.bind(this, contentView);
    this.successFeeLabel.setText(StringFormatUtil.capitalize(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 7 with BottomSheetDialog

use of com.google.android.material.bottomsheet.BottomSheetDialog in project collect by opendatakit.

the class AppListFragment method setupBottomSheet.

private void setupBottomSheet() {
    CollectAbstractActivity activity = (CollectAbstractActivity) getActivity();
    if (activity == null) {
        Timber.e("Activity is null");
        return;
    }
    bottomSheetDialog = new BottomSheetDialog(activity);
    View sheetView = getActivity().getLayoutInflater().inflate(R.layout.bottom_sheet, null);
    final RecyclerView recyclerView = sheetView.findViewById(R.id.recyclerView);
    final SortDialogAdapter adapter = new SortDialogAdapter(getActivity(), recyclerView, sortingOptions, getSelectedSortingOrder(), new RecyclerViewClickListener() {

        @Override
        public void onItemClicked(SortDialogAdapter.ViewHolder holder, int position) {
            holder.updateItemColor(selectedSortingOrder);
            performSelectedSearch(position);
            bottomSheetDialog.dismiss();
        }
    });
    RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity());
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setAdapter(adapter);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    bottomSheetDialog.setContentView(sheetView);
}
Also used : CollectAbstractActivity(org.odk.collect.android.activities.CollectAbstractActivity) BottomSheetDialog(com.google.android.material.bottomsheet.BottomSheetDialog) SortDialogAdapter(org.odk.collect.android.adapters.SortDialogAdapter) RecyclerView(androidx.recyclerview.widget.RecyclerView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) SearchView(androidx.appcompat.widget.SearchView) ListView(android.widget.ListView) RecyclerViewClickListener(org.odk.collect.android.listeners.RecyclerViewClickListener) DefaultItemAnimator(androidx.recyclerview.widget.DefaultItemAnimator)

Example 8 with BottomSheetDialog

use of com.google.android.material.bottomsheet.BottomSheetDialog in project collect by opendatakit.

the class AppListActivity method showBottomSheetDialog.

private void showBottomSheetDialog() {
    bottomSheetDialog = new BottomSheetDialog(this);
    final View sheetView = getLayoutInflater().inflate(R.layout.bottom_sheet, null);
    final RecyclerView recyclerView = sheetView.findViewById(R.id.recyclerView);
    final SortDialogAdapter adapter = new SortDialogAdapter(this, recyclerView, sortingOptions, getSelectedSortingOrder(), new RecyclerViewClickListener() {

        @Override
        public void onItemClicked(SortDialogAdapter.ViewHolder holder, int position) {
            holder.updateItemColor(selectedSortingOrder);
            performSelectedSearch(position);
            bottomSheetDialog.dismiss();
        }
    });
    RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getApplicationContext());
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setAdapter(adapter);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    bottomSheetDialog.setContentView(sheetView);
    bottomSheetDialog.show();
}
Also used : BottomSheetDialog(com.google.android.material.bottomsheet.BottomSheetDialog) SortDialogAdapter(org.odk.collect.android.adapters.SortDialogAdapter) RecyclerView(androidx.recyclerview.widget.RecyclerView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) View(android.view.View) AdapterView(android.widget.AdapterView) RecyclerView(androidx.recyclerview.widget.RecyclerView) SearchView(androidx.appcompat.widget.SearchView) ListView(android.widget.ListView) RecyclerViewClickListener(org.odk.collect.android.listeners.RecyclerViewClickListener) DefaultItemAnimator(androidx.recyclerview.widget.DefaultItemAnimator)

Example 9 with BottomSheetDialog

use of com.google.android.material.bottomsheet.BottomSheetDialog in project android by owncloud.

the class OCFileListFragment method registerFabUploadListeners.

/**
 * registers {@link android.view.View.OnClickListener} and {@link android.view.View.OnLongClickListener}
 * on the Upload mini FAB for the linked action an {@link Snackbar} showing the underlying action.
 */
private void registerFabUploadListeners() {
    getFabUpload().setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            final View uploadBottomSheet = getLayoutInflater().inflate(R.layout.upload_bottom_sheet_fragment, null);
            final BottomSheetDialog dialog = new BottomSheetDialog(requireContext());
            dialog.setContentView(uploadBottomSheet);
            final BottomSheetFragmentItemView uploadFromFilesItemView = uploadBottomSheet.findViewById(R.id.upload_from_files_item_view);
            BottomSheetFragmentItemView uploadFromCameraItemView = uploadBottomSheet.findViewById(R.id.upload_from_camera_item_view);
            TextView uploadToTextView = uploadBottomSheet.findViewById(R.id.upload_to_text_view);
            uploadFromFilesItemView.setOnTouchListener((v13, event) -> {
                Intent action = new Intent(Intent.ACTION_GET_CONTENT);
                action = action.setType(ALL_FILES_SAF_REGEX).addCategory(Intent.CATEGORY_OPENABLE);
                action.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
                getActivity().startActivityForResult(Intent.createChooser(action, getString(R.string.upload_chooser_title)), FileDisplayActivity.REQUEST_CODE__SELECT_CONTENT_FROM_APPS);
                dialog.hide();
                return false;
            });
            uploadFromCameraItemView.setOnTouchListener((v12, event) -> {
                ((FileDisplayActivity) getActivity()).getFilesUploadHelper().uploadFromCamera(FileDisplayActivity.REQUEST_CODE__UPLOAD_FROM_CAMERA);
                dialog.hide();
                return false;
            });
            uploadToTextView.setText(String.format(getResources().getString(R.string.upload_to), getResources().getString(R.string.app_name)));
            final BottomSheetBehavior uploadBottomSheetBehavior = BottomSheetBehavior.from((View) uploadBottomSheet.getParent());
            dialog.setOnShowListener(dialog1 -> uploadBottomSheetBehavior.setPeekHeight(uploadBottomSheet.getMeasuredHeight()));
            dialog.show();
            getFabMain().collapse();
            recordMiniFabClick();
        }
    });
    getFabUpload().setOnLongClickListener(v -> {
        showSnackMessage(R.string.actionbar_upload);
        return true;
    });
}
Also used : BottomSheetDialog(com.google.android.material.bottomsheet.BottomSheetDialog) ActionMode(android.view.ActionMode) Bundle(android.os.Bundle) CreateFolderDialogFragment(com.owncloud.android.ui.dialog.CreateFolderDialogFragment) NonNull(androidx.annotation.NonNull) OCFile(com.owncloud.android.datamodel.OCFile) PreferenceUtils(com.owncloud.android.utils.PreferenceUtils) OnEnforceableRefreshListener(com.owncloud.android.ui.activity.OnEnforceableRefreshListener) PowerManager(android.os.PowerManager) SortType(com.owncloud.android.presentation.ui.files.SortType) Handler(android.os.Handler) View(android.view.View) OwnCloudVersion(com.owncloud.android.lib.resources.status.OwnCloudVersion) Animation(android.view.animation.Animation) AdapterView(android.widget.AdapterView) ConfirmationDialogFragment(com.owncloud.android.ui.dialog.ConfirmationDialogFragment) PreferenceManager(android.preference.PreferenceManager) CoordinatorLayout(androidx.coordinatorlayout.widget.CoordinatorLayout) FileMenuFilter(com.owncloud.android.files.FileMenuFilter) FolderPickerActivity(com.owncloud.android.ui.activity.FolderPickerActivity) BottomSheetFragmentItemView(com.owncloud.android.presentation.ui.common.BottomSheetFragmentItemView) SearchView(androidx.appcompat.widget.SearchView) PreviewAudioFragment(com.owncloud.android.ui.preview.PreviewAudioFragment) ViewGroup(android.view.ViewGroup) Timber(timber.log.Timber) SparseBooleanArrayParcelable(com.owncloud.android.ui.helpers.SparseBooleanArrayParcelable) List(java.util.List) TextView(android.widget.TextView) Nullable(androidx.annotation.Nullable) SortOrder(com.owncloud.android.presentation.ui.files.SortOrder) FileDataStorageManager(com.owncloud.android.datamodel.FileDataStorageManager) FragmentExtKt(com.owncloud.android.extensions.FragmentExtKt) ListView(android.widget.ListView) NotNull(org.jetbrains.annotations.NotNull) Window(android.view.Window) Snackbar(com.google.android.material.snackbar.Snackbar) R(com.owncloud.android.R) FileListListAdapter(com.owncloud.android.ui.adapter.FileListListAdapter) Context(android.content.Context) DrawerLayout(androidx.drawerlayout.widget.DrawerLayout) ViewType(com.owncloud.android.presentation.ui.files.ViewType) BottomSheetBehavior(com.google.android.material.bottomsheet.BottomSheetBehavior) FileActivity(com.owncloud.android.ui.activity.FileActivity) Intent(android.content.Intent) RenameFileDialogFragment(com.owncloud.android.ui.dialog.RenameFileDialogFragment) FileListOption(com.owncloud.android.ui.activity.FileListOption) MenuItem(android.view.MenuItem) ArrayList(java.util.ArrayList) AnimationUtils(android.view.animation.AnimationUtils) SortBottomSheetFragment(com.owncloud.android.presentation.ui.files.SortBottomSheetFragment) MenuInflater(android.view.MenuInflater) PreviewImageFragment(com.owncloud.android.ui.preview.PreviewImageFragment) Menu(android.view.Menu) PreviewVideoFragment(com.owncloud.android.ui.preview.PreviewVideoFragment) SortOptionsView(com.owncloud.android.presentation.ui.files.SortOptionsView) LayoutInflater(android.view.LayoutInflater) SwipeRefreshLayout(androidx.swiperefreshlayout.widget.SwipeRefreshLayout) PreviewTextFragment(com.owncloud.android.ui.preview.PreviewTextFragment) AbsListView(android.widget.AbsListView) AccountUtils(com.owncloud.android.authentication.AccountUtils) File(java.io.File) FileStorageUtils(com.owncloud.android.utils.FileStorageUtils) SparseBooleanArray(android.util.SparseBooleanArray) SharedPreferences(android.content.SharedPreferences) FileDisplayActivity(com.owncloud.android.ui.activity.FileDisplayActivity) RemoveFilesDialogFragment(com.owncloud.android.ui.dialog.RemoveFilesDialogFragment) BottomSheetDialog(com.google.android.material.bottomsheet.BottomSheetDialog) FileDisplayActivity(com.owncloud.android.ui.activity.FileDisplayActivity) BottomSheetBehavior(com.google.android.material.bottomsheet.BottomSheetBehavior) TextView(android.widget.TextView) Intent(android.content.Intent) View(android.view.View) AdapterView(android.widget.AdapterView) BottomSheetFragmentItemView(com.owncloud.android.presentation.ui.common.BottomSheetFragmentItemView) SearchView(androidx.appcompat.widget.SearchView) TextView(android.widget.TextView) ListView(android.widget.ListView) SortOptionsView(com.owncloud.android.presentation.ui.files.SortOptionsView) AbsListView(android.widget.AbsListView) BottomSheetFragmentItemView(com.owncloud.android.presentation.ui.common.BottomSheetFragmentItemView)

Example 10 with BottomSheetDialog

use of com.google.android.material.bottomsheet.BottomSheetDialog in project Signal-Android by WhisperSystems.

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)

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