Class InputDialog
-
- 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 InputDialog extends AppDialogCreates a Input Dialog similar to the Kick User dialog. This class offers convenient builder methods so you should usually not have to do any layouts manually.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceInputDialog.onDialogShownListener
-
Field Summary
-
Constructor Summary
Constructors Constructor Description InputDialog()
-
Method Summary
Modifier and Type Method Description voidonViewBound(View view)final LinearLayoutgetRoot()Returns the root layout of this dialog. final MaterialButtongetCancelButton()Returns the cancel MaterialButton of this dialog. final MaterialButtongetOKButton()Returns the OK MaterialButton of this dialog. final TextViewgetBody()Returns the body of this dialog. final TextViewgetHeader()Returns the header of this dialog. final TextInputLayoutgetInputLayout()Returns the TextInputLayout of this dialog. StringgetInput()Returns the input the user entered. InputDialogsetPlaceholderText(CharSequence placeholder)Sets the placeholder text for the input field (By default the title if set or "Text") InputDialogsetInputType(int type)Sets the android.text.InputType InputDialogsetTitle(CharSequence title)Sets the title of this dialog InputDialogsetDescription(CharSequence description)Sets the description of this dialog InputDialogsetOnOkListener(View.OnClickListener listener)Sets the OnClickListener that will be called when the OK button is pressed (By default simply closes this dialog) InputDialogsetOnCancelListener(View.OnClickListener listener)Sets the OnClickListener that will be called when the cancel button is pressed (By default simply closes this dialog) voidsetOnDialogShownListener(InputDialog.onDialogShownListener listener)Sets the InputDialog.onDialogShownListener that will be called when the dialog is shown -
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
access$000, access$100, access$200, createFragmentContainer, dismissAllowingStateLoss, getDialog, getShowsDialog, getTheme, isCancelable, onAttach, onCancel, onCreate, onDetach, onDismiss, onFindViewById, onGetLayoutInflater, onHasView, onSaveInstanceState, onStop, onViewStateRestored, performCreateView, requireDialog, setCancelable, setShowsDialog, setStyle, setupDialog, showNow -
Methods inherited from class androidx.fragment.app.Fragment
callStartTransitionListener, dump, e, equals, findFragmentByWho, generateActivityResultKey, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getAnimatingAway, getAnimator, getArguments, getChildFragmentManager, getContext, getDefaultViewModelProviderFactory, getEnterTransition, getEnterTransitionCallback, getExitTransition, getExitTransitionCallback, getFocusedView, getFragmentManager, getHost, getId, getLayoutInflater, getLifecycle, getLoaderManager, getNextAnim, getNextTransition, getParentFragment, getParentFragmentManager, getPostOnViewCreatedAlpha, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSavedStateRegistry, getSharedElementEnterTransition, getSharedElementReturnTransition, getSharedElementSourceNames, getSharedElementTargetNames, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, getViewLifecycleOwner, getViewLifecycleOwnerLiveData, getViewModelStore, hasOptionsMenu, hashCode, initState, instantiate, isAdded, isDetached, isHidden, isHideReplaced, isInBackStack, isInLayout, isMenuVisible, isPostponed, isRemoving, isRemovingParent, isResumed, isStateSaved, isVisible, noteStateNotSaved, onActivityCreated, onActivityResult, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreateAnimation, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onCreateView, onDestroy, onDestroyOptionsMenu, onHiddenChanged, onInflate, onLowMemory, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPictureInPictureModeChanged, onPrepareOptionsMenu, onPrimaryNavigationFragmentChanged, onRequestPermissionsResult, performActivityCreated, performAttach, performConfigurationChanged, performContextItemSelected, performCreate, performCreateOptionsMenu, performDestroy, performDestroyView, performDetach, performGetLayoutInflater, performLowMemory, performMultiWindowModeChanged, performOptionsItemSelected, performOptionsMenuClosed, performPause, performPictureInPictureModeChanged, performPrepareOptionsMenu, performPrimaryNavigationFragmentChanged, performResume, performSaveInstanceState, performStart, performStop, performViewCreated, postponeEnterTransition, registerForActivityResult, registerForContextMenu, requestPermissions, requireActivity, requireArguments, requireContext, requireFragmentManager, requireHost, requireParentFragment, requireView, restoreChildFragmentState, restoreViewState, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setAnimatingAway, setAnimator, setArguments, setEnterSharedElementCallback, setEnterTransition, setExitSharedElementCallback, setExitTransition, setFocusedView, setHasOptionsMenu, setHideReplaced, setInitialSavedState, setMenuVisibility, setNextAnim, setNextTransition, setOnStartEnterTransitionListener, setPostOnViewCreatedAlpha, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementNames, 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 MaterialButton of this dialog. Should only be called from within onClickHandlers or onViewBound as it will likely throw a NullPointerException in other cases
-
getOKButton
final MaterialButton getOKButton()
Returns the OK MaterialButton 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
-
getInputLayout
final TextInputLayout getInputLayout()
Returns the TextInputLayout of this dialog. Should only be called from within onClickHandlers or onViewBound as it will likely throw a NullPointerException in other cases
-
getInput
String getInput()
Returns the input the user entered. Should only be called from within onClickHandlers or onViewBound as it will likely throw a NullPointerException in other cases
-
setPlaceholderText
InputDialog setPlaceholderText(CharSequence placeholder)
Sets the placeholder text for the input field (By default the title if set or "Text")
- Parameters:
placeholder- The placeholder text- Returns:
Builder for chaining
-
setInputType
InputDialog setInputType(int type)
Sets the android.text.InputType
- Parameters:
type- The input type- Returns:
Builder for chaining
-
setTitle
InputDialog setTitle(CharSequence title)
Sets the title of this dialog
- Parameters:
title- The description- Returns:
Builder for chaining
-
setDescription
InputDialog setDescription(CharSequence description)
Sets the description of this dialog
- Parameters:
description- The description- Returns:
Builder for chaining
-
setOnOkListener
InputDialog setOnOkListener(View.OnClickListener listener)
Sets the OnClickListener that will be called when the OK button is pressed (By default simply closes this dialog)
- Parameters:
listener- The listener- Returns:
Builder for chaining
-
setOnCancelListener
InputDialog setOnCancelListener(View.OnClickListener listener)
Sets the OnClickListener that will be called when the cancel button is pressed (By default simply closes this dialog)
- Parameters:
listener- The listener- Returns:
Builder for chaining
-
setOnDialogShownListener
void setOnDialogShownListener(InputDialog.onDialogShownListener listener)
Sets the InputDialog.onDialogShownListener that will be called when the dialog is shown
- Parameters:
listener- Listener
-
-
-
-