Class FormElementViewHolder<E extends FormElement>

java.lang.Object
eltos.simpledialogfragment.form.FormElementViewHolder<E>

public abstract class FormElementViewHolder<E extends FormElement> extends Object
The Base class for all ViewHolders This class is used to create the View that represents the corresponding FormElement and to maintain it's functionality Created by eltos on 23.02.17.
  • Field Details

    • field

      protected E extends FormElement field
      The FormElement that this ViewHolder represents.
  • Constructor Details

    • FormElementViewHolder

      protected FormElementViewHolder(E field)
  • Method Details

    • getContentViewLayout

      @LayoutRes protected abstract int getContentViewLayout()
      Implement this method to return a custom layout resource id for this view
      Returns:
      layout string resource
    • setUpView

      protected abstract void setUpView(android.view.View view, android.content.Context context, android.os.Bundle savedInstanceState, SimpleFormDialog.DialogActions actions)
      Implement this method to setup your view for the first time or after a saveState(android.os.Bundle)
      Parameters:
      view - The view that was inflated using the layout from getContentViewLayout()
      context - The context of this view
      savedInstanceState - A bundle containing everything that was saved in saveState(Bundle)
      actions - A callback for convenient methods. See SimpleFormDialog.DialogActions
    • saveState

      protected abstract void saveState(android.os.Bundle outState)
      Method to save this elements state Bundles are maintained on a per-view basis, so that keys can be arbitrary
      Parameters:
      outState - The bundle to save the state to
    • putResults

      protected abstract void putResults(android.os.Bundle results, String key)
      Parameters:
      results - The bundle to save the results to
      key - The key that has to be used when storing results in the bundle
    • focus

      protected abstract boolean focus(SimpleFormDialog.FocusActions actions)
      Method to focus this element
      Parameters:
      actions - An object providing useful callbacks, see SimpleFormDialog.FocusActions
      Returns:
      Whether this view or one of its descendants actually took focus.
    • posButtonEnabled

      protected abstract boolean posButtonEnabled(android.content.Context context)
      Method to check for empty input, (un-)checked state etc. Only simple (and fast) checks here, no error displaying! This is used only for single element forms.
      Parameters:
      context - A context
      Returns:
      true if positive button can be enabled
    • validate

      protected abstract boolean validate(android.content.Context context)
      Method to validate input, state etc. and display an error message or indicator
      Parameters:
      context - A context
      Returns:
      true if the input, state etc. is valid, false otherwise