Class ConfirmDialog
-
- All Implemented Interfaces:
-
android.content.ComponentCallbacks
,android.content.DialogInterface.OnCancelListener
,android.content.DialogInterface.OnDismissListener
,android.view.View.OnCreateContextMenuListener
,androidx.activity.result.ActivityResultCaller
,androidx.lifecycle.HasDefaultViewModelProviderFactory
,androidx.lifecycle.LifecycleOwner
,androidx.lifecycle.ViewModelStoreOwner
,androidx.savedstate.SavedStateRegistryOwner
,com.discord.app.AppComponent
public class ConfirmDialog extends AppDialog
Creates a Confirmation Dialog similar to the Leave Guild dialog. This class offers convenient builder methods so you should usually not have to do any layouts manually.
-
-
Field Summary
Fields Modifier and Type Field Description public boolean
isRecreated
public Subject<Void, Void>
unsubscribeSignal
public final static int
STYLE_NORMAL
public final static int
STYLE_NO_TITLE
public final static int
STYLE_NO_FRAME
public final static int
STYLE_NO_INPUT
-
Constructor Summary
Constructors Constructor Description ConfirmDialog()
-
Method Summary
Modifier and Type Method Description void
onViewBound(View view)
final LinearLayout
getRoot()
Returns the root layout of this dialog. final MaterialButton
getCancelButton()
Returns the cancel button of this dialog. final LoadingButton
getOKButton()
Returns the OK button of this dialog. final TextView
getBody()
Returns the body of this dialog. final TextView
getHeader()
Returns the header of this dialog. ConfirmDialog
setTitle(CharSequence title)
Sets the title of this dialog ConfirmDialog
setDescription(CharSequence description)
Sets the description of this dialog ConfirmDialog
setOnOkListener(View.OnClickListener listener)
Sets the View.OnClickListener that will be called when the OK button is pressed (By default simply closes this dialog) ConfirmDialog
setOnCancelListener(View.OnClickListener listener)
Sets the View.OnClickListener that will be called when the cancel button is pressed (By default simply closes this dialog) ConfirmDialog
setIsDangerous(boolean isDangerous)
Indicates that this confirm dialog is for a dangerous action by making the OK button Red -
Methods inherited from class com.discord.app.AppDialog
dismiss, getAppActivity, getArgumentsOrDefault, getUnsubscribeSignal, hideKeyboard, hideKeyboard$default, isRecreated, onCreateDialog, onDestroyView, onPause, onResume, onStart, onViewBoundOrOnResume, onViewCreated, setOnClickAndDismissListener, show, show, showKeyboard
-
Methods inherited from class androidx.fragment.app.DialogFragment
dismissAllowingStateLoss, getDialog, getShowsDialog, getTheme, isCancelable, onAttach, onCancel, onCreate, onDetach, onDismiss, onGetLayoutInflater, onSaveInstanceState, onStop, onViewStateRestored, requireDialog, setCancelable, setShowsDialog, setStyle, setupDialog, showNow
-
Methods inherited from class androidx.fragment.app.Fragment
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getDefaultViewModelProviderFactory, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLifecycle, getLoaderManager, getParentFragment, getParentFragmentManager, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSavedStateRegistry, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, getViewLifecycleOwner, getViewLifecycleOwnerLiveData, getViewModelStore, hasOptionsMenu, hashCode, instantiate, isAdded, isDetached, isHidden, isInLayout, isMenuVisible, isRemoving, isResumed, isStateSaved, isVisible, onActivityCreated, onActivityResult, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreateAnimation, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onCreateView, onDestroy, onDestroyOptionsMenu, onHiddenChanged, onInflate, onLowMemory, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPictureInPictureModeChanged, onPrepareOptionsMenu, onPrimaryNavigationFragmentChanged, onRequestPermissionsResult, postponeEnterTransition, registerForActivityResult, 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, startActivityForResult, startIntentSenderForResult, startPostponedEnterTransition, toString, unregisterForContextMenu
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
onViewBound
void onViewBound(View view)
-
getRoot
final LinearLayout getRoot()
Returns the root layout of this dialog. Should only be called from within onClickHandlers or onViewBound as it will likely throw a NullPointerException in other cases
-
getCancelButton
final MaterialButton getCancelButton()
Returns the cancel button of this dialog. Should only be called from within onClickHandlers or onViewBound as it will likely throw a NullPointerException in other cases
-
getOKButton
final LoadingButton getOKButton()
Returns the OK button of this dialog. Should only be called from within onClickHandlers or onViewBound as it will likely throw a NullPointerException in other cases
-
getBody
final TextView getBody()
Returns the body of this dialog. Should only be called from within onClickHandlers or onViewBound as it will likely throw a NullPointerException in other cases
-
getHeader
final TextView getHeader()
Returns the header of this dialog. Should only be called from within onClickHandlers or onViewBound as it will likely throw a NullPointerException in other cases
-
setTitle
ConfirmDialog setTitle(CharSequence title)
Sets the title of this dialog
- Parameters:
title
- The description
-
setDescription
ConfirmDialog setDescription(CharSequence description)
Sets the description of this dialog
- Parameters:
description
- The description
-
setOnOkListener
ConfirmDialog setOnOkListener(View.OnClickListener listener)
Sets the View.OnClickListener that will be called when the OK button is pressed (By default simply closes this dialog)
- Parameters:
listener
- The listener
-
setOnCancelListener
ConfirmDialog setOnCancelListener(View.OnClickListener listener)
Sets the View.OnClickListener that will be called when the cancel button is pressed (By default simply closes this dialog)
- Parameters:
listener
- The listener
-
setIsDangerous
ConfirmDialog setIsDangerous(boolean isDangerous)
Indicates that this confirm dialog is for a dangerous action by making the OK button Red
- Parameters:
isDangerous
- Whether this action is dangerous
-
-
-
-