public class

ObjectCell

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

Class Overview

A list item that shows a business object.

Structure

  • Icon Stack
  • A set of up to 3 vertically stacked icons can be displayed on the far left. These icons indicate something about the object, such as its unread status or that it has attachments. See addIcon, clearIconStack, and getIconStack. See setIcon(Drawable, int, CharSequence).

  • Detail Image
  • An image representing the object can be set. See setDetailImage(Drawable).

  • Headline
  • The headline/title is the main area for text content. The title is the only mandatory content for the Object Cell. See setHeadline(int), and getHeadline().

  • Sub headline
  • The sub headline is under headline to show more information. See setSubheadline(int), and getSubheadline().

  • Footnote
  • The footnote is under sub headline and shows further information. See setFootnote(int), and getFootnote().

  • Description
  • If a description has been defined, it will appear in regular mode only. This is typically a longer string of text than what is displayed in the title content. See setDescription(int), and getDescription().

  • Status
  • If an object has an attribute, such as a status, associated with it, it can be displayed on the right, in front of the accessory view. Up to two attributes can be displayed, stacked vertically. The attribute can be in the form of text or icon. See setStatus(Drawable, int, CharSequence), setStatusColor(int, int) and clearStatuses().

    Status view can also be created as child view of ObjectCell. layout_group="STATUS" must be specified for the status view in XML.

     <ObjectCell
         xmlns:android="http://schemas.android.com/apk/res/android"
         android:layout_width="match_parent"
         android:layout_height="wrap_content">
         <ImageView
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             app:layout_group="STATUS"
             />
         <TextView
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             app:layout_group="STATUS"
             />
     </ObjectCell>
     
  • Secondary action
  • The secondary action is usually an information disclosure icon, which would bring up a model. It can also be used for actions, such as download. See setSecondaryActionIcon(Drawable) , setSecondaryActionIconDescription(int) and setSecondaryActionOnClickListener(View.OnClickListener).

    To set listener in XML, an android.databinding.BindingMethod is required. E.g.

          @BindingMethods({
             @BindingMethod(type = ObjectCell.class, attribute = "onActionClick", method = "setSecondaryActionOnClickListener"),
          })
     
Sample code in an androidx.recyclerview.widget.RecyclerView.Adapter:

     public void onBindViewHolder(ViewHolder holder,
        int position) {
         BizObject obj = mObjects.get(position);
         ObjectCell cell = holder.objectCell;

         RequestOptions cropOptions = new RequestOptions().circleCrop().placeholder(R.drawable.circle);
         mGlide.load(obj.getDetailmageUri()).apply(cropOptions).into(
            cell.prepareDetailImageView());
         cell.setDetailImageDescription(R.string.avatar);

         cell.setHeadline(obj.getHeadline());
         cell.setSubheadline(obj.getSubHeadline());
         cell.setFootnote(obj.getFootnote());
         cell.setDescription(obj.getDescription());
         cell.setStatus(obj.getPriority().toString(), 0);
         cell.setSecondaryActionIcon(R.drawable.ic_cloud_download_black_24dp);
         cell.setSecondaryActionIconDescription(R.string.download);
         cell.setSecondaryActionOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
                 ObjectCell parent = (ObjectCell) v.getParent();
                 Toast toast = Toast.makeText(v.getContext(),
                 "Item: " + parent.getHeadline() + " is clicked.",
                 Toast.LENGTH_SHORT);
                 toast.show();
             }
         });
     }
 

Summary

Nested Classes
class ObjectCell.LayoutParams  
XML Attributes
Attribute Name Related Method Description
AbstractEntityCell_description  
AbstractEntityCell_descriptionTextAppearance  
AbstractEntityCell_descriptionWidthPercent  
AbstractEntityCell_detailImage  
AbstractEntityCell_detailImageCharacter  
AbstractEntityCell_detailImageDescription  
AbstractEntityCell_headline  
AbstractEntityCell_headlineLines  
AbstractEntityCell_headlineTextAppearance  
AbstractEntityCell_lines  
AbstractEntityCell_preserveDetailImageSpacing  
AbstractEntityCell_subheadline  
AbstractEntityCell_subheadlineLines  
AbstractEntityCell_subheadlineTextAppearance  
ObjectCell_Layout_layout_group  
ObjectCell_dynamicStatusWidth setDynamicStatusWidth(boolean)  
ObjectCell_footnote setFootnote(CharSequence)  
ObjectCell_footnoteLines setFootnoteLines(int)  
ObjectCell_footnoteTextAppearance setFootnoteTextAppearance(int)  
ObjectCell_preserveIconImageContainer setPreserveIconImageContainer(boolean)  
ObjectCell_preserveIconStackSpacing setPreserveIconStackSpacing(boolean)  
ObjectCell_secondaryActionDescription setSecondaryActionIconDescription(int)  
ObjectCell_secondaryActionIcon setSecondaryActionIcon(int)  
ObjectCell_statusWidth setStatusWidth(int)  
[Expand]
Inherited XML Attributes
From class com.sap.cloud.mobile.fiori.object.AbstractEntityCell
Constants
int DISMISS_DURATION
int SHOW_DURATION
[Expand]
Inherited Constants
From class com.sap.cloud.mobile.fiori.object.AbstractEntityCell
From class android.view.ViewGroup
From class android.view.View
Fields
public static final int CRITICAL
public static final int NEGATIVE
public static final int POSITIVE
protected List<View> mAttributeIconViews
protected CheckBox mCheckBox
protected int mDefaultStatusTextColor
protected int mDefaultTagTextColor
protected StaticLayout mFootnoteLayout
protected int mFootnoteLines
protected StaticLayoutTextView mFootnoteTextView
protected int mFootnoteWidth
protected boolean mIsAnimating
protected boolean mIsDismissing
protected boolean mIsSelectable
protected boolean mIsShown
protected int mMaxStatusSize
protected List<View> mRemovedStatusViews
protected List<Integer> mStatusColors
protected List<Boolean> mStatusIconsPlacements
protected List<View> mStatusLabelViews
protected int mStatusLineHeight
protected float mStatusTextSize
protected int mStatusVerticalPadding
protected List<View> mStatusViews
protected int mStatusWidth
protected List<Integer> mTagColors
protected int mTagLineHeight
protected List<Integer> mTagTints
protected List<View> mTagViews
protected ImageView mUnreadIcon
[Expand]
Inherited Fields
From class com.sap.cloud.mobile.fiori.object.AbstractEntityCell
From class android.view.View
Public Constructors
ObjectCell(Context context)
ObjectCell(Context context, AttributeSet attrs)
ObjectCell(Context context, AttributeSet attrs, int defStyle)
ObjectCell(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
Public Methods
void addView(View child, int index, ViewGroup.LayoutParams params)
void clearAttributeIcons()
Clears all attribute icon views.
void clearIcons()
Clears all icon views.
void clearStatuses()
Clears all status views.
void clearTags()
Removes all tag views.
void dismiss(int duration, int delay)
void dismiss()
ObjectCell.LayoutParams generateLayoutParams(AttributeSet attrs)
int getAttributeIconColor(int index)
Gets the attribute icon color at the specified index.
View getAttributeIconView(int index)
CheckBox getCheckBox()
int getDefaultIconColor()
Returns the default color for ImageView inside icon stack.
int getDefaultIconLabelColor()
Returns the default color for TextView inside icon stack.
int getDefaultStatusColor()
Returns the default color that can be used for status TextView or ImageView.
CharSequence getFootnote()
Gets the footnote of the object cell.
int getFootnoteLines()
Gets the number of lines of footnote text view
int getIconColor(int index)
Gets the icon color at the specified index.
View getIconView(int index)
boolean getIsAnimating()
boolean getIsChecked()
boolean getIsDismissing()
boolean getIsSelectable()
boolean getIsShown()
boolean getPreserveIconImageContainer()
Returns whether to preserve the container for icon stack and detail image.
boolean getPreserveIconStackSpacing()
Returns true if to preserve icon stack space even when there is no icon
Drawable getSecondaryActionIcon()
Return the current secondary action icon drawable.
CharSequence getSecondaryActionIconDescription()
Return the description of the object cell's secondary action icon.
int getStatusColor(int index)
Gets the status color at the specified index.
int getStatusWidth()
Returns the fixed status width
int getTagTextColor(int index)
Returns the text color for the tag specified by index.
int getTagTint(int index)
Returns the tint color for the tag specified by index.
ImageView getUnreadIcon()
void hideSecondaryActionView()
Hide the secondary action view.
boolean isActionTopAlign()
Returns whether the secondary action is top aligned.
boolean isDynamicStatusWidth()
Returns whether to use dynamic status width to make efficient use of space when status' width varies a lot from cell to cell.
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 setActionTopAlign(boolean actionTopAlign)
Sets whether the secondary action is top aligned.
void setAttributeIcon(Drawable drawable, int index, CharSequence contentDescription)
Sets an attribute icon.
void setAttributeIcon(int resId, int index, int contentDescId)
Sets an attribute icon.
void setAttributeIconColor(int color, int index)
Sets the attribute icon color at the specified index.
void setCheckBoxListener(View.OnClickListener listener)
void setDynamicStatusWidth(boolean dynamicStatusWidth)
Sets whether to use dynamic status width to make efficient use of space when status' width varies a lot from cell to cell.
void setFootnote(int resId)
Sets the footnote of this object cell.
void setFootnote(CharSequence footnote)
Sets the footnote of the object cell.
void setFootnoteColor(int color)
Sets the text color for footnote.
void setFootnoteFont(Typeface font)
Sets the text font for footnote.
void setFootnoteFont(int fontId)
Sets the text font for footnote.
void setFootnoteLines(int footnoteLines)
Sets the number of lines of footnote text view
void setFootnoteSize(float size)
Sets the text size for footnote.
void setFootnoteTextAppearance(int resId)
Sets the text color, size, style, hint color, and highlight color for footnote from the specified TextAppearance resource.
void setIcon(int resId, int index, int contentDescId)
Sets an icon.
void setIcon(int iconId, int index)
Sets an icon.
void setIcon(Drawable drawable, int index, CharSequence contentDescription)
Sets an icon.
void setIcon(CharSequence icon, int index)
Sets an icon.
void setIconColor(int color, int index)
Sets the icon color
void setIsChecked(boolean checked)
void setIsSelectable(boolean isSelectable)
void setIsShown(boolean isShown)
void setPreserveIconImageContainer(boolean preserveIconImageContainer)
Sets whether to preserve the container for icon stack and detail image.
void setPreserveIconStackSpacing(boolean preserveIconStackSpacing)
Preserves spacing for icon stack
void setSecondaryActionIcon(Drawable drawable)
Sets a secondary action icon drawable.
void setSecondaryActionIcon(int resId)
Sets a secondary action icon drawable from a resource id.
void setSecondaryActionIconDescription(CharSequence description)
Set a description of the object cell's secondaryActionIcon.
void setSecondaryActionIconDescription(int resId)
Set a description of the object cell's secondary action icon.
void setSecondaryActionOnClickListener(View.OnClickListener listener)
Set a listener to respond to secondary action icon click event.
void setStatus(CharSequence status, int index)
Sets a status.
void setStatus(int statusId, int index)
Sets a status.
void setStatus(Drawable drawable, int index, CharSequence contentDescription)
Sets a status.
void setStatus(int resId, int index, int contentDescId)
Sets a status.
void setStatusColor(int color, int index)
Sets the status color
void setStatusLabel(CharSequence label, int index)
Sets a text label to appear next to a status icon.
void setStatusLeadingIcon(int index, boolean isLeading)
Specifies if the status icon should be leading or trailing the label.
void setStatusTextAppearance(int resId, int index)
Sets the text color, size, style, hint color, and highlight color for status text from the specified TextAppearance resource.
void setStatusTextFont(int fontId, int index)
Sets the text font for status text.
void setStatusTextFont(Typeface font, int index)
Sets the text font for status text.
void setStatusTextSize(float size, int index)
Sets the text size for status text.
void setStatusWidth(int statusWidth)
Sets the fixed status width
void setTag(int tagResId, int index)
Sets a tag.
void setTag(CharSequence tag, int index)
Sets a tag.
void setTagTextColor(int color, int index)
Sets the text color for the tag specified by index.
void setTagTint(int color, int index)
Sets the tint color for the tag specified by index.
void setUnreadIcon(Drawable drawable)
void show(int duration, int delay)
void show()
void showSecondaryActionView()
Show the secondary action view.
void updateUiOnRead()
Update UI depending on the isRead status of the AbstractEntityCell If the cell is read, the headline text appearance should be using SubheadlineTextAppearance.
void updateUiOnSelected()
A checkmark icon will replace the detail image view if the isSelectable status is false.
Protected Methods
void addStatusLabelView(View view)
boolean checkLayoutParams(ViewGroup.LayoutParams p)
void checkTagIndexInOrder(int index)
void checkTextWidth(int textWidth, int descriptionWidth)
Updates footnote StaticLayoutTextViews if width is changed.
void configureDescriptionLayout()
Configures StaticLayoutTextView for description field.
void configureFootnoteLayout()
Configures footnote layout
ObjectCell.LayoutParams generateDefaultLayoutParams()
ObjectCell.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p)
int getFootnoteWidth()
Returns the width for footnote.
int getRemainedDescriptionWidth(int parentWidthSpec, int endWidthUsed, int widthUsed)
boolean hasRoomUnderHeadline(int lines)
Checks whether there is room under headline to layout additional text fields
boolean isReusingGroupItems()
Returns whether to reuse group items for statuses and icon stack.
int layoutStatus(boolean isRtl, int height, boolean centerAligned, int statusLeft, int statusRight, int statusTop, int statusLimit, int baseline)
Layout status views.
static void measureDynamicStatus(View child, int parentWidthSpec, int widthUsed, int widthConstraint, int parentHeightSpec, int heightUsed, int heightConstraint, int hPadding, int vPadding)
Measures child with optional constraint.
void measureTextWrapped(View child, int widthConstraint, int height)
void onLayout(boolean changed, int l, int t, int r, int b)
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
int retrieveLines()
Returns number of lines based on content.
int retrieveTotalLines()
[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

AbstractEntityCell_description

Related Methods

AbstractEntityCell_descriptionTextAppearance

Related Methods

AbstractEntityCell_descriptionWidthPercent

Related Methods

AbstractEntityCell_detailImage

Related Methods

AbstractEntityCell_detailImageCharacter

Related Methods

AbstractEntityCell_detailImageDescription

Related Methods

AbstractEntityCell_headline

Related Methods

AbstractEntityCell_headlineLines

Related Methods

AbstractEntityCell_headlineTextAppearance

Related Methods

AbstractEntityCell_lines

Related Methods

AbstractEntityCell_preserveDetailImageSpacing

Related Methods

AbstractEntityCell_subheadline

Related Methods

AbstractEntityCell_subheadlineLines

Related Methods

AbstractEntityCell_subheadlineTextAppearance

Related Methods

ObjectCell_Layout_layout_group

Related Methods

ObjectCell_dynamicStatusWidth

ObjectCell_footnote

Related Methods

ObjectCell_footnoteLines

Related Methods

ObjectCell_footnoteTextAppearance

ObjectCell_preserveIconImageContainer

ObjectCell_preserveIconStackSpacing

ObjectCell_secondaryActionDescription

ObjectCell_secondaryActionIcon

Related Methods

ObjectCell_statusWidth

Related Methods

Constants

public static final int DISMISS_DURATION

Constant Value: 150 (0x00000096)

public static final int SHOW_DURATION

Constant Value: 200 (0x000000c8)

Fields

public static final int CRITICAL

public static final int NEGATIVE

public static final int POSITIVE

protected List<View> mAttributeIconViews

protected CheckBox mCheckBox

protected int mDefaultStatusTextColor

protected int mDefaultTagTextColor

protected StaticLayout mFootnoteLayout

protected int mFootnoteLines

protected StaticLayoutTextView mFootnoteTextView

protected int mFootnoteWidth

protected boolean mIsAnimating

protected boolean mIsDismissing

protected boolean mIsSelectable

protected boolean mIsShown

protected int mMaxStatusSize

protected List<View> mRemovedStatusViews

protected List<Integer> mStatusColors

protected List<Boolean> mStatusIconsPlacements

protected List<View> mStatusLabelViews

protected int mStatusLineHeight

protected float mStatusTextSize

protected int mStatusVerticalPadding

protected List<View> mStatusViews

protected int mStatusWidth

protected List<Integer> mTagColors

protected int mTagLineHeight

protected List<Integer> mTagTints

protected List<View> mTagViews

protected ImageView mUnreadIcon

Public Constructors

public ObjectCell (Context context)

public ObjectCell (Context context, AttributeSet attrs)

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

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

Public Methods

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

public void clearAttributeIcons ()

Clears all attribute icon views. It should be called before it's reused in list if there are items with no or fewer attribute icon field than other items. Attribute icon colors will also be cleared.

public void clearIcons ()

Clears all icon views. It should be called before it's reused in list if there are items with no or fewer icon field than other items. Icon colors will also be cleared.

public void clearStatuses ()

Clears all status views. It should be called before it's reused in list if there are items with no or fewer status field than other items. Status colors will also be cleared.

public void clearTags ()

Removes all tag views.

public void dismiss (int duration, int delay)

public void dismiss ()

public ObjectCell.LayoutParams generateLayoutParams (AttributeSet attrs)

public int getAttributeIconColor (int index)

Gets the attribute icon color at the specified index. It can only retrieve the value explicitly set by setAttributeIconColor(int, int).

Parameters
index attribute icon index
Returns
  • color

public View getAttributeIconView (int index)

public CheckBox getCheckBox ()

public int getDefaultIconColor ()

Returns the default color for ImageView inside icon stack.

public int getDefaultIconLabelColor ()

Returns the default color for TextView inside icon stack.

public int getDefaultStatusColor ()

Returns the default color that can be used for status TextView or ImageView.

public CharSequence getFootnote ()

Gets the footnote of the object cell.

Related XML Attributes
Returns
  • The footnote.

public int getFootnoteLines ()

Gets the number of lines of footnote text view

Related XML Attributes

public int getIconColor (int index)

Gets the icon color at the specified index. It can only retrieve the value explicitly set by setIconColor(int, int). TextColor or image tint specified in XML would not be retrieved.

Parameters
index icon index: 0, 1, or 2
Returns
  • color

public View getIconView (int index)

public boolean getIsAnimating ()

public boolean getIsChecked ()

public boolean getIsDismissing ()

public boolean getIsSelectable ()

public boolean getIsShown ()

public boolean getPreserveIconImageContainer ()

Returns whether to preserve the container for icon stack and detail image.

Related XML Attributes

public boolean getPreserveIconStackSpacing ()

Returns true if to preserve icon stack space even when there is no icon

Related XML Attributes

public Drawable getSecondaryActionIcon ()

Return the current secondary action icon drawable.

Related XML Attributes
Returns
  • The current secondary action icon drawable

public CharSequence getSecondaryActionIconDescription ()

Return the description of the object cell's secondary action icon.

Related XML Attributes
Returns
  • A description of the secondary action icon

public int getStatusColor (int index)

Gets the status color at the specified index. It can only retrieve the value explicitly set by setStatusColor(int, int). TextColor or image tint specified in XML would not be retrieved.

Parameters
index status index: 0 or 1
Returns
  • color

public int getStatusWidth ()

Returns the fixed status width

Related XML Attributes

public int getTagTextColor (int index)

Returns the text color for the tag specified by index.

public int getTagTint (int index)

Returns the tint color for the tag specified by index.

public ImageView getUnreadIcon ()

public void hideSecondaryActionView ()

Hide the secondary action view. Use case includes: while the detail progress bar is displayed.

public boolean isActionTopAlign ()

Returns whether the secondary action is top aligned.

public boolean isDynamicStatusWidth ()

Returns whether to use dynamic status width to make efficient use of space when status' width varies a lot from cell to cell.

Related XML Attributes

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 setActionTopAlign (boolean actionTopAlign)

Sets whether the secondary action is top aligned. Default is false. Note that status views will be using the same alignment as secondary action. If secondary action is not set, this setting does not change anything, and status views will be top aligned by default. This method is deprecated, as design has been updated to always be top aligned.

public void setAttributeIcon (Drawable drawable, int index, CharSequence contentDescription)

Sets an attribute icon. It's recommended that icon view order for each row is consistent.

Parameters
drawable icon
index Attribute icon index. Always sets icon starting from 0.

public void setAttributeIcon (int resId, int index, int contentDescId)

Sets an attribute icon. It's recommended that icon view order for each row is consistent.

Parameters
resId icon resource id
index Attribute icon index. Always sets icon starting from 0.
contentDescId content description id

public void setAttributeIconColor (int color, int index)

Sets the attribute icon color at the specified index.

Parameters
color color value. 0 means not specified so that color is set by the view itself. Otherwise the supplied value will overwrite the color specified on the view. Recommend getDefaultIconColor() if there is no special requirement.
index attribute icon index

public void setCheckBoxListener (View.OnClickListener listener)

public void setDynamicStatusWidth (boolean dynamicStatusWidth)

Sets whether to use dynamic status width to make efficient use of space when status' width varies a lot from cell to cell. Once it's set to true getStatusWidth() will be ignored.

Related XML Attributes

public void setFootnote (int resId)

Sets the footnote of this object cell.

Footnote can be used in addition to subheadline.

Related XML Attributes
Parameters
resId String resource ID

public void setFootnote (CharSequence footnote)

Sets the footnote of the object cell.

Footnote can be used in addition to subheadline.

Related XML Attributes
Parameters
footnote The footnote.

public void setFootnoteColor (int color)

Sets the text color for footnote.

public void setFootnoteFont (Typeface font)

Sets the text font for footnote.

public void setFootnoteFont (int fontId)

Sets the text font for footnote.

public void setFootnoteLines (int footnoteLines)

Sets the number of lines of footnote text view

Related XML Attributes
Parameters
footnoteLines line number, must be 0, 1, 2 or 3 and less than getLines(). Dynamic layout can be achieved by setting it to 0 with performance trade-off. Subclass may choose to customize it.

public void setFootnoteSize (float size)

Sets the text size for footnote.

public void setFootnoteTextAppearance (int resId)

Sets the text color, size, style, hint color, and highlight color for footnote from the specified TextAppearance resource.

Related XML Attributes

public void setIcon (int resId, int index, int contentDescId)

Sets an icon. It's recommended that icon view type at the same index for each row is consistent.

Parameters
resId icon resource id
index 0, 1 or 2. Always sets icon starting from 0.
contentDescId content description id

public void setIcon (int iconId, int index)

Sets an icon. It's recommended that icon view type at the same index for each row is consistent.

Parameters
iconId String id to shown as icon
index 0, 1 or 2, Always sets icon starting from 0.

public void setIcon (Drawable drawable, int index, CharSequence contentDescription)

Sets an icon. It's recommended that icon view type at the same index for each row is consistent.

Parameters
drawable icon
index 0, 1 or 2. Always sets icon starting from 0.

public void setIcon (CharSequence icon, int index)

Sets an icon. It's recommended that icon view type at the same index for each row is consistent.

Parameters
icon text to shown as icon
index 0, 1 or 2, Always sets icon starting from 0.

public void setIconColor (int color, int index)

Sets the icon color

Parameters
color color value. 0 means not specified so that color is set by the view itself. Otherwise the supplied value will overwrite the color specified on the view. Recommend getDefaultIconColor() and getDefaultIconLabelColor() if there is no special requirement.
index status field index

public void setIsChecked (boolean checked)

public void setIsSelectable (boolean isSelectable)

public void setIsShown (boolean isShown)

public void setPreserveIconImageContainer (boolean preserveIconImageContainer)

Sets whether to preserve the container for icon stack and detail image. When this flag is set to true, getPreserveIconStackSpacing() and getPreserveDetailImageSpacing() will be ignored. Inside the container, if either icon stack or detail image is missing, the other view will be right aligned.

Related XML Attributes

public void setPreserveIconStackSpacing (boolean preserveIconStackSpacing)

Preserves spacing for icon stack

Related XML Attributes

public void setSecondaryActionIcon (Drawable drawable)

Sets a secondary action icon drawable.

This drawable takes the place at the end of the object cell. Apps using a secondary action icon should also supply a description using setSecondaryActionIconDescription(int).

Related XML Attributes
Parameters
drawable Drawable to use as a secondary action icon

public void setSecondaryActionIcon (int resId)

Sets a secondary action icon drawable from a resource id.

This drawable takes the place at the end of the object cell. Apps using a secondary action icon should also supply a description using setSecondaryActionIconDescription(int).

Related XML Attributes
Parameters
resId ID of a drawable resource

public void setSecondaryActionIconDescription (CharSequence description)

Set a description of the object cell's secondaryActionIcon.

This description will be used for accessibility or other similar descriptions of the UI.

Related XML Attributes
Parameters
description Description to set

public void setSecondaryActionIconDescription (int resId)

Set a description of the object cell's secondary action icon.

This description will be used for accessibility or other similar descriptions of the UI.

Related XML Attributes
Parameters
resId String resource id

public void setSecondaryActionOnClickListener (View.OnClickListener listener)

Set a listener to respond to secondary action icon click event.

This listener will be called whenever the user clicks the secondary action button at the end of the object cell. An icon must be set for the secondary action button to appear.

Parameters
listener Listener to set

public void setStatus (CharSequence status, int index)

Sets a status. It's recommended that status view type at the same index for each row is consistent.

Parameters
status text to shown as status
index 0 or 1. Always sets status starting from 0.

public void setStatus (int statusId, int index)

Sets a status. It's recommended that status view type at the same index for each row is consistent.

Parameters
statusId String id to shown as status
index 0 or 1. Always sets status starting from 0.

public void setStatus (Drawable drawable, int index, CharSequence contentDescription)

Sets a status. It's recommended that status view type at the same index for each row is consistent.

Parameters
drawable icon
index 0 or 1. Always sets status starting from 0.

public void setStatus (int resId, int index, int contentDescId)

Sets a status. It's recommended that status view type at the same index for each row is consistent.

Parameters
resId icon resource id
index 0 or 1. Always sets status starting from 0.
contentDescId content description id

public void setStatusColor (int color, int index)

Sets the status color

Parameters
color color value. 0 means not specified so that color is set by the view itself. Otherwise the supplied value will overwrite the color specified on the view. Recommend getDefaultStatusColor() if there is no special requirement.
index status field index

public void setStatusLabel (CharSequence label, int index)

Sets a text label to appear next to a status icon. Only appears if a status icon exists at the corresponding index. To set status text by itself, use setStatus(CharSequence, int).

Parameters
label Text that appears next to a status icon.
index The index of the status icon the text will appear next to.

public void setStatusLeadingIcon (int index, boolean isLeading)

Specifies if the status icon should be leading or trailing the label.

Parameters
index 0 or 1.
isLeading icon will be leading if true, trailing otherwise.

public void setStatusTextAppearance (int resId, int index)

Sets the text color, size, style, hint color, and highlight color for status text from the specified TextAppearance resource.

public void setStatusTextFont (int fontId, int index)

Sets the text font for status text.

public void setStatusTextFont (Typeface font, int index)

Sets the text font for status text.

public void setStatusTextSize (float size, int index)

Sets the text size for status text.

public void setStatusWidth (int statusWidth)

Sets the fixed status width

Related XML Attributes

public void setTag (int tagResId, int index)

Sets a tag.

Parameters
tagResId resource id of text to shown as tag
index 0, 1 or 2. Always sets tag starting from 0.

public void setTag (CharSequence tag, int index)

Sets a tag.

Parameters
tag text to shown as tag
index 0, 1 or 2. Always sets tag starting from 0.

public void setTagTextColor (int color, int index)

Sets the text color for the tag specified by index. If you use customized views for tags, this method won't take effect.

public void setTagTint (int color, int index)

Sets the tint color for the tag specified by index. If you use customized views for tags, this method won't take effect.

public void setUnreadIcon (Drawable drawable)

public void show (int duration, int delay)

public void show ()

public void showSecondaryActionView ()

Show the secondary action view. Use case includes: after the detail progress bar reaches its max.

public void updateUiOnRead ()

Update UI depending on the isRead status of the AbstractEntityCell If the cell is read, the headline text appearance should be using SubheadlineTextAppearance.

public void updateUiOnSelected ()

A checkmark icon will replace the detail image view if the isSelectable status is false.

Protected Methods

protected void addStatusLabelView (View view)

protected boolean checkLayoutParams (ViewGroup.LayoutParams p)

protected void checkTagIndexInOrder (int index)

protected void checkTextWidth (int textWidth, int descriptionWidth)

Updates footnote StaticLayoutTextViews if width is changed. Important! Don't call requestLayout() here since it's called from onMeasure.

Parameters
textWidth whole text width
descriptionWidth width that COULD be used by description

protected void configureDescriptionLayout ()

Configures StaticLayoutTextView for description field. Sets up asynchronous rendering when necessary.

protected void configureFootnoteLayout ()

Configures footnote layout

protected ObjectCell.LayoutParams generateDefaultLayoutParams ()

protected ObjectCell.LayoutParams generateLayoutParams (ViewGroup.LayoutParams p)

protected int getFootnoteWidth ()

Returns the width for footnote.

protected int getRemainedDescriptionWidth (int parentWidthSpec, int endWidthUsed, int widthUsed)

protected boolean hasRoomUnderHeadline (int lines)

Checks whether there is room under headline to layout additional text fields

Parameters
lines used lines

protected boolean isReusingGroupItems ()

Returns whether to reuse group items for statuses and icon stack.

protected int layoutStatus (boolean isRtl, int height, boolean centerAligned, int statusLeft, int statusRight, int statusTop, int statusLimit, int baseline)

Layout status views. Returns the bottom of the layout

protected static void measureDynamicStatus (View child, int parentWidthSpec, int widthUsed, int widthConstraint, int parentHeightSpec, int heightUsed, int heightConstraint, int hPadding, int vPadding)

Measures child with optional constraint.

protected void measureTextWrapped (View child, int widthConstraint, int height)

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

protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec)

protected int retrieveLines ()

Returns number of lines based on content. To be overwritten by subclasses.

protected int retrieveTotalLines ()