public class

FormCellMetadataLayout

extends LinearLayout
java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.LinearLayout
         ↳ com.sap.cloud.mobile.fiori.formcell.FormCellMetadataLayout
Known Direct Subclasses

Class Overview

A base class of FormCells. This view allows user to set key, error and helper text on the FormCell.

Structure

  • Label
  • Label view acts as key/tag or name for the view. For example if you are using SliderFormCell a label can be Distance or Volume. Label is informative name about the control presented by this FormCellMetadataLayout. See {@link #setLabelEnabled(boolean)}.

  • Helper Text
  • Helper Text allows you to provide hint or additional information about the view presented. For example for textual fields you can show minimum and maximum character counts etc. See {@link #setHelperEnabled(boolean)}.

  • Error
  • It is often required to perform a validation on the user input and show the error if the inputs are not valid then it is preferable to provide the feedback as error. See setError(CharSequence), and setErrorEnabled(boolean).

Summary

XML Attributes
Attribute Name Related Method Description
FormCellMetadataLayout_android_clickable setClickable(boolean)  
FormCellMetadataLayout_android_enabled setEnabled(boolean)  
FormCellMetadataLayout_android_focusable setFocusable(boolean)  
FormCellMetadataLayout_error setErrorTextAppearance(int)  
FormCellMetadataLayout_errorEnabled setErrorEnabled(boolean)  
FormCellMetadataLayout_errorTextAppearance  
FormCellMetadataLayout_helperEnabled setHelperEnabled(boolean)  
FormCellMetadataLayout_helperText setHelperText(CharSequence)  
FormCellMetadataLayout_helperTextTextAppearance setHelperTextAppearance(int)  
FormCellMetadataLayout_keyTextAppearanceFocused  
FormCellMetadataLayout_keyTextAppearanceUnFocused  
FormCellMetadataLayout_label setLabel(CharSequence)  
FormCellMetadataLayout_labelEnabled setLabelEnabled(boolean)  
FormCellMetadataLayout_labelTextAppearance setLabelTextAppearanceFocused(int)  
FormCellMetadataLayout_labelTextAppearanceFocused setLabelTextAppearanceFocused(int)  
FormCellMetadataLayout_labelTextAppearanceUnFocused setLabelTextAppearanceFocused(int)  
[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
FormCellMetadataLayout(Context context)
FormCellMetadataLayout(Context context, AttributeSet attrs)
FormCellMetadataLayout(Context context, AttributeSet attrs, int defStyleAttr)
FormCellMetadataLayout(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
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
void setClickable(boolean clickable)
Enable or disable clickable property on the view and all its children
void setEnabled(boolean enabled)
Enable or disable the view
void setFocusable(boolean focusable)
Enable or disable focusable property on the view and all its children
void setLabelTextAppearanceUnFocused(int labelTextAppearanceUnFocused)
Set the label text appearance when the view is not focused
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.
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 getError()
Get the error
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 setError(CharSequence error)
Set the error on the view.
void setErrorEnabled(boolean errorEnabled)
Enable or disable the error field on the view
void setErrorTextAppearance(int errorTextAppearance)
Set the text appearance on the error
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

XML Attributes

FormCellMetadataLayout_android_clickable

Related Methods

FormCellMetadataLayout_android_enabled

Related Methods

FormCellMetadataLayout_android_focusable

Related Methods

FormCellMetadataLayout_error

Related Methods

FormCellMetadataLayout_errorEnabled

Related Methods

FormCellMetadataLayout_errorTextAppearance

Related Methods

FormCellMetadataLayout_helperEnabled

Related Methods

FormCellMetadataLayout_helperText

Related Methods

FormCellMetadataLayout_helperTextTextAppearance

FormCellMetadataLayout_keyTextAppearanceFocused

Related Methods

FormCellMetadataLayout_keyTextAppearanceUnFocused

Related Methods

FormCellMetadataLayout_label

Related Methods

FormCellMetadataLayout_labelEnabled

Related Methods

FormCellMetadataLayout_labelTextAppearance

FormCellMetadataLayout_labelTextAppearanceFocused

FormCellMetadataLayout_labelTextAppearanceUnFocused

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

public FormCellMetadataLayout (Context context, AttributeSet attrs)

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

public FormCellMetadataLayout (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 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 void setClickable (boolean clickable)

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

Parameters
clickable boolean

public void setEnabled (boolean enabled)

Enable or disable the view

Parameters
enabled boolean

public void setFocusable (boolean focusable)

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

Parameters
focusable boolean

public void setLabelTextAppearanceUnFocused (int labelTextAppearanceUnFocused)

Set the label text appearance when the view is not focused

Parameters
labelTextAppearanceUnFocused Style resource

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

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 getError ()

Get the error

Related XML Attributes
Returns
  • CharSequence

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 setError (CharSequence error)

Set the error on the view. If the view is not error enabled then this API does not take any effect.

Parameters
error CharSequence

protected void setErrorEnabled (boolean errorEnabled)

Enable or disable the error field on the view

Related XML Attributes
Parameters
errorEnabled boolean
See Also

protected void setErrorTextAppearance (int errorTextAppearance)

Set the text appearance on the error

Related XML Attributes
Parameters
errorTextAppearance style resource

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