public class

FioriAvatarStack

extends ViewGroup
java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ com.sap.cloud.mobile.fiori.common.FioriAvatarStack

Summary

Constants
int LAYOUT_GRID
int LAYOUT_STACK
[Expand]
Inherited Constants
From class android.view.ViewGroup
From class android.view.View
Fields
protected int mAvatarSize
protected List<FioriAvatar> mAvatars
protected FioriAvatar mExtraAvatar
protected int mGridAvatarSize
protected int mLayoutMode
protected int mMaxAvatars
protected int mStackAvatarSize
protected boolean mUseCutOut
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
FioriAvatarStack(Context context)
FioriAvatarStack(Context context, AttributeSet attrs)
FioriAvatarStack(Context context, AttributeSet attrs, int defStyleAttr)
FioriAvatarStack(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
Public Methods
void ensureAvatar()
Populates the stack with an avatar if none exists.
FioriAvatar getAvatar(int index)
Gets the avatar at the given index in the stack.
FioriAvatar getExtraAvatar()
Gets the avatar that shows the amount of avatars not displayed in grid layout mode.
int getImageSize()
Gets the bounding size of the stack.
boolean hasNonNullImage()
Checks whether the stack has a non-null image or text.
void setAvatar(int index, FioriAvatar avatar)
Sets an avatar in the given index in the stack.
void setAvatars(List<FioriAvatar> avatars)
Populates the stack with avatars from a provided list.
void setImageSize(int size)
Sets the bounding size of the stack.
void setLayoutMode(int mode)
Sets the layout mode for the stack.
void setMaxAvatars(int max)
Sets the maximum amount of avatars that can be displayed in grid layout mode.
void setUseCutOut(boolean useCutOut)
Sets whether the cutout effect is used.
Protected Methods
void dispatchDraw(Canvas canvas)
void ensureExtraAvatar()
boolean isChild(View child)
void measureChildFixed(View child, int width, int height)
Measures child view with fixed width and height
void onLayout(boolean changed, int l, int t, int r, int b)
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
void removeExtraAvatar()
[Expand]
Inherited Methods
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

Constants

public static final int LAYOUT_GRID

Constant Value: 1 (0x00000001)

public static final int LAYOUT_STACK

Constant Value: 0 (0x00000000)

Fields

protected int mAvatarSize

protected List<FioriAvatar> mAvatars

protected FioriAvatar mExtraAvatar

protected int mGridAvatarSize

protected int mLayoutMode

protected int mMaxAvatars

protected int mStackAvatarSize

protected boolean mUseCutOut

Public Constructors

public FioriAvatarStack (Context context)

public FioriAvatarStack (Context context, AttributeSet attrs)

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

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

Public Methods

public void ensureAvatar ()

Populates the stack with an avatar if none exists.

public FioriAvatar getAvatar (int index)

Gets the avatar at the given index in the stack.

Parameters
index Position in the stack
Returns
  • Avatar at the given index in the stack

public FioriAvatar getExtraAvatar ()

Gets the avatar that shows the amount of avatars not displayed in grid layout mode.

Returns
  • Avatar at the end of grid layout mode showing amount of undisplayed avatars

public int getImageSize ()

Gets the bounding size of the stack.

Returns
  • Bounding size

public boolean hasNonNullImage ()

Checks whether the stack has a non-null image or text.

Returns
  • True if the stack has a non-null image or text, false otherwise

public void setAvatar (int index, FioriAvatar avatar)

Sets an avatar in the given index in the stack.

Parameters
index Position in the stack
avatar Avatar to be placed in the stack

public void setAvatars (List<FioriAvatar> avatars)

Populates the stack with avatars from a provided list.

Parameters
avatars List of avatars to place in the stack

public void setImageSize (int size)

Sets the bounding size of the stack.

Parameters
size Bounding size

public void setLayoutMode (int mode)

Sets the layout mode for the stack.

Parameters
mode 0 for LAYOUT_STACK, 1 for LAYOUT_GRID

public void setMaxAvatars (int max)

Sets the maximum amount of avatars that can be displayed in grid layout mode. Does not apply to stack layout mode.

Parameters
max Maximum amount of avatars that can be displayed in grid layout mode

public void setUseCutOut (boolean useCutOut)

Sets whether the cutout effect is used. Should be disabled if performance is dropping.

Parameters
useCutOut True to enable cutout effect, false to disable cutout effect

Protected Methods

protected void dispatchDraw (Canvas canvas)

protected void ensureExtraAvatar ()

protected boolean isChild (View child)

protected void measureChildFixed (View child, int width, int height)

Measures child view with fixed width and height

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

protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec)

protected void removeExtraAvatar ()