public class

DateTimePickerFormCell

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.DateTimePickerFormCell

Class Overview

DateTimePickerFormCell FormCell is a control which contains a Key and Value along with a Date/Time picker Dialog. The user can click the key value view to display a popup dialog having Date/Time Picker Dialog.

DateTimePickerFormCell can be used to pick a date, pick a time or to pick both. Using DateTimePicker.DateTimePickerMode the cell allows you to control what kind of value (date) an end user can pick. Developer can choose the mode for the cell setDateTimePickerMode(DateTimePicker.DateTimePickerMode) using setDateTimePickerMode(DateTimePicker.DateTimePickerMode). The default mode is DATE_TIME_PICKER. By default, the user's locale date and time format will be used to show the date and time value. Developer can specify their own DateFormat by setting setDateTimeFormatter(DateFormat).

Structure of the control :

  • Key : Label view acts as key/tag or name for the view. For example travel date, meeting etc. See also : setKey(CharSequence)
  • Value : Value of the cell as Date See also: setValue(Date)
  • Summary

    XML Attributes
    Attribute Name Related Method Description
    android:clickable setClickable(boolean)  
    android:enabled setEnabled(boolean)  
    android:focusable setFocusable(boolean)  
    android:maxLines  
    android:textColor  
    com.sap.cloud.mobile.fiori:dateTimeFormatter setDateTimeFormatter(DateFormat) String formatter for the date/time value

    May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character; 

    com.sap.cloud.mobile.fiori:dateTimePickerMode enum date/time picker control mode 0 for date only, 1 for time only, 2 for both date and time

    Must be one of the following constant values. 

    com.sap.cloud.mobile.fiori:errorEnabled isErrorEnabled() Whether the layout is laid out as if an error will be displayed. 
    com.sap.cloud.mobile.fiori:helperEnabled isHelperEnabled()  
    com.sap.cloud.mobile.fiori:helperText setHelperText(CharSequence)  
    com.sap.cloud.mobile.fiori:helperTextTextAppearance setHelperTextAppearance(int)  
    com.sap.cloud.mobile.fiori:isEditable setEditable(boolean) Set to false if the control if the control is readOnly else true. 
    com.sap.cloud.mobile.fiori:key setKeyEnabled(boolean)  
    com.sap.cloud.mobile.fiori:keyEnabled  
    com.sap.cloud.mobile.fiori:keyTextAppearance setKeyTextAppearance(int) Text color, typeface, size, and style for key label. 
    com.sap.cloud.mobile.fiori:label setLabel(CharSequence)  
    com.sap.cloud.mobile.fiori:labelEnabled setLabelEnabled(boolean)  
    com.sap.cloud.mobile.fiori:labelTextAppearance setLabelTextAppearanceFocused(int)  
    com.sap.cloud.mobile.fiori:labelTextAppearanceFocused setLabelTextAppearanceFocused(int)  
    com.sap.cloud.mobile.fiori:labelTextAppearanceUnFocused setLabelTextAppearanceFocused(int)  
    com.sap.cloud.mobile.fiori:valueTextAppearance setValueTextColor(int) Text color, typeface, size, and style for value. 
    [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
    DateTimePickerFormCell(Context context)
    DateTimePickerFormCell(Context context, AttributeSet attrs)
    DateTimePickerFormCell(Context context, AttributeSet attrs, int defStyleAttr)
    DateTimePickerFormCell(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
    Public Methods
    void addView(View child, int index, ViewGroup.LayoutParams params)
    Add given view in the view
    int getCellType()
    Get the cell widget type from FormCell.WidgetType
    CellValueChangeListener<Date> getCellValueChangeListener()
    Get the CellChangeListener of the cell
    DateFormat getDateTimeFormatter()
    Get the date time formatter used to format the cell value into informative message
    DateTimePicker.DateTimePickerMode getDateTimePickerMode()
    Return the mode of the DateTimePicker.
    CharSequence getDisplayValue()
    Get the display value of the cell.
    CharSequence getError()
    Get error set on the view
    TextView getErrorView()
    CharSequence getKey()
    Get the key property of the cell
    TextView getKeyView()
    Date getValue()
    Get the value of the Cell.
    TextView getValueView()
    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 onInterceptTouchEvent(MotionEvent ev)
    boolean performClick()
    void setCellValueChangeListener(CellValueChangeListener<Date> listener)
    Set the listener on the cell
    void setClickable(boolean clickable)
    Enable or disable clickable property on the view and all its children
    void setDateTimeFormatter(DateFormat dateTimeFormatter)
    Set the date time formatter used to format the cell value into informative message
    void setDateTimePickerMode(DateTimePicker.DateTimePickerMode dateTimePickerMode)
    Sets the mode for DateTimePicker
    void setDisplayValue(CharSequence displayValue)
    Set the display value.
    void setDisplayValue(Date value)
    Set display value from the given date.
    void setEditable(boolean isEditable)
    Enable or disable the cell's editable property
    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 setHelperEnabled(boolean enabled)
    Enable or disable helper field on the view
    void setKey(CharSequence key)
    Set the key on the cell
    void setKeyEnabled(boolean keyEnabled)
    Enable or disable the key field
    void setKeyTextAppearance(int resId)
    Set the key Text appearance
    void setKeyTextColor(ColorStateList colorStateList)
    Set the color of the value
    void setLabelTextAppearanceUnFocused(int labelTextAppearanceUnFocused)
    Set the label text appearance when the view is not focused
    void setMaxLines(int lines)
    Set max lines on value
    void setMinLines(int minLines)
    Set minimum number of lines on display value
    void setOverrideKeyStyle(boolean overrideKeyStyle)
    Override the Key styling manually.
    void setOverrideStatusStyle(boolean overrideStatusStyle)
    Override the status i.e.
    void setShouldAttachOrientationListener(boolean shouldAttach)
    Determines if an OrientationEventListener should be attached.
    void setValue(Date value)
    Set the value on the cell
    void setValueTextAppearance(int resId)
    Set the text appearance of the value property
    void setValueTextColor(ColorStateList color)
    Set the color of the value
    void setValueTextColor(int resId)
    Set the color of the value
    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 onRestoreInstanceState(Parcelable state)
    Parcelable onSaveInstanceState()
    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 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

    android:clickable

    Related Methods

    android:enabled

    Related Methods

    android:focusable

    Related Methods

    android:maxLines

    Related Methods

    android:textColor

    Related Methods

    com.sap.cloud.mobile.fiori:dateTimeFormatter

    String formatter for the date/time value

    May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character;

    com.sap.cloud.mobile.fiori:dateTimePickerMode

    enum date/time picker control mode 0 for date only, 1 for time only, 2 for both date and time

    Must be one of the following constant values.

    ConstantValueDescription
    date0
    date_time2
    time1

    Related Methods

    com.sap.cloud.mobile.fiori:errorEnabled

    Whether the layout is laid out as if an error will be displayed.

    May be a boolean value, such as "true" or "false".

    Related Methods

    com.sap.cloud.mobile.fiori:helperEnabled

    Related Methods

    com.sap.cloud.mobile.fiori:helperText

    Related Methods

    com.sap.cloud.mobile.fiori:helperTextTextAppearance

    com.sap.cloud.mobile.fiori:isEditable

    Set to false if the control if the control is readOnly else true. Labels and text values will be selectable if the control is in readOnly mode.

    May be a boolean value, such as "true" or "false".

    Related Methods

    com.sap.cloud.mobile.fiori:key

    Related Methods

    com.sap.cloud.mobile.fiori:keyEnabled

    Related Methods

    com.sap.cloud.mobile.fiori:keyTextAppearance

    Text color, typeface, size, and style for key label. Defaults to sap_ui_content_label_color color. Default style: TextAppearance_Fiori_KeyValueCell_Key

    May be a reference to another resource, in the form "@[+][package:]type/name" or a theme attribute in the form "?[package:]type/name".

    Related Methods

    com.sap.cloud.mobile.fiori:label

    Related Methods

    com.sap.cloud.mobile.fiori:labelEnabled

    Related Methods

    com.sap.cloud.mobile.fiori:labelTextAppearance

    com.sap.cloud.mobile.fiori:labelTextAppearanceFocused

    com.sap.cloud.mobile.fiori:labelTextAppearanceUnFocused

    com.sap.cloud.mobile.fiori:valueTextAppearance

    Text color, typeface, size, and style for value. Defaults to sap_ui_base_text color. Default style: TextAppearance_Fiori_KeyValueCell_Value

    May be a reference to another resource, in the form "@[+][package:]type/name" or a theme attribute in the form "?[package:]type/name".

    Related Methods

    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 DateTimePickerFormCell (Context context)

    public DateTimePickerFormCell (Context context, AttributeSet attrs)

    public DateTimePickerFormCell (Context context, AttributeSet attrs, int defStyleAttr)

    public DateTimePickerFormCell (Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)

    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 int getCellType ()

    Get the cell widget type from FormCell.WidgetType

    Returns
    • WidgetType type of the control

    public CellValueChangeListener<Date> getCellValueChangeListener ()

    Get the CellChangeListener of the cell

    Returns
    • CellValueChangeListener

    public DateFormat getDateTimeFormatter ()

    Get the date time formatter used to format the cell value into informative message

    Returns
    • DateFormat

    public DateTimePicker.DateTimePickerMode getDateTimePickerMode ()

    Return the mode of the DateTimePicker.

    Returns
    • DateTimePickerMode mode of DateTimePicker

    public CharSequence getDisplayValue ()

    Get the display value of the cell.

    Returns
    • display value as CharSequence

    public CharSequence getError ()

    Get error set on the view

    Returns
    • error as CharSequence

    public TextView getErrorView ()

    public CharSequence getKey ()

    Get the key property of the cell

    Related XML Attributes
    Returns
    • key of the cell as CharSequence

    public TextView getKeyView ()

    public Date getValue ()

    Get the value of the Cell.

    Returns
    • Date
    See Also

    public TextView getValueView ()

    public boolean isEditable ()

    Get is the cell is editable.

    Related XML Attributes
    Returns
    • boolean

    public boolean isErrorEnabled ()

    Is error enabled on the view

    Returns
    • boolean

    public boolean isHelperEnabled ()

    Set if the helper field is enabled on the view

    Returns
    • boolean

    public boolean isLabelEnabled ()

    Is the label field on the view is enabled

    Returns
    • boolean

    public boolean onInterceptTouchEvent (MotionEvent ev)

    public boolean performClick ()

    public void setCellValueChangeListener (CellValueChangeListener<Date> listener)

    Set the listener on the cell

    Parameters
    listener value change listener of the control

    public void setClickable (boolean clickable)

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

    Related XML Attributes
    Parameters
    clickable boolean

    public void setDateTimeFormatter (DateFormat dateTimeFormatter)

    Set the date time formatter used to format the cell value into informative message

    Parameters
    dateTimeFormatter DateFormat

    public void setDateTimePickerMode (DateTimePicker.DateTimePickerMode dateTimePickerMode)

    Sets the mode for DateTimePicker

    Parameters
    dateTimePickerMode DateTimePickerMode

    public void setDisplayValue (CharSequence displayValue)

    Set the display value.

    Parameters
    displayValue CharSequence

    public void setDisplayValue (Date value)

    Set display value from the given date.

    Parameters
    value Date

    public void setEditable (boolean isEditable)

    Enable or disable the cell's editable property

    Related XML Attributes
    Parameters
    isEditable boolean
    See Also

    public void setEnabled (boolean enabled)

    Enable or disable the view

    Related XML Attributes
    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

    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

    Related XML Attributes
    Parameters
    focusable boolean

    public void setHelperEnabled (boolean enabled)

    Enable or disable helper field on the view

    Parameters
    enabled boolean

    public void setKey (CharSequence key)

    Set the key on the cell

    Related XML Attributes
    Parameters
    key key of the cell as CharSequence
    See Also

    public void setKeyEnabled (boolean keyEnabled)

    Enable or disable the key field

    Related XML Attributes
    Parameters
    keyEnabled boolean

    public void setKeyTextAppearance (int resId)

    Set the key Text appearance

    Parameters
    resId int

    public void setKeyTextColor (ColorStateList colorStateList)

    Set the color of the value

    Parameters
    colorStateList ColorStateList

    public void setLabelTextAppearanceUnFocused (int labelTextAppearanceUnFocused)

    Set the label text appearance when the view is not focused

    Parameters
    labelTextAppearanceUnFocused Style resource

    public void setMaxLines (int lines)

    Set max lines on value

    Parameters
    lines int

    public void setMinLines (int minLines)

    Set minimum number of lines on display value

    Parameters
    minLines int

    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 setShouldAttachOrientationListener (boolean shouldAttach)

    Determines if an OrientationEventListener should be attached.

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

    public void setValue (Date value)

    Set the value on the cell

    Parameters
    value value of the property
    See Also

    public void setValueTextAppearance (int resId)

    Set the text appearance of the value property

    Parameters
    resId int

    public void setValueTextColor (ColorStateList color)

    Set the color of the value

    Parameters
    color ColorStateList

    public void setValueTextColor (int resId)

    Set the color of the value

    Parameters
    resId Color resource as int

    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 onRestoreInstanceState (Parcelable state)

    protected Parcelable onSaveInstanceState ()

    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 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

    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