Class ConfirmDialogFragment

  • All Implemented Interfaces:
    android.content.ComponentCallbacks, android.content.DialogInterface.OnCancelListener, android.content.DialogInterface.OnDismissListener, android.view.View.OnCreateContextMenuListener, androidx.lifecycle.LifecycleOwner, androidx.lifecycle.ViewModelStoreOwner, androidx.savedstate.SavedStateRegistryOwner

    public class ConfirmDialogFragment
    extends androidx.fragment.app.DialogFragment
    Fragment for creating a confirm dialog.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  ConfirmDialogFragment.ConfirmDialogListener
      Callback for the confirm dialog positive and negative response.
      • Nested classes/interfaces inherited from class androidx.fragment.app.Fragment

        androidx.fragment.app.Fragment.InstantiationException, androidx.fragment.app.Fragment.SavedState
    • Field Summary

      • Fields inherited from class androidx.fragment.app.DialogFragment

        STYLE_NO_FRAME, STYLE_NO_INPUT, STYLE_NO_TITLE, STYLE_NORMAL
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addListener​(ConfirmDialogFragment.ConfirmDialogListener listener)
      Adds a confirm dialog listener.
      static androidx.fragment.app.DialogFragment newInstance​(int titleId, int messageId, int positiveId, int negativeId)
      Creates a new instance of the dialog fragment.
      static ConfirmDialogFragment newInstance​(int titleId, java.lang.String message, int positiveId, int negativeId)
      Creates a new instance of the ConfirmDialogFragment.
      void onAttach​(android.app.Activity activity)  
      android.app.Dialog onCreateDialog​(android.os.Bundle savedInstanceState)  
      • Methods inherited from class androidx.fragment.app.DialogFragment

        dismiss, dismissAllowingStateLoss, getDialog, getShowsDialog, getTheme, isCancelable, onActivityCreated, onAttach, onCancel, onCreate, onDestroyView, onDetach, onDismiss, onGetLayoutInflater, onSaveInstanceState, onStart, onStop, requireDialog, setCancelable, setShowsDialog, setStyle, setupDialog, show, show, showNow
      • Methods inherited from class androidx.fragment.app.Fragment

        dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLayoutInflater, getLifecycle, getLoaderManager, getParentFragment, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSavedStateRegistry, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, getViewLifecycleOwner, getViewLifecycleOwnerLiveData, getViewModelStore, hashCode, hasOptionsMenu, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isMenuVisible, isRemoving, isResumed, isStateSaved, isVisible, onActivityResult, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreateAnimation, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onCreateView, onDestroy, onDestroyOptionsMenu, onHiddenChanged, onInflate, onInflate, onLowMemory, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPause, onPictureInPictureModeChanged, onPrepareOptionsMenu, onPrimaryNavigationFragmentChanged, onRequestPermissionsResult, onResume, onViewCreated, onViewStateRestored, postponeEnterTransition, postponeEnterTransition, registerForContextMenu, requestPermissions, requireActivity, requireArguments, requireContext, requireFragmentManager, requireHost, requireParentFragment, requireView, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setArguments, setEnterSharedElementCallback, setEnterTransition, setExitSharedElementCallback, setExitTransition, setHasOptionsMenu, setInitialSavedState, setMenuVisibility, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementReturnTransition, setTargetFragment, setUserVisibleHint, shouldShowRequestPermissionRationale, startActivity, startActivity, startActivityForResult, startActivityForResult, startIntentSenderForResult, startPostponedEnterTransition, toString, unregisterForContextMenu
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ConfirmDialogFragment

        public ConfirmDialogFragment()
    • Method Detail

      • newInstance

        public static androidx.fragment.app.DialogFragment newInstance​(int titleId,
                                                                       int messageId,
                                                                       int positiveId,
                                                                       int negativeId)
        Creates a new instance of the dialog fragment.
        Parameters:
        titleId - resource id for the title
        messageId - resource id for the message
        positiveId - resource id for the positive text
        negativeId - resource id for the negative text
        Returns:
        new instance of DialogFragment containing the passed title, message, positive text, negative text
      • newInstance

        public static ConfirmDialogFragment newInstance​(int titleId,
                                                        java.lang.String message,
                                                        int positiveId,
                                                        int negativeId)
        Creates a new instance of the ConfirmDialogFragment.
        Parameters:
        titleId - resource id for the title
        message - text for the message
        positiveId - resource id for the positive text
        negativeId - resource id for the negative text
        Returns:
        new instance of ConfirmDialogFragment containing the passed title, message, positive text, negative text
      • onAttach

        public void onAttach​(android.app.Activity activity)
        Overrides:
        onAttach in class androidx.fragment.app.Fragment
      • onCreateDialog

        @NonNull
        public android.app.Dialog onCreateDialog​(android.os.Bundle savedInstanceState)
        Overrides:
        onCreateDialog in class androidx.fragment.app.DialogFragment