Klasse SimpleInputDialog

java.lang.Object
androidx.fragment.app.Fragment
androidx.fragment.app.DialogFragment
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:
SimpleEMailDialog

public class SimpleInputDialog extends CustomViewDialog<SimpleInputDialog>
An simple dialog with an input field. Supports suggestions, input validations and max length options.

Results: TEXT String The entered text

Created by eltos on 14.10.2015.

  • Felddetails

  • Konstruktordetails

    • SimpleInputDialog

      public SimpleInputDialog()
  • Methodendetails

    • build

      public static SimpleInputDialog build()
    • hint

      public SimpleInputDialog hint(String hint)
      Sets the EditText's hint
      Parameter:
      hint - the hint as string
      Gibt zurück:
      this instance
    • hint

      public SimpleInputDialog hint(@StringRes int hintResourceId)
      Sets the EditText's hint
      Parameter:
      hintResourceId - the hint as android string resource
      Gibt zurück:
      this instance
    • text

      public SimpleInputDialog text(String text)
      Sets the EditText's initial text
      Parameter:
      text - initial text as string
      Gibt zurück:
      this instance
    • text

      public SimpleInputDialog text(@StringRes int textResourceId)
      Sets the EditText's initial text
      Parameter:
      textResourceId - initial text as android string resource
      Gibt zurück:
      this instance
    • inputType

      public SimpleInputDialog inputType(int inputType)
      Sets the input type The default is InputType.TYPE_CLASS_TEXT.
      Parameter:
      inputType - the InputType
      Gibt zurück:
      this instance
    • allowEmpty

      public SimpleInputDialog allowEmpty(boolean allow)
      Allow empty input. Default is to disable the positive button until text is entered.
      Parameter:
      allow - whether to allow empty input
      Gibt zurück:
      this instance
    • max

      public SimpleInputDialog max(int maxLength)
      Sets a max limit to the EditText.
      Parameter:
      maxLength - the maximum text length
      Gibt zurück:
      this instance
    • suggest

      public SimpleInputDialog suggest(android.content.Context context, int[] stringResourceIds)
      Provide an array of suggestions to be shown while the user is typing
      Parameter:
      context - a context to resolve the resource ids
      stringResourceIds - suggestion array as android string resources
      Gibt zurück:
      this instance
    • suggest

      public SimpleInputDialog suggest(String[] strings)
      Provide an array of suggestions to be shown while the user is typing
      Parameter:
      strings - suggestion string array
      Gibt zurück:
      this instance
    • onValidateInput

      @Nullable protected String onValidateInput(@Nullable String input)
    • getText

      @Nullable public String getText()
      Gibt zurück:
      the current text or null
    • isInputEmpty

      public boolean isInputEmpty()
    • openKeyboard

      public void openKeyboard()
      Helper for opening the soft keyboard
    • onCreateContentView

      public android.view.View onCreateContentView(android.os.Bundle savedInstanceState)
      Beschreibung aus Klasse kopiert: CustomViewDialog
      Inflate your custom view here.
      Angegeben von:
      onCreateContentView in Klasse CustomViewDialog<SimpleInputDialog>
      Parameter:
      savedInstanceState - The last saved instance state of the Fragment, or null if this fragment is created for the first time.
      Gibt zurück:
      Return a new View to be displayed by the Fragment.
    • posEnabled

      protected boolean posEnabled()
    • onDialogShown

      protected void onDialogShown()
      Beschreibung aus Klasse kopiert: CustomViewDialog
      Overwrite this method to take action once the dialog is shown such as settings an input focus, showing the keyboard or setting the initial positiveButtonState
      Setzt außer Kraft:
      onDialogShown in Klasse CustomViewDialog<SimpleInputDialog>
    • acceptsPositiveButtonPress

      protected boolean acceptsPositiveButtonPress()
      Beschreibung aus Klasse kopiert: CustomViewDialog
      Overwrite this method to catch positive button presses, e.g. if you need to verify input by the user

      Note: do not call CustomViewDialog.pressPositiveButton() here!

      Setzt außer Kraft:
      acceptsPositiveButtonPress in Klasse CustomViewDialog<SimpleInputDialog>
      Gibt zurück:
      false to ignore the press, true to process normally
    • onResult

      public android.os.Bundle onResult(int which)
      Beschreibung aus Klasse kopiert: CustomViewDialog
      Overwrite this method to provide additional results from your custom view to be passed to the SimpleDialog.OnDialogResultListener.onResult(java.lang.String, int, android.os.Bundle)
      Setzt außer Kraft:
      onResult in Klasse CustomViewDialog<SimpleInputDialog>
      Parameter:
      which - see SimpleDialog.OnDialogResultListener
      Gibt zurück:
      the bundle to merge with the results or null
    • onSaveInstanceState

      public void onSaveInstanceState(@NonNull android.os.Bundle outState)
      Setzt außer Kraft:
      onSaveInstanceState in Klasse androidx.fragment.app.DialogFragment