public class

DurationPickerFormCell

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

Class Overview

DurationPickerFormCell is a control which contains a Key and Value along with a Duration picker Dialog. The user can click the key value view to display a popup dialog to pick the duration on the cell.

DurationPickerFormCell can be used to pick a duration. User of the cell can specify their own display format by setting setDurationTextFormat(String).

Structure of the control :

  • Key : Label view acts as key/tag or name for the view. For example study duration, yoga duration etc. See also : setKey(CharSequence)
  • Value : Value of the cell as Duration See also: setValue(Duration)
  • Summary

    XML Attributes
    Attribute Name Related Method Description
    android:clickable setClickable(boolean)  
    android:enabled setEnabled(boolean)  
    android:focusable setFocusable(boolean)  
    com.sap.cloud.mobile.fiori:dialogTitle  
    com.sap.cloud.mobile.fiori:displayValue String duration value in a formatted string

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

    com.sap.cloud.mobile.fiori:durationPickerStyle  
    com.sap.cloud.mobile.fiori:durationTextFormat setDurationTextFormat(String) String text formatter for the value in hours and minutes. 
    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:hour setHour(int)  
    com.sap.cloud.mobile.fiori:is24Hour set24HourView(boolean)  
    com.sap.cloud.mobile.fiori:isEditable setEditable(boolean) boolean if new duration can be selected using the control

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

    com.sap.cloud.mobile.fiori:key setKey(CharSequence)  
    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:minute setMinute(int)  
    com.sap.cloud.mobile.fiori:minuteInterval Integer steps in which the minutes between 0 - 60 will be divided. 
    com.sap.cloud.mobile.fiori:value setValue(int,int) Integer Duration in seconds

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

    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
    DurationPickerFormCell(Context context)
    DurationPickerFormCell(Context context, AttributeSet attrs)
    DurationPickerFormCell(Context context, AttributeSet attrs, int defStyleAttr)
    DurationPickerFormCell(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<Duration> getCellValueChangeListener()
    Get the CellChangeListener of the cell
    CharSequence getDialogTitle()
    CharSequence getDisplayValue()
    CharSequence getError()
    Get error set on the view
    TextView getErrorView()
    CharSequence getKey()
    Get the key property of the cell
    TextView getKeyView()
    Duration 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 set24HourView(boolean enable)
    Set if the duration picker should be in 24 hour mode
    void setCellValueChangeListener(CellValueChangeListener<Duration> listener)
    Set the listener on the cell
    void setClickable(boolean clickable)
    Enable or disable clickable property on the view and all its children
    void setDialogTitle(CharSequence dialogTitle)
    Set the title on the dialog
    void setDisplayValue(CharSequence displayValue)
    void setDurationTextFormat(String durationTextFormat)
    Sets the string used to format the selected time duration.
    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 setHour(int hour)
    Set the minute on the DurationPickerFormCell
    void setKey(CharSequence key)
    Set the key on the cell
    void setKeyEnabled(boolean keyEnabled)
    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 setMinute(int minute)
    Set the minute on the DurationPickerFormCell
    void setMinuteInterval(int minuteInterval)
    Sets the interval in which the minute scale between 0 - 60 will be divided evenly.
    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(Duration value)
    Set the value on the cell
    void setValue(int hour, int minute)
    Set the value on the cell using given hour and minute
    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 onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect)
    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

    com.sap.cloud.mobile.fiori:dialogTitle

    Related Methods

    com.sap.cloud.mobile.fiori:displayValue

    String duration value in a formatted string

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

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

    Related Methods

    com.sap.cloud.mobile.fiori:durationPickerStyle

    Related Methods

    com.sap.cloud.mobile.fiori:durationTextFormat

    String text formatter for the value in hours and minutes. The default text format is language-specific as specified by the duration_picker_form_cell_duration_text_format string resource.

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

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

    Related Methods

    com.sap.cloud.mobile.fiori:is24Hour

    Related Methods

    com.sap.cloud.mobile.fiori:isEditable

    boolean if new duration can be selected using the control

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

    Related Methods

    com.sap.cloud.mobile.fiori:minuteInterval

    Integer steps in which the minutes between 0 - 60 will be divided. Default value is 5. Minimum value can be 1 and maximum vale will be 30

    May be an integer value, such as "100".

    Related Methods

    com.sap.cloud.mobile.fiori:value

    Integer Duration in seconds

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

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

    May be an integer value, such as "100".

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

    Related Methods

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

    public DurationPickerFormCell (Context context, AttributeSet attrs)

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

    public DurationPickerFormCell (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<Duration> getCellValueChangeListener ()

    Get the CellChangeListener of the cell

    Returns
    • CellValueChangeListener

    public CharSequence getDialogTitle ()

    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 property of the cell

    Related XML Attributes
    Returns
    • key of the cell as CharSequence

    public TextView getKeyView ()

    public Duration getValue ()

    Get the value of the cell.

    Returns

    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 set24HourView (boolean enable)

    Set if the duration picker should be in 24 hour mode

    Related XML Attributes
    Parameters
    enable isEnabled

    public void setCellValueChangeListener (CellValueChangeListener<Duration> 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 setDialogTitle (CharSequence dialogTitle)

    Set the title on the dialog

    Parameters
    dialogTitle CharSequence

    public void setDisplayValue (CharSequence displayValue)

    public void setDurationTextFormat (String durationTextFormat)

    Sets the string used to format the selected time duration. Default text formatter is %d Hrs %d Min where %d is the number of hours and minutes.

    Parameters
    durationTextFormat CharSequence

    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 setHour (int hour)

    Set the minute on the DurationPickerFormCell

    Related XML Attributes
    Parameters
    hour int
    See Also

    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)

    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 setMinute (int minute)

    Set the minute on the DurationPickerFormCell

    Related XML Attributes
    Parameters
    minute int
    See Also

    public void setMinuteInterval (int minuteInterval)

    Sets the interval in which the minute scale between 0 - 60 will be divided evenly. Default is 5. Minimum interval is 1 and maximum can be 30.

    Parameters
    minuteInterval 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 (Duration value)

    Set the value on the cell

    Related XML Attributes
    Parameters
    value value of the property
    See Also

    public void setValue (int hour, int minute)

    Set the value on the cell using given hour and minute

    Related XML Attributes
    Parameters
    hour hour as int
    minute minute as int
    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 onFocusChanged (boolean gainFocus, int direction, Rect previouslyFocusedRect)

    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