public class

FioriAvatar

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

Summary

[Expand]
Inherited Constants
From class android.view.ViewGroup
From class android.view.View
Fields
protected FioriAvatarImage mAvatarImage
protected int mBadgeSize
protected ImageView mBadgeView
protected boolean mDisplayBadge
protected int mImageSize
protected int mOutlineShape
protected boolean mUseBadgeCutOut
protected boolean mUseBorder
protected boolean mUseIcon
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
FioriAvatar(Context context)
FioriAvatar(Context context, AttributeSet attrs)
FioriAvatar(Context context, AttributeSet attrs, int defStyleAttr)
FioriAvatar(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
Public Methods
FioriAvatarImage getAvatarImage()
Gets the base FioriAvatarImage.
Drawable getBadge()
Gets the drawable used as the badge.
ImageView getBadgeView()
Gets the view containing the drawable badge.
Drawable getImage()
Gets the drawable used as the image.
CharSequence getImageCharacter()
Gets the text used as the image.
int getImageOutlineShape()
Gets the shape of the image.
int getImageSize()
Gets the size of the image.
TextView getImageTextView()
Gets the view containing the image text.
ImageView getImageView()
Gets the view containing the drawable image.
boolean getUseIcon()
Gets whether the assigned drawable should be scaled to fit in the center of the avatar.
void setBadge(Drawable drawable)
Sets the badge.
void setBadge(int resId)
Sets the badge.
void setBadgeSize(int size)
Sets the size of the badge.
void setImage(Drawable drawable)
Sets the image.
void setImage(int resId)
Sets the image.
void setImageCharacter(CharSequence character)
Sets the text to be used as the image.
void setImageOutlineShape(int imageOutlineShape)
Sets the shape of the image.
void setImageSize(int size)
Sets the size of the image.
void setShapeColor(int color)
Sets the background color of the image.
void setTextColor(int color)
Sets the text color of the text image.
void setUseBadgeCutOut(boolean useCutOut)
Sets whether the cutout effect is used.
void setUseBorder(boolean useBorder)
Sets whether a border is displayed around the image.
void setUseIcon(boolean useIcon)
Sets whether the assigned drawable should be scaled to fit in the center of the avatar.
void shouldDisplayBadge(boolean shouldDisplay)
Sets whether the badge should be displayed.
Protected Methods
Bitmap cropBitmap(Bitmap bitmap, int width, int height)
Bitmap cropBitmap(Bitmap bitmap, int width, int height, boolean useIcon)
void dispatchDraw(Canvas canvas)
Bitmap drawableToBitmap(Drawable drawable, int width, int height)
void ensureAvatarImage()
void ensureBadgeView()
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)
[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

Fields

protected FioriAvatarImage mAvatarImage

protected int mBadgeSize

protected ImageView mBadgeView

protected boolean mDisplayBadge

protected int mImageSize

protected int mOutlineShape

protected boolean mUseBadgeCutOut

protected boolean mUseBorder

protected boolean mUseIcon

Public Constructors

public FioriAvatar (Context context)

public FioriAvatar (Context context, AttributeSet attrs)

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

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

Public Methods

public FioriAvatarImage getAvatarImage ()

Gets the base FioriAvatarImage.

Returns
  • FioriAvatarImage used as the base of the avatar

public Drawable getBadge ()

Gets the drawable used as the badge.

Returns
  • Drawable used as badge

public ImageView getBadgeView ()

Gets the view containing the drawable badge.

Returns
  • ImageView containing the drawable badge

public Drawable getImage ()

Gets the drawable used as the image.

Returns
  • Drawable used as image

public CharSequence getImageCharacter ()

Gets the text used as the image.

Returns
  • Text used as the image

public int getImageOutlineShape ()

Gets the shape of the image.

Returns
  • int representing the shape of the image. 0 for rectangle, 1 for oval, 2 for rounded rectangle

public int getImageSize ()

Gets the size of the image.

Returns
  • Image size

public TextView getImageTextView ()

Gets the view containing the image text.

Returns
  • TextView containing the image text

public ImageView getImageView ()

Gets the view containing the drawable image.

Returns
  • ImageView containing the drawable image

public boolean getUseIcon ()

Gets whether the assigned drawable should be scaled to fit in the center of the avatar.

Returns
  • True if icon mode is enabled, false if icon mode is disabled

public void setBadge (Drawable drawable)

Sets the badge.

Parameters
drawable Drawable to be used as badge

public void setBadge (int resId)

Sets the badge.

Parameters
resId Drawable resource for badge

public void setBadgeSize (int size)

Sets the size of the badge.

Parameters
size Badge size

public void setImage (Drawable drawable)

Sets the image. Takes priority over text.

Parameters
drawable Drawable to be used as image

public void setImage (int resId)

Sets the image. Takes priority over text.

Parameters
resId Drawable resource for image

public void setImageCharacter (CharSequence character)

Sets the text to be used as the image.

Parameters
character Text to be used as the image

public void setImageOutlineShape (int imageOutlineShape)

Sets the shape of the image.

Parameters
imageOutlineShape 0 for rectangle, 1 for oval, 2 for rounded rectangle

public void setImageSize (int size)

Sets the size of the image.

Parameters
size Image size

public void setShapeColor (int color)

Sets the background color of the image.

Parameters
color Background color

public void setTextColor (int color)

Sets the text color of the text image.

Parameters
color Text color

public void setUseBadgeCutOut (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

public void setUseBorder (boolean useBorder)

Sets whether a border is displayed around the image.

Parameters
useBorder True if border should be displayed, false if border should not be displayed

public void setUseIcon (boolean useIcon)

Sets whether the assigned drawable should be scaled to fit in the center of the avatar.

Parameters
useIcon True if icon mode is enabled, false if icon mode is disabled

public void shouldDisplayBadge (boolean shouldDisplay)

Sets whether the badge should be displayed.

Parameters
shouldDisplay True if badge should be displayed, false if badge should not be displayed

Protected Methods

protected Bitmap cropBitmap (Bitmap bitmap, int width, int height)

protected Bitmap cropBitmap (Bitmap bitmap, int width, int height, boolean useIcon)

protected void dispatchDraw (Canvas canvas)

protected Bitmap drawableToBitmap (Drawable drawable, int width, int height)

protected void ensureAvatarImage ()

protected void ensureBadgeView ()

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)