Klasse SimpleDialog<This extends SimpleDialog<This>>

java.lang.Object
androidx.fragment.app.Fragment
androidx.fragment.app.DialogFragment
eltos.simpledialogfragment.SimpleDialog<This>
Alle implementierten Schnittstellen:
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
Bekannte direkte Unterklassen:
CustomViewDialog

public class SimpleDialog<This extends SimpleDialog<This>> extends androidx.fragment.app.DialogFragment
An easy to use and extendable dialog fragment that displays a text message. This is the base class of all dialogs in this library.

Created by eltos on 03.08.2015.

  • Verschachtelte Klassen - Übersicht

    Verschachtelte Klassen
    Modifizierer und Typ
    Klasse
    Beschreibung
    static interface 
     

    Von Klasse geerbte verschachtelte Klassen/Schnittstellen androidx.fragment.app.Fragment

    androidx.fragment.app.Fragment.InstantiationException, androidx.fragment.app.Fragment.SavedState
  • Feldübersicht

    Felder
    Modifizierer und Typ
    Feld
    Beschreibung
    protected static final String
     
    protected static final String
     
    protected static final String
     
    protected static final String
     
    protected static final String
     
    protected static final String
     
    protected static final String
     
    protected static final String
     
    protected static final String
     
    static final String
     
    protected static final String
     
    protected static final String
     

    Von Klasse geerbte Felder androidx.fragment.app.DialogFragment

    STYLE_NO_FRAME, STYLE_NO_INPUT, STYLE_NO_TITLE, STYLE_NORMAL

    Von Klasse geerbte Felder androidx.fragment.app.Fragment

    mPreviousWho
  • Konstruktorübersicht

    Konstruktoren
    Konstruktor
    Beschreibung
     
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
     
    protected boolean
    callResultListener(int which, android.os.Bundle extras)
     
    cancelable(boolean cancelable)
    Specifies whether this dialog may be canceled by pressing the back button or touching outside of the dialog.
    extra(android.os.Bundle extras)
    Pass extras to the dialog to retain specific information across configuration changes.
    Set that this dialog is shown as fullscreen dialog.
    fullscreen(boolean fullscreen)
    Specifies whether this dialog is shown as fullscreen or basic dialog.
    protected final android.os.Bundle
    null-save method to get arguments
    protected final CharSequence
     
    android.content.Context
     
    android.os.Bundle
    Gets the extras bundle provided
    Gets the string representation of the message set
    Gets the string representation of the title set
    icon(int iconResourceId)
    Sets this dialogs icon
    boolean
    Return whether the dialog was set to be cancelable or not
    msg(int messageResourceId)
    Sets this dialogs message
    msg(CharSequence message)
    Sets this dialogs message
    msgHtml(int messageResourceId)
    Sets this dialogs message as html styled string
    msgHtml(String message)
    Sets this dialogs message as html styled string
    neg()
    Sets this dialogs negative button text to R.string.no
    neg(int negativeButtonResourceId)
    Sets this dialogs negative button text
    neg(CharSequence negativeButton)
    Sets this dialogs negative button text
    Sets this dialogs neutral button text to R.string.cancel
    neut(int neutralButtonResourceId)
    Sets this dialogs neutral button text
    neut(CharSequence neutralButton)
    Sets this dialogs neutral button text
    void
    onCancel(android.content.DialogInterface dialog)
     
    void
    onCreate(android.os.Bundle savedInstanceState)
     
    android.app.Dialog
    onCreateDialog(android.os.Bundle savedInstanceState)
     
    void
     
    pos(int positiveButtonResourceId)
    Sets this dialogs positive button text
    pos(CharSequence positiveButton)
    Sets this dialogs positive button text
    protected final This
    setArg(String key, boolean value)
     
    protected final This
    setArg(String key, int value)
     
    protected final This
    setArg(String key, long value)
     
    protected final This
    setArg(String key, CharSequence value)
     
    protected void
    setButtonClickListener(int whichButton, android.view.View.OnClickListener listener)
    Call this method to overwrite the click listener for a button
    protected void
    setButtonEnabled(int whichButton, boolean enabled)
    Call this method to enable or disable a button
    void
    show(androidx.fragment.app.Fragment fragment)
    Shows the dialog.
    void
    show(androidx.fragment.app.FragmentActivity activity)
    Shows the dialog.
    void
    show(androidx.fragment.app.FragmentActivity activity, String tag)
    Shows the dialog.
    void
    show(androidx.fragment.app.FragmentActivity activity, String tag, String replaceTag)
    Shows the dialog.
    void
    show(androidx.fragment.app.FragmentManager manager, String tag)
    Veraltet.
    void
    show(androidx.fragment.app.Fragment fragment, String tag)
    Shows the dialog.
    void
    show(androidx.fragment.app.Fragment fragment, String tag, String replaceTag)
    Shows the dialog.
    int
    show(androidx.fragment.app.FragmentTransaction transaction, String tag)
    Veraltet.
    void
    showKeyboard(android.view.View view)
    Helper for opening the soft keyboard on a specified view
    theme(int theme)
    Set a custom theme.
    title(int titleResourceId)
    Sets this dialogs title
    Sets this dialogs title

    Von Klasse geerbte Methoden androidx.fragment.app.DialogFragment

    dismiss, dismissAllowingStateLoss, dismissNow, getDialog, getShowsDialog, getTheme, onActivityCreated, onAttach, onDetach, onDismiss, onGetLayoutInflater, onSaveInstanceState, onStart, onStop, onViewStateRestored, requireDialog, setCancelable, setShowsDialog, setStyle, setupDialog, showNow

    Von Klasse geerbte Methoden androidx.fragment.app.Fragment

    dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getDefaultViewModelCreationExtras, getDefaultViewModelProviderFactory, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLayoutInflater, getLifecycle, getLoaderManager, getParentFragment, getParentFragmentManager, 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, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreateAnimation, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onCreateView, onDestroy, onDestroyOptionsMenu, onHiddenChanged, onInflate, onInflate, onLowMemory, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPause, onPictureInPictureModeChanged, onPrepareOptionsMenu, onPrimaryNavigationFragmentChanged, onRequestPermissionsResult, onResume, onViewCreated, postponeEnterTransition, postponeEnterTransition, registerForActivityResult, 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, startActivity, startActivityForResult, startActivityForResult, startIntentSenderForResult, startPostponedEnterTransition, toString, unregisterForContextMenu

    Von Klasse geerbte Methoden java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Felddetails

  • Konstruktordetails

    • SimpleDialog

      public SimpleDialog()
  • Methodendetails

    • build

      public static SimpleDialog build()
    • callResultListener

      @CallSuper protected boolean callResultListener(int which, @Nullable android.os.Bundle extras)
    • setArg

      protected final This setArg(String key, boolean value)
    • setArg

      protected final This setArg(String key, CharSequence value)
    • setArg

      protected final This setArg(String key, int value)
    • setArg

      protected final This setArg(String key, long value)
    • getArgString

      @Nullable protected final CharSequence getArgString(String key)
    • getArgs

      @NonNull protected final android.os.Bundle getArgs()
      null-save method to get arguments
      Gibt zurück:
      dialog arguments bundle
    • title

      public This title(CharSequence title)
      Sets this dialogs title
      Parameter:
      title - the title as string
      Gibt zurück:
      this instance
    • title

      public This title(@StringRes int titleResourceId)
      Sets this dialogs title
      Parameter:
      titleResourceId - the title as android string resource
      Gibt zurück:
      this instance
    • getTitle

      @Nullable public CharSequence getTitle()
      Gets the string representation of the title set
      Gibt zurück:
      the dialog title
    • msg

      public This msg(CharSequence message)
      Sets this dialogs message
      Parameter:
      message - title as string
      Gibt zurück:
      this instance
    • msg

      public This msg(@StringRes int messageResourceId)
      Sets this dialogs message
      Parameter:
      messageResourceId - the message as android string resource
      Gibt zurück:
      this instance
    • msgHtml

      public This msgHtml(String message)
      Sets this dialogs message as html styled string
      Parameter:
      message - title as html-string
      Gibt zurück:
      this instance
    • msgHtml

      public This msgHtml(@StringRes int messageResourceId)
      Sets this dialogs message as html styled string
      Parameter:
      messageResourceId - the message as html-styled android string resource
      Gibt zurück:
      this instance
    • getMessage

      @Nullable public CharSequence getMessage()
      Gets the string representation of the message set
      Gibt zurück:
      the dialog message
    • pos

      public This pos(CharSequence positiveButton)
      Sets this dialogs positive button text
      Parameter:
      positiveButton - the text as string
      Gibt zurück:
      this instance
    • pos

      public This pos(@StringRes int positiveButtonResourceId)
      Sets this dialogs positive button text
      Parameter:
      positiveButtonResourceId - the text as android string resource
      Gibt zurück:
      this instance
    • neg

      public This neg(CharSequence negativeButton)
      Sets this dialogs negative button text
      Parameter:
      negativeButton - the text as string
      Gibt zurück:
      this instance
    • neg

      public This neg(@StringRes int negativeButtonResourceId)
      Sets this dialogs negative button text
      Parameter:
      negativeButtonResourceId - the text as android string resource
      Gibt zurück:
      this instance
    • neg

      public This neg()
      Sets this dialogs negative button text to R.string.no
      Gibt zurück:
      this instance
    • neut

      public This neut(CharSequence neutralButton)
      Sets this dialogs neutral button text
      Parameter:
      neutralButton - the text as string
      Gibt zurück:
      this instance
    • neut

      public This neut(@StringRes int neutralButtonResourceId)
      Sets this dialogs neutral button text
      Parameter:
      neutralButtonResourceId - the text as android string resource
      Gibt zurück:
      this instance
    • neut

      public This neut()
      Sets this dialogs neutral button text to R.string.cancel
      Gibt zurück:
      this instance
    • icon

      public This icon(@DrawableRes int iconResourceId)
      Sets this dialogs icon
      Parameter:
      iconResourceId - the icon as android drawable resource
      Gibt zurück:
      this instance
    • cancelable

      public This cancelable(boolean cancelable)
      Specifies whether this dialog may be canceled by pressing the back button or touching outside of the dialog. The dialog may still be "canceled" by a neutral button.
      Parameter:
      cancelable - whether this dialog may be canceled
      Gibt zurück:
      this instance
    • isCancelable

      public boolean isCancelable()
      Return whether the dialog was set to be cancelable or not
      Setzt außer Kraft:
      isCancelable in Klasse androidx.fragment.app.DialogFragment
      Gibt zurück:
      whether the dialog is cancelable
    • fullscreen

      public This fullscreen(boolean fullscreen)
      Specifies whether this dialog is shown as fullscreen or basic dialog.
      Parameter:
      fullscreen - whether this dialog is fullscreen
      Gibt zurück:
      this instance
    • fullscreen

      public This fullscreen()
      Set that this dialog is shown as fullscreen dialog.
      Gibt zurück:
      this instance
    • extra

      public This extra(android.os.Bundle extras)
      Pass extras to the dialog to retain specific information across configuration changes. All extras supplied here will be contained in the extras bundle passed to SimpleDialog.OnDialogResultListener.onResult(java.lang.String, int, android.os.Bundle)
      Parameter:
      extras - a bundle of extras to store
      Gibt zurück:
      this instance
    • getExtras

      @NonNull public android.os.Bundle getExtras()
      Gets the extras bundle provided
      Gibt zurück:
      the extras bundle (which may be empty)
    • theme

      public This theme(@StyleRes int theme)
      Set a custom theme. Default is using the theme defined by the 'simpleDialogTheme'-attribute or the 'alertDialogTheme'-attribute.
      Parameter:
      theme - the android style resource id of the custom theme
      Gibt zurück:
      this instance
    • show

      public void show(androidx.fragment.app.Fragment fragment)
      Shows the dialog. The SimpleDialog.OnDialogResultListener won't be called.
      Parameter:
      fragment - the hosting fragment
    • show

      public void show(androidx.fragment.app.Fragment fragment, String tag)
      Shows the dialog. Results will be forwarded to the fragment supplied. The tag can be used to identify the dialog in SimpleDialog.OnDialogResultListener.onResult(java.lang.String, int, android.os.Bundle)
      Parameter:
      fragment - the hosting fragment
      tag - the dialogs tag
    • show

      public void show(androidx.fragment.app.Fragment fragment, String tag, String replaceTag)
      Shows the dialog. Results will be forwarded to the fragment supplied. The tag can be used to identify the dialog in SimpleDialog.OnDialogResultListener.onResult(java.lang.String, int, android.os.Bundle) An optional argument can be used to remove a previously shown dialog with the tag given prior to showing this one.
      Parameter:
      fragment - the hosting fragment
      tag - the dialogs tag
      replaceTag - removes the dialog with the given tag if specified
    • show

      public void show(androidx.fragment.app.FragmentActivity activity)
      Shows the dialog. The SimpleDialog.OnDialogResultListener won't be called.
      Parameter:
      activity - the hosting activity
    • show

      public void show(androidx.fragment.app.FragmentActivity activity, String tag)
      Shows the dialog. Results will be forwarded to the activity supplied. The tag can be used to identify the dialog in SimpleDialog.OnDialogResultListener.onResult(java.lang.String, int, android.os.Bundle)
      Parameter:
      activity - the hosting activity
      tag - the dialogs tag
    • show

      public void show(androidx.fragment.app.FragmentActivity activity, String tag, String replaceTag)
      Shows the dialog. Results will be forwarded to the activity supplied. The tag can be used to identify the dialog in SimpleDialog.OnDialogResultListener.onResult(java.lang.String, int, android.os.Bundle) An optional argument can be used to remove a previously shown dialog with the tag given prior to showing this one.
      Parameter:
      activity - the hosting activity
      tag - the dialogs tag
      replaceTag - removes the dialog with the given tag if specified
    • onCreate

      @CallSuper public void onCreate(android.os.Bundle savedInstanceState)
      Setzt außer Kraft:
      onCreate in Klasse androidx.fragment.app.DialogFragment
    • getContext

      public android.content.Context getContext()
      Setzt außer Kraft:
      getContext in Klasse androidx.fragment.app.Fragment
    • onCreateDialog

      @NonNull public android.app.Dialog onCreateDialog(android.os.Bundle savedInstanceState)
      Setzt außer Kraft:
      onCreateDialog in Klasse androidx.fragment.app.DialogFragment
    • setButtonEnabled

      protected void setButtonEnabled(int whichButton, boolean enabled)
      Call this method to enable or disable a button

      Note: This method has no effect if the dialog is not yet shown

      Parameter:
      enabled - whether to en- or disable the button
    • setButtonClickListener

      protected void setButtonClickListener(int whichButton, android.view.View.OnClickListener listener)
      Call this method to overwrite the click listener for a button

      Note: This method has no effect if the dialog is not yet shown

      Parameter:
      listener - the click listener
    • showKeyboard

      public void showKeyboard(android.view.View view)
      Helper for opening the soft keyboard on a specified view
      Parameter:
      view - the view to be focused and receive keyboard input
    • show

      @Deprecated public void show(@NonNull androidx.fragment.app.FragmentManager manager, String tag)
      Veraltet.
      Deprecated, use show(FragmentActivity) or show(Fragment) instead
      Setzt außer Kraft:
      show in Klasse androidx.fragment.app.DialogFragment
    • show

      @Deprecated public int show(@NonNull androidx.fragment.app.FragmentTransaction transaction, String tag)
      Veraltet.
      Setzt außer Kraft:
      show in Klasse androidx.fragment.app.DialogFragment
    • onCancel

      @CallSuper public void onCancel(@NonNull android.content.DialogInterface dialog)
      Angegeben von:
      onCancel in Schnittstelle android.content.DialogInterface.OnCancelListener
      Setzt außer Kraft:
      onCancel in Klasse androidx.fragment.app.DialogFragment
    • onDestroyView

      @CallSuper public void onDestroyView()
      Setzt außer Kraft:
      onDestroyView in Klasse androidx.fragment.app.DialogFragment