public class

ObjectHeader

extends ObjectCell
java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ com.sap.cloud.mobile.fiori.object.AbstractEntityCell
         ↳ com.sap.cloud.mobile.fiori.object.ObjectCell
           ↳ com.sap.cloud.mobile.fiori.object.ObjectHeader

Class Overview

The object header provides a quick view of the most important or most frequently-used information about one instance of an object. It is visually separated from the content area below. As the object header provides the first glimpse of the object on the screen, the information it contains should be clear and concise.

Structure

The object header is comprised of several pieces of information about the object:

Sample XML:


 <com.sap.cloud.mobile.fiori.object.ObjectHeader
      android:id="@+id/objectHeader"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_marginTop="0dp"
      android:paddingBottom="@dimen/md_keylines"
      android:paddingTop="@dimen/md_keylines"
      android:scrollbars="vertical"
      app:body="@string/object_header_body"
      app:description="@string/object_header_description"
      app:detailImage="@drawable/ic_android_black_24dp"
      app:footnote="@string/object_header_footnote"
      app:headline="@string/object_header_headline"
      app:subheadline="@string/object_header_subheadline"
      tools:layout_editor_absoluteY="8dp">

  <com.sap.cloud.mobile.fiori.common.TextChip
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="@string/object_header_tag1"
      app:layout_header_group="TAG" />

  <com.sap.cloud.mobile.fiori.common.TextChip
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="@string/object_header_tag2"
      app:layout_header_group="TAG" />

  <ImageView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:src="@drawable/ic_error_black_24dp"
      android:tint="@color/red"
      android:contentDescription="@string/error"
      app:layout_header_group="STATUS" />

  <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="@string/object_header_status"
      android:textColor="@color/grey_300"
      app:layout_header_group="STATUS" />

  <include layout="@layout/temperature_analytics" />

 </com.sap.cloud.mobile.fiori.object.ObjectHeader>
 

Summary

Nested Classes
class ObjectHeader.LayoutParams Layout information for child views of an ObjectHeader. 
XML Attributes
Attribute Name Related Method Description
com.sap.cloud.mobile.fiori:body setBody(int) The additional info associated with the object header. 
com.sap.cloud.mobile.fiori:bodyTextAppearance setBodyTextAppearance(int) Text color, typeface, size, and style for body. 
com.sap.cloud.mobile.fiori:description The description associated with the AbstractEntityCell. 
com.sap.cloud.mobile.fiori:descriptionLines setLines(int) Total number of lines. 
com.sap.cloud.mobile.fiori:descriptionTextAppearance Text color, typeface, size, and style for footnote. 
com.sap.cloud.mobile.fiori:descriptionWidthPercent setDescriptionWidthPercent(float) The width percentage of description of the total width shared by headline and description

May be a floating point value, such as "1.2". 

com.sap.cloud.mobile.fiori:detailImage The detail image. 
com.sap.cloud.mobile.fiori:detailImageCharacter The placeholder character for the detail image. 
com.sap.cloud.mobile.fiori:detailImageDescription A content description string to describe the appearance of the associated detail image. 
com.sap.cloud.mobile.fiori:footnote The footnote associated with the object cell. 
com.sap.cloud.mobile.fiori:footnoteTextAppearance Text color, typeface, size, and style for footnote. 
com.sap.cloud.mobile.fiori:headline The headline associated with the AbstractEntityCell. 
com.sap.cloud.mobile.fiori:headlineLines Makes the headline be exactly this many lines tall. 
com.sap.cloud.mobile.fiori:headlineTextAppearance Text color, typeface, size, and style for headline. 
com.sap.cloud.mobile.fiori:layout_header_group Specifies which layout group the child view should belong. 
com.sap.cloud.mobile.fiori:preserveDetailImageSpacing Whether to preserve detail image space when image is null

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

com.sap.cloud.mobile.fiori:statusWidth Sets the fixed status width. 
com.sap.cloud.mobile.fiori:subheadline The subheadline associated with the AbstractEntityCell. 
com.sap.cloud.mobile.fiori:subheadlineTextAppearance Text color, typeface, size, and style for subheadline. 
[Expand]
Inherited XML Attributes
From class com.sap.cloud.mobile.fiori.object.ObjectCell
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 mTextKeyline
[Expand]
Inherited Fields
From class com.sap.cloud.mobile.fiori.object.ObjectCell
From class com.sap.cloud.mobile.fiori.object.AbstractEntityCell
From class android.view.View
Public Constructors
ObjectHeader(Context context)
ObjectHeader(Context context, AttributeSet attrs)
ObjectHeader(Context context, AttributeSet attrs, int defStyle)
ObjectHeader(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
Public Methods
void addView(View child, int index, ViewGroup.LayoutParams params)
ObjectHeader.LayoutParams generateLayoutParams(AttributeSet attrs)
CharSequence getBody()
Gets the body of the object header.
View getDetailView()
Returns the detail view which can be used to show analytics information.
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.
void removeView(View view)
void setAsyncRendering(boolean asyncRendering)
Sets whether the description content will be rendered asynchronously.
void setBody(CharSequence body)
Sets the body of the object header.
void setBody(int resId)
Sets the body text of this object header.
void setBodyTextAppearance(int resId)
Sets the text color, size, style, hint color, and highlight color for body text from the specified TextAppearance resource.
void setDescription(CharSequence description)
Sets the description field for both phone and tablet.
void setDescriptionWidthPercent(float descriptionWidthPercent)
Sets the description width percentage in the space shared by headline and description.
void setDetailView(View detailView)
Sets the detail view which can be used to show analytics information.
void setLines(int lines)
Overrides ObjectCell#setLines to allow for more than 3 lines.
void setPreserveDetailImageSpacing(boolean preserveDetailImageSpacing)
ObjectHeader always preserves detail image spacing.
void setSecondaryActionIcon(Drawable drawable)
Overrides to turn off secondary action
void setTag(CharSequence tag, int index)
Sets a tag.
void setTag(int tagResId, 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.
boolean shouldAllocateDescriptionViewInFirstPage()
Protected Methods
void addViewToGroup(View v, int group)
Adds the view into specified group.
boolean checkLayoutParams(ViewGroup.LayoutParams p)
void checkTextWidth(int textWidth, int descriptionWidth)
Calculates title and description width.
void checkTextWidthOnPhone(int textWidth, int fullWidth, boolean updateDescription)
Adjusts text width and configures text layouts when width is changed.
void configureDescriptionLayout()
Configures the description layout without using async rendering.
void configureFootnoteLayout()
Configures footnote layout
void configureHeadlineLayout()
Configures headline layout
void configureSubheadlineLayout()
Configures sub headline layout
ObjectHeader.LayoutParams generateDefaultLayoutParams()
ObjectHeader.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p)
int getFootnoteWidth()
Returns the footnote/additional info width for tablet
int getMaxLines()
Returns the max number of lines supported by this cell.
boolean isChild(View child)
Returns true is the view is child of this ObjectHeader or header pages.
boolean isReusingGroupItems()
Overrides to return false since ObjectHeader is not going to be recycled.
void onAttachedToWindow()
void onLayout(boolean changed, int l, int t, int r, int b)
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
[Expand]
Inherited Methods
From class com.sap.cloud.mobile.fiori.object.ObjectCell
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:body

The additional info associated with the object header. Under subheadline and tags.

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

Text color, typeface, size, and style for body. Defaults to secondary_text_default_material_light color. Default style: TextAppearance_Fiori_ObjectCell_Footnote

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

The description associated with the AbstractEntityCell. Next to headline. Only appears in regular mode(tablet)

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

Total number of lines.

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

Related Methods

com.sap.cloud.mobile.fiori:descriptionTextAppearance

Text color, typeface, size, and style for footnote. Defaults to secondary_text_default_material_light color. Default style: TextAppearance_Fiori_ObjectCell_Description

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

The width percentage of description of the total width shared by headline and description

May be a floating point value, such as "1.2".

com.sap.cloud.mobile.fiori:detailImage

The detail image.

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

The placeholder character for the detail image. No effect if detailImage is not null.

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

A content description string to describe the appearance of the associated detail image.

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

The footnote associated with the object cell. Under subheadline.

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

Text color, typeface, size, and style for footnote. Defaults to secondary_text_default_material_light color. Default style: TextAppearance_Fiori_ObjectCell_Footnote

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

The headline associated with the AbstractEntityCell. Mandatory.

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

Makes the headline be exactly this many lines tall. Default value is 1 if not specified. When it's 2, footnote will disappear; when it's 3, sub headline will also disappear. This must be equal to or less than "lines".

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

Related Methods

com.sap.cloud.mobile.fiori:headlineTextAppearance

Text color, typeface, size, and style for headline. Defaults to material_grey_900 color. Default style: TextAppearance_Fiori_ObjectCell_Headline

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

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

Must be one of the following constant values.

ConstantValueDescription
DETAILcDesignates a view to show in ObjectHeader details group
INTERNAL0Reserved for internal usage
STATUS1Designates a view to show in ObjectHeader status group. This is the default if not specified.
TAGbDesignates a view to show in ObjectHeader tags group

Related Methods

com.sap.cloud.mobile.fiori:preserveDetailImageSpacing

Whether to preserve detail image space when image is null

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

Related Methods

com.sap.cloud.mobile.fiori:statusWidth

Sets the fixed status width.

May be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).

Related Methods

com.sap.cloud.mobile.fiori:subheadline

The subheadline associated with the AbstractEntityCell. Under headline.

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

Text color, typeface, size, and style for subheadline. Defaults to primary_text_default_material_light color. Default style: TextAppearance_Fiori_ObjectCell_Subheadline

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

Public Constructors

public ObjectHeader (Context context)

public ObjectHeader (Context context, AttributeSet attrs)

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

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

Public Methods

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

public ObjectHeader.LayoutParams generateLayoutParams (AttributeSet attrs)

public CharSequence getBody ()

Gets the body of the object header.

Related XML Attributes
Returns
  • The body.

public View getDetailView ()

Returns the detail view which can be used to show analytics information.

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 void removeView (View view)

public void setAsyncRendering (boolean asyncRendering)

Sets whether the description content will be rendered asynchronously. Long text rendering is expensive, so for a smooth scroll this mode should be set to true.

Parameters
asyncRendering only false is accepted for ObjectHeader

public void setBody (CharSequence body)

Sets the body of the object header.

Body can be used in addition to subheadline.

Related XML Attributes
Parameters
body The body.

public void setBody (int resId)

Sets the body text of this object header.

Body can be used as additional information.

Related XML Attributes
Parameters
resId String resource ID

public void setBodyTextAppearance (int resId)

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

public void setDescription (CharSequence description)

Sets the description field for both phone and tablet.

Parameters
description The description.

public void setDescriptionWidthPercent (float descriptionWidthPercent)

Sets the description width percentage in the space shared by headline and description. This ratio is also used to determine additional info or detail/analytics view width when they are rendered horizontally with the title area.

Parameters
descriptionWidthPercent The width percentage for description/additional info/detail views.

public void setDetailView (View detailView)

Sets the detail view which can be used to show analytics information. On tablet if detail view is set, description will be hidden. The width of the detailView on tablet can be controlled by setDescriptionWidthPercent(float)

public void setLines (int lines)

Overrides ObjectCell#setLines to allow for more than 3 lines.

Parameters
lines description lines, 2-4

public void setPreserveDetailImageSpacing (boolean preserveDetailImageSpacing)

ObjectHeader always preserves detail image spacing.

Parameters
preserveDetailImageSpacing only true is accepted.

public void setSecondaryActionIcon (Drawable drawable)

Overrides to turn off secondary action

Parameters
drawable only null is accepted

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 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 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 boolean shouldAllocateDescriptionViewInFirstPage ()

Protected Methods

protected void addViewToGroup (View v, int group)

Adds the view into specified group.

Parameters
v view
group group

protected boolean checkLayoutParams (ViewGroup.LayoutParams p)

protected void checkTextWidth (int textWidth, int descriptionWidth)

Calculates title and description width.

Parameters
textWidth total width
descriptionWidth width that COULD be used by description

protected void checkTextWidthOnPhone (int textWidth, int fullWidth, boolean updateDescription)

Adjusts text width and configures text layouts when width is changed.

protected void configureDescriptionLayout ()

Configures the description layout without using async rendering.

protected void configureFootnoteLayout ()

Configures footnote layout

protected void configureHeadlineLayout ()

Configures headline layout

protected void configureSubheadlineLayout ()

Configures sub headline layout

protected ObjectHeader.LayoutParams generateDefaultLayoutParams ()

protected ObjectHeader.LayoutParams generateLayoutParams (ViewGroup.LayoutParams p)

protected int getFootnoteWidth ()

Returns the footnote/additional info width for tablet

protected int getMaxLines ()

Returns the max number of lines supported by this cell.

protected boolean isChild (View child)

Returns true is the view is child of this ObjectHeader or header pages.

protected boolean isReusingGroupItems ()

Overrides to return false since ObjectHeader is not going to be recycled.

protected void onAttachedToWindow ()

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

protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec)