public class

GenericListPickerFormCell

extends LinearLayout
implements FormCell<T> InlineValidation SupportsKey
java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.LinearLayout
         ↳ com.sap.cloud.mobile.fiori.formcell.GenericListPickerFormCell<V extends android.view.View, T extends java.io.Serializable>

Class Overview

A Fiori control to present a large list of items to choose from. List is presented in a separate activity.

Structure of the control is:

  • Key : Label view acts as key/tag or name for the view. See also : setKey(CharSequence)
  • GenericListPickerFormCellActivity : This is the activity used to present the complete list of items into a RecyclerView. GenericListPickerFormCell opens the given GenericListPickerFormCellActivity specified with setPickerActivity(GenericListPickerFormCellActivity).
  • Display Value: Show the selected items as more informative message. See also: setDisplayValue(CharSequence) (CharSequence)}
  • Summary

    XML Attributes
    Attribute Name Related Method Description
    FormCellMetadataLayout_android_clickable setClickable(boolean)  
    FormCellMetadataLayout_android_enabled setEnabled(boolean)  
    FormCellMetadataLayout_android_focusable setFocusable(boolean)  
    FormCellMetadataLayout_errorEnabled setErrorEnabled(boolean)  
    FormCellMetadataLayout_helperEnabled setHelperEnabled(boolean)  
    FormCellMetadataLayout_helperText setHelperText(CharSequence)  
    FormCellMetadataLayout_helperTextTextAppearance setHelperTextAppearance(int)  
    FormCellMetadataLayout_label setLabel(CharSequence)  
    FormCellMetadataLayout_labelEnabled setLabelEnabled(boolean)  
    FormCellMetadataLayout_labelTextAppearance setLabelTextAppearanceFocused(int)  
    FormCellMetadataLayout_labelTextAppearanceFocused setLabelTextAppearanceFocused(int)  
    FormCellMetadataLayout_labelTextAppearanceUnFocused setLabelTextAppearanceFocused(int)  
    Constants
    String ALL_ITEM_LABEL
    String CLEAR_SINGLE_SELECTION
    String DISMISS_ON_SINGLE_SELECTION
    String PICKER_LAYOUT
    String RECYCLER_ID
    String SELECTED_ITEM_LABEL
    String SELECTED_POS_OR_IDS
    String SELECTOR_ON_START
    String SHOW_SELECTED
    String SINGLE_SELECT_ON
    String USER_DATA
    [Expand]
    Inherited Constants
    From class android.widget.LinearLayout
    From class android.view.ViewGroup
    From class android.view.View
    Fields
    protected CharSequence mErrorMessage
    protected int mErrorTextAppearance
    protected CharSequence mHelperText
    protected int mHelperTextAppearance
    protected int mHorizontalMargin
    protected boolean mIsInError
    protected boolean mIsTablet
    protected int mLabelTextAppearance
    protected int mLabelTextAppearanceUnFocused
    protected TextView mLabelTextView
    protected boolean mShouldAttachOrientationListener
    protected TextView mStatusView
    [Expand]
    Inherited Fields
    From class android.view.View
    Public Constructors
    GenericListPickerFormCell(Context context)
    Construct a new GenericListPickerFormCell with default styling, sets the CellType to WidgetType.GENERIC_LISTPICKER
    GenericListPickerFormCell(Context context, AttributeSet attrs)
    Construct a new GenericListPickerFormCell with default styling, overriding the attributes for the control as requested, sets the CellType to WidgetType.GENERIC_LISTPICKER
    Public Methods
    void addView(View child, int index, ViewGroup.LayoutParams params)
    Add given view in the view
    String getActivityTitle()
    Returns the title on the toolbar for the GenericListPickerFormCellActivity which will display the item list
    int getCellType()
    Return the enum value for GenericListPickerFormCell
    CellValueChangeListener<List<T>> getCellValueChangeListener()
    Return the value change handler of the control
    CharSequence getDisplayValue()
    CharSequence getError()
    Get error set on the view
    TextView getErrorView()
    CharSequence getKey()
    Get the key of the cell
    TextView getKeyLabel()
    Return the view holding the keyname string
    List<T> getValue()
    Returns the list of index of selected items
    TextView getValueTextFieldView()
    Return the view holding the value string
    boolean isEditable()
    Get is the cell is editable.
    boolean isErrorEnabled()
    Is error enabled on the view
    boolean isHelperEnabled()
    Set if the helper field is enabled on the view
    boolean isLabelEnabled()
    Is the label field on the view is enabled
    boolean isSingleSelectOnly()
    Is multiple selection enabled?
    boolean onInterceptTouchEvent(MotionEvent ev)
    void onRestoreInstanceState(Parcelable state)
    Parcelable onSaveInstanceState()
    void setActivityTitle(String activityTitle)
    Sets the toolbar title in the GenericListPickerFormCellActivity
    void setAllItemLabel(CharSequence allItemLabel)
    Set the label for "All" item section.
    void setCellValueChangeListener(CellValueChangeListener<List<T>> listener)
    Set the CellValueChangeListener to listen to updates to the picker
    void setClearSingleSelection(boolean enable)
    Allow enable of items when already selected item is clicked.
    void setClickable(boolean clickable)
    Enable or disable clickable property on the view and all its children
    void setDismissOnSingleSelection(boolean dismissOnSingleSelection)
    Automatically dismisses the picker when user selects an item.
    void setDisplayValue(CharSequence valueTextField)
    Sets the display value for the selected items
    void setDisplayValueHint(CharSequence hint)
    Set the hint on the display value
    void setDisplayValueHint(int hint)
    Set the hint on the display value
    void setDisplayValueTextAppearance(int res)
    Set the display value text appearance
    void setEditable(boolean isEditable)
    Enable or disable the Cell
    void setEnabled(boolean enabled)
    Enable or disable the view
    void setError(CharSequence error)
    Set the error on view
    void setErrorEnabled(boolean errorEnabled)
    Enable or disable error enabled
    void setErrorTextAppearance(int resId)
    Set the error text appearance
    void setFocusable(boolean focusable)
    Enable or disable focusable property on the view and all its children
    void setKey(CharSequence keyName)
    Set the key of the cell
    void setKeyTextAppearance(int resId)
    Set the appearance of the key
    void setLabelTextAppearanceUnFocused(int labelTextAppearanceUnFocused)
    Set the label text appearance when the view is not focused
    void setLayoutRes(int layoutRes, int recyclerViewId)
    Set the layout resource and recycler view id to be used to inflate the picker
    void setLeftToRight(boolean leftToRight)
    Show the check/radio buttons on the start or the end of the layout
    void setOverrideKeyStyle(boolean overrideKeyStyle)
    Override the Key styling manually.
    void setOverrideStatusStyle(boolean overrideStatusStyle)
    Override the status i.e.
    void setPickerActivity(GenericListPickerFormCellActivity<V, T> listPickerActivity)
    Sets the activity where the intent will be passed and the list of available options will be displayed
    void setSelectButtonColorTint(ColorStateList color)
    Set the tint on icon drawable of the cell
    void setSelectIconDrawable(int res)
    Change the select icon drawable of the cell
    void setSelectIconDrawable(Drawable res)
    Change the select icon drawable of the cell
    void setSelectedItemLabel(CharSequence selectedItemLabel)
    Set the label for "Selected" item section.
    void setShouldAttachOrientationListener(boolean shouldAttach)
    Determines if an OrientationEventListener should be attached.
    void setSingleSelectOnly(boolean enableSingleSelect)
    Enable or disable single/multiple selection
    void setValue(List<T> value)
    Set the value on the cell i.e.
    void showSelected(boolean showSelected)
    Show or hide the selected item section on the list picker formcell
    Protected Methods
    void adjustMargins()
    Calculate and set the margins for the cell's elements.
    static boolean arrayContains(int[] array, int value)
    Check if the array contains the given property
    void drawableStateChanged()
    Drawable state changed
    TextView generateTextView()
    Generate the text view
    ViewGroup.LayoutParams getDefaultLayoutParams()
    CharSequence getHelperText()
    Get the helper text from the view
    CharSequence getLabel()
    Get the label on the view
    void onSizeChanged(int w, int h, int oldw, int oldh)
    void replaceStatusView()
    Each time you add a new view, error/helper view has to be adjusted to be the last view in the layout
    void setHelperEnabled(boolean helperEnabled)
    Enable or disable the helper field on the view
    void setHelperText(CharSequence helper)
    Set the helper text on the view
    void setHelperTextAppearance(int helperTextAppearance)
    Set the helper text appearance
    void setLabel(CharSequence key)
    Set the label on the view
    void setLabelEnabled(boolean keyEnabled)
    Enable or disable the label field on the view
    void setLabelTextAppearance(int textAppearance)
    Set the text appearance on the label.
    void setLabelTextAppearanceFocused(int textAppearance)
    Set the text appearance on the label when the view is not focused
    void setLabelTextColorError(ColorStateList color)
    Set the text color of the label for error mode
    void setLabelTextColorFocused(ColorStateList color)
    Set the color of label when the view is focused
    void setLabelTextColorUnFocused(ColorStateList color)
    Set the color of label when the view is not focused
    boolean setupErrorHelperView()
    Setup the error/helper field on the view
    boolean setupLabelView()
    Setup the label view on the view
    boolean shouldLayout(View v)
    Should layout the given view
    [Expand]
    Inherited Methods
    From class android.widget.LinearLayout
    From class android.view.ViewGroup
    From class android.view.View
    From class java.lang.Object
    From interface android.graphics.drawable.Drawable.Callback
    From interface android.view.KeyEvent.Callback
    From interface android.view.ViewManager
    From interface android.view.ViewParent
    From interface android.view.accessibility.AccessibilityEventSource
    From interface com.sap.cloud.mobile.fiori.formcell.FormCell
    From interface com.sap.cloud.mobile.fiori.formcell.InlineValidation
    From interface com.sap.cloud.mobile.fiori.formcell.SupportsKey

    XML Attributes

    FormCellMetadataLayout_android_clickable

    Related Methods

    FormCellMetadataLayout_android_enabled

    Related Methods

    FormCellMetadataLayout_android_focusable

    Related Methods

    FormCellMetadataLayout_errorEnabled

    Related Methods

    FormCellMetadataLayout_helperEnabled

    Related Methods

    FormCellMetadataLayout_helperText

    Related Methods

    FormCellMetadataLayout_helperTextTextAppearance

    FormCellMetadataLayout_label

    Related Methods

    FormCellMetadataLayout_labelEnabled

    Related Methods

    FormCellMetadataLayout_labelTextAppearance

    FormCellMetadataLayout_labelTextAppearanceFocused

    FormCellMetadataLayout_labelTextAppearanceUnFocused

    Constants

    public static final String ALL_ITEM_LABEL

    Constant Value: "LABEL_FOR_ALL_ITEM"

    public static final String CLEAR_SINGLE_SELECTION

    Constant Value: "CLEAR_SINGLE_SELECTION"

    public static final String DISMISS_ON_SINGLE_SELECTION

    Constant Value: "DISMISS_ON_SINGLE_SELECTION"

    public static final String PICKER_LAYOUT

    Constant Value: "PICKER_LAYOUT"

    public static final String RECYCLER_ID

    Constant Value: "RECYCLER_ID"

    public static final String SELECTED_ITEM_LABEL

    Constant Value: "LABEL_FOR_SELECTED_ITEM"

    public static final String SELECTED_POS_OR_IDS

    Constant Value: "IDS_FOR_SELECTED_ITEM"

    public static final String SELECTOR_ON_START

    Constant Value: "isSelectorOnStart"

    public static final String SHOW_SELECTED

    Constant Value: "SHOW_SELECTED_ITEM_SECTION"

    public static final String SINGLE_SELECT_ON

    Constant Value: "isSingleSelect"

    public static final String USER_DATA

    Constant Value: "USER_DATA"

    Fields

    protected CharSequence mErrorMessage

    protected int mErrorTextAppearance

    protected CharSequence mHelperText

    protected int mHelperTextAppearance

    protected int mHorizontalMargin

    protected boolean mIsInError

    protected boolean mIsTablet

    protected int mLabelTextAppearance

    protected int mLabelTextAppearanceUnFocused

    protected TextView mLabelTextView

    protected boolean mShouldAttachOrientationListener

    protected TextView mStatusView

    Public Constructors

    public GenericListPickerFormCell (Context context)

    Construct a new GenericListPickerFormCell with default styling, sets the CellType to WidgetType.GENERIC_LISTPICKER

    Parameters
    context context

    public GenericListPickerFormCell (Context context, AttributeSet attrs)

    Construct a new GenericListPickerFormCell with default styling, overriding the attributes for the control as requested, sets the CellType to WidgetType.GENERIC_LISTPICKER

    Parameters
    context context
    attrs attribute set

    Public Methods

    public void addView (View child, int index, ViewGroup.LayoutParams params)

    Add given view in the view

    Parameters
    child View
    index position at which the view has to be added
    params ViewGroup.LayoutParams

    public String getActivityTitle ()

    Returns the title on the toolbar for the GenericListPickerFormCellActivity which will display the item list

    Returns
    • String title for the activity on the toolbar

    public int getCellType ()

    Return the enum value for GenericListPickerFormCell

    Returns
    • WidgetType type of the control which has implemented FormCell

    public CellValueChangeListener<List<T>> getCellValueChangeListener ()

    Return the value change handler of the control

    Returns
    • OnCellChangeListener - value change listener of the control

    public CharSequence getDisplayValue ()

    public CharSequence getError ()

    Get error set on the view

    Returns
    • error as CharSequence

    public TextView getErrorView ()

    public CharSequence getKey ()

    Get the key of the cell

    Returns
    • CharSequence

    public TextView getKeyLabel ()

    Return the view holding the keyname string

    Returns
    • TextView textview displaying keyname

    public List<T> getValue ()

    Returns the list of index of selected items

    Returns
    • List selected items index list

    public TextView getValueTextFieldView ()

    Return the view holding the value string

    Returns
    • TextView textview displaying value

    public boolean isEditable ()

    Get is the cell is editable.

    Returns
    • boolean

    public boolean isErrorEnabled ()

    Is error enabled on the view

    Related XML Attributes
    Returns
    • boolean

    public boolean isHelperEnabled ()

    Set if the helper field is enabled on the view

    Related XML Attributes
    Returns
    • boolean

    public boolean isLabelEnabled ()

    Is the label field on the view is enabled

    Related XML Attributes
    Returns
    • boolean

    public boolean isSingleSelectOnly ()

    Is multiple selection enabled?

    Returns
    • boolean

    public boolean onInterceptTouchEvent (MotionEvent ev)

    public void onRestoreInstanceState (Parcelable state)

    public Parcelable onSaveInstanceState ()

    public void setActivityTitle (String activityTitle)

    Sets the toolbar title in the GenericListPickerFormCellActivity

    Parameters
    activityTitle title of the activity displaying the item list

    public void setAllItemLabel (CharSequence allItemLabel)

    Set the label for "All" item section.

    Parameters
    allItemLabel CharSequence

    public void setCellValueChangeListener (CellValueChangeListener<List<T>> listener)

    Set the CellValueChangeListener to listen to updates to the picker

    Parameters
    listener value change listener of the control

    public void setClearSingleSelection (boolean enable)

    Allow enable of items when already selected item is clicked. Note that this flag only affects the single select picker.

    Parameters
    enable boolean

    public void setClickable (boolean clickable)

    Enable or disable clickable property on the view and all its children

    Parameters
    clickable boolean

    public void setDismissOnSingleSelection (boolean dismissOnSingleSelection)

    Automatically dismisses the picker when user selects an item. Works only with Single select picker

    Parameters
    dismissOnSingleSelection should automatically dismiss the picker on single selection

    public void setDisplayValue (CharSequence valueTextField)

    Sets the display value for the selected items

    Parameters
    valueTextField display value for the selected items

    public void setDisplayValueHint (CharSequence hint)

    Set the hint on the display value

    Parameters
    hint hint

    public void setDisplayValueHint (int hint)

    Set the hint on the display value

    Parameters
    hint hint

    public void setDisplayValueTextAppearance (int res)

    Set the display value text appearance

    Parameters
    res style resource

    public void setEditable (boolean isEditable)

    Enable or disable the Cell

    Parameters
    isEditable boolean

    public void setEnabled (boolean enabled)

    Enable or disable the view

    Parameters
    enabled boolean

    public void setError (CharSequence error)

    Set the error on view

    Parameters
    error CharSequence

    public void setErrorEnabled (boolean errorEnabled)

    Enable or disable error enabled

    Related XML Attributes
    Parameters
    errorEnabled boolean

    public void setErrorTextAppearance (int resId)

    Set the error text appearance

    Parameters
    resId Style Res

    public void setFocusable (boolean focusable)

    Enable or disable focusable property on the view and all its children

    Parameters
    focusable boolean

    public void setKey (CharSequence keyName)

    Set the key of the cell

    Parameters
    keyName key
    See Also

    public void setKeyTextAppearance (int resId)

    Set the appearance of the key

    Parameters
    resId style resource

    public void setLabelTextAppearanceUnFocused (int labelTextAppearanceUnFocused)

    Set the label text appearance when the view is not focused

    Parameters
    labelTextAppearanceUnFocused Style resource

    public void setLayoutRes (int layoutRes, int recyclerViewId)

    Set the layout resource and recycler view id to be used to inflate the picker

    Parameters
    layoutRes Layout resource
    recyclerViewId recycler view

    public void setLeftToRight (boolean leftToRight)

    Show the check/radio buttons on the start or the end of the layout

    Parameters
    leftToRight boolean

    public void setOverrideKeyStyle (boolean overrideKeyStyle)

    Override the Key styling manually.

    Parameters
    overrideKeyStyle boolean

    public void setOverrideStatusStyle (boolean overrideStatusStyle)

    Override the status i.e. error and helper styling manually

    Parameters
    overrideStatusStyle boolean

    public void setPickerActivity (GenericListPickerFormCellActivity<V, T> listPickerActivity)

    Sets the activity where the intent will be passed and the list of available options will be displayed

    Parameters
    listPickerActivity activity for the item list to be displayed

    public void setSelectButtonColorTint (ColorStateList color)

    Set the tint on icon drawable of the cell

    Parameters
    color ColorStateList tint color state list

    public void setSelectIconDrawable (int res)

    Change the select icon drawable of the cell

    Parameters
    res Drawable resource

    public void setSelectIconDrawable (Drawable res)

    Change the select icon drawable of the cell

    Parameters
    res Drawable

    public void setSelectedItemLabel (CharSequence selectedItemLabel)

    Set the label for "Selected" item section.

    Parameters
    selectedItemLabel CharSequence

    public void setShouldAttachOrientationListener (boolean shouldAttach)

    Determines if an OrientationEventListener should be attached.

    Parameters
    shouldAttach Whether the FormCell should consider attaching an OrientationEventListener or not

    public void setSingleSelectOnly (boolean enableSingleSelect)

    Enable or disable single/multiple selection

    Parameters
    enableSingleSelect boolean

    public void setValue (List<T> value)

    Set the value on the cell i.e. selected items

    Parameters
    value value of the property
    See Also

    public void showSelected (boolean showSelected)

    Show or hide the selected item section on the list picker formcell

    Parameters
    showSelected boolean

    Protected Methods

    protected void adjustMargins ()

    Calculate and set the margins for the cell's elements. Subclasses should override this method to suit their own needs.

    protected static boolean arrayContains (int[] array, int value)

    Check if the array contains the given property

    Parameters
    array array of integer
    value int
    Returns
    • boolean

    protected void drawableStateChanged ()

    Drawable state changed

    protected TextView generateTextView ()

    Generate the text view

    Returns
    • TextView

    protected ViewGroup.LayoutParams getDefaultLayoutParams ()

    protected CharSequence getHelperText ()

    Get the helper text from the view

    Related XML Attributes
    Returns
    • CharSequence

    protected CharSequence getLabel ()

    Get the label on the view

    Related XML Attributes
    Returns
    • CharSequence

    protected void onSizeChanged (int w, int h, int oldw, int oldh)

    protected void replaceStatusView ()

    Each time you add a new view, error/helper view has to be adjusted to be the last view in the layout

    protected void setHelperEnabled (boolean helperEnabled)

    Enable or disable the helper field on the view

    Related XML Attributes
    Parameters
    helperEnabled boolean
    See Also

    protected void setHelperText (CharSequence helper)

    Set the helper text on the view

    Related XML Attributes
    Parameters
    helper CharSequence
    See Also

    protected void setHelperTextAppearance (int helperTextAppearance)

    Set the helper text appearance

    Parameters
    helperTextAppearance style resource

    protected void setLabel (CharSequence key)

    Set the label on the view

    Related XML Attributes
    Parameters
    key CharSequence
    See Also

    protected void setLabelEnabled (boolean keyEnabled)

    Enable or disable the label field on the view

    Related XML Attributes
    Parameters
    keyEnabled boolean
    See Also

    protected void setLabelTextAppearance (int textAppearance)

    Set the text appearance on the label. This changes the appearance when the view is focused and unfocused

    Parameters
    textAppearance style resource

    protected void setLabelTextAppearanceFocused (int textAppearance)

    Set the text appearance on the label when the view is not focused

    Parameters
    textAppearance Style resource

    protected void setLabelTextColorError (ColorStateList color)

    Set the text color of the label for error mode

    Parameters
    color ColorStateList

    protected void setLabelTextColorFocused (ColorStateList color)

    Set the color of label when the view is focused

    Parameters
    color ColorStateList

    protected void setLabelTextColorUnFocused (ColorStateList color)

    Set the color of label when the view is not focused

    Parameters
    color ColorStateList

    protected boolean setupErrorHelperView ()

    Setup the error/helper field on the view

    Returns
    • boolean true: new view is created false:existing view is used

    protected boolean setupLabelView ()

    Setup the label view on the view

    Returns
    • boolean true: new view is created false:existing view is used

    protected boolean shouldLayout (View v)

    Should layout the given view

    Parameters
    v View
    Returns
    • boolean