public class

ContactCell

extends AbstractEntityCell
java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ com.sap.cloud.mobile.fiori.object.AbstractEntityCell
         ↳ com.sap.cloud.mobile.fiori.contact.ContactCell
Known Direct Subclasses

Class Overview

The Contact Cell fits inside ListView or RecyclerView. It is used to give quick access to the various methods of communicating with a contact. It is commonly found in an Object and Object Details floor plan. Up to four action icons can be used, however, on a compact view, a profile image cannot be used if fours action icons are to be used. Action icons can be created in XML via "contactActions" attribute:

     app:contactActions="CALL,EMAIL,VIDEO_CALL,MESSAGE"
 
or via "ImageButton" child elements:
    <ImageButton
        android:id="@+id/contactCell4_s1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_phone_black_24dp"
        />
    <ImageButton
        android:id="@+id/contactCell4_s2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_email_black_24dp"
        />

 
or in code:
     cc.setContactActions(ContactCell.ContactAction.CALL, ContactCell.ContactAction.EMAIL,
          ContactCell.ContactAction.VIDEO_CALL, ContactCell.ContactAction.MESSAGE);
 
After ImageButtons are created, they can be accessed via getContactActionView(int) so that you can change the icon or hook up an View.OnClickListener.

Summary

Nested Classes
enum ContactCell.ContactAction With setContactActions(ContactAction), shows specified actions for contact cell. 
class ContactCell.LayoutParams Layout information for child views of an ContactCell. 
class ContactCell.Measurement Wraps measurement information so that they can be returned in a method  
XML Attributes
Attribute Name Related Method Description
com.sap.cloud.mobile.fiori:contactActions setContactActions(ContactAction) The actions that can be applied to the current ContactCell. 
com.sap.cloud.mobile.fiori:layout_contact_group Specifies which layout group the child view should belong. 
[Expand]
Inherited XML Attributes
From class com.sap.cloud.mobile.fiori.object.AbstractEntityCell
[Expand]
Inherited Constants
From class com.sap.cloud.mobile.fiori.object.AbstractEntityCell
From class android.view.ViewGroup
From class android.view.View
Fields
protected int mCellHeight
protected ColorStateList mImageTintList
[Expand]
Inherited Fields
From class com.sap.cloud.mobile.fiori.object.AbstractEntityCell
From class android.view.View
Public Constructors
ContactCell(Context context)
ContactCell(Context context, AttributeSet attrs)
ContactCell(Context context, AttributeSet attrs, int defStyle)
ContactCell(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
Public Methods
void addView(View child, int index, ViewGroup.LayoutParams params)
ContactCell.LayoutParams generateLayoutParams(AttributeSet attrs)
int getContactActionCounts()
Returns the number of actions
ImageButton getContactActionView(int index)
Returns the ImageButton at the specified index.
void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info)
void removeView(View view)
void resetCell()
Resets the cell to its initial state (i.e., re-applies all of the styling that was used at the time the cell was constructed).
void setContactActions(ContactAction... actions)
Creates ImageButtons according to the parameter.
void setHeadlineLines(int headlineLines)
For ContactCell, only 1 and 2 are accepted
void setLines(int lines)
Overrides to support at most 2 lines on a phone(name and title).
Protected Methods
void addViewToGroup(View v, int group)
Adds the view into specified group.
void configureDescriptionLayout()
Vertically center aligns description when appropriate.
ContactCell.LayoutParams generateDefaultLayoutParams()
ContactCell.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p)
ColorStateList getContactActionImageTintList()
Returns the ColorStateList that will be used for contact action images.
int getContactActionLimit()
Returns how many action icons can be shown.
int getMaxLines()
Returns the max number of lines supported by this cell.
int getRecommendedHeight()
Returns the recommended height by material design
int getRemainedDescriptionWidth(int parentWidthSpec, int endWidthUsed)
Calculates how much width is left for headline if description is present
int getRemainedWidth(int parentWidthSpec, int widthUsed)
Calculates how much width is left
void layoutActions(boolean isRtl, int top, int height, int left, int right)
Layouts contact actions
ContactCell.Measurement measureActions(int parentWidthSpec, int width, int childState)
Measures contact actions.
void onLayout(boolean changed, int l, int t, int r, int b)
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
boolean shouldLayoutContactActions()
Returns whether contact actions should be rendered.
boolean verticalCenterAlignTitle()
Returns whether name and title should be center-aligned with image
[Expand]
Inherited Methods
From class com.sap.cloud.mobile.fiori.object.AbstractEntityCell
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.object.KeylineProvider

XML Attributes

com.sap.cloud.mobile.fiori:contactActions

The actions that can be applied to the current ContactCell. This is a comma-separated list of values, containing one or more of the following: ContactCell.ContactAction. This corresponds to setContactActions(ContactAction).

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

com.sap.cloud.mobile.fiori:layout_contact_group

Specifies which layout group the child view should belong. This must be set for any child views of an ContactCell, otherwise the view will be ignored.

Must be one of the following constant values.

ConstantValueDescription
ACTION1Designates a view to show in ContactCell actions group. This is the default if not specified.
INTERNAL0Reserved for internal usage

Related Methods

Fields

protected int mCellHeight

protected ColorStateList mImageTintList

Public Constructors

public ContactCell (Context context)

public ContactCell (Context context, AttributeSet attrs)

public ContactCell (Context context, AttributeSet attrs, int defStyle)

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

Public Methods

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

public ContactCell.LayoutParams generateLayoutParams (AttributeSet attrs)

public int getContactActionCounts ()

Returns the number of actions

public ImageButton getContactActionView (int index)

Returns the ImageButton at the specified index.

Throws
IndexOutOfBoundsException if the index is out of range (index < 0 || index >= size())

public void onInitializeAccessibilityNodeInfo (AccessibilityNodeInfo info)

public void removeView (View view)

public void resetCell ()

Resets the cell to its initial state (i.e., re-applies all of the styling that was used at the time the cell was constructed).

public void setContactActions (ContactAction... actions)

Creates ImageButtons according to the parameter. ImageButtons can be retrieved by getContactActionView(int). If the same actions array is used to call this method again, no view removal and addition will be performed to avoid performance overhead. Caller needs to enable/disable the ImageButtons and reset View.OnClickListeners respectively.

public void setHeadlineLines (int headlineLines)

For ContactCell, only 1 and 2 are accepted

Parameters
headlineLines line number, only 1 and 2 are accepted

public void setLines (int lines)

Overrides to support at most 2 lines on a phone(name and title).

Parameters
lines cell lines, could be 1 to getMaxLines() for fixed number or 0 for dynamic layout

Protected Methods

protected void addViewToGroup (View v, int group)

Adds the view into specified group.

Parameters
v view
group group

protected void configureDescriptionLayout ()

Vertically center aligns description when appropriate.

protected ContactCell.LayoutParams generateDefaultLayoutParams ()

protected ContactCell.LayoutParams generateLayoutParams (ViewGroup.LayoutParams p)

protected ColorStateList getContactActionImageTintList ()

Returns the ColorStateList that will be used for contact action images.

protected int getContactActionLimit ()

Returns how many action icons can be shown.

protected int getMaxLines ()

Returns the max number of lines supported by this cell.

protected int getRecommendedHeight ()

Returns the recommended height by material design

protected int getRemainedDescriptionWidth (int parentWidthSpec, int endWidthUsed)

Calculates how much width is left for headline if description is present

protected int getRemainedWidth (int parentWidthSpec, int widthUsed)

Calculates how much width is left

protected void layoutActions (boolean isRtl, int top, int height, int left, int right)

Layouts contact actions

protected ContactCell.Measurement measureActions (int parentWidthSpec, int width, int childState)

Measures contact actions.

protected void onLayout (boolean changed, int l, int t, int r, int b)

protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec)

protected boolean shouldLayoutContactActions ()

Returns whether contact actions should be rendered.

protected boolean verticalCenterAlignTitle ()

Returns whether name and title should be center-aligned with image