public class

FioriAvatarImage

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

Summary

Constants
int IMAGE_SHAPE_OVAL
int IMAGE_SHAPE_RECTANGLE
int IMAGE_SHAPE_ROUND_RECT
[Expand]
Inherited Constants
From class android.view.ViewGroup
From class android.view.View
Fields
protected int mBackgroundColor
protected float mBorderStrokeWidth
protected int mIconSize
protected CharSequence mImageCharacter
protected int mImageOutlineShape
protected int mImageSize
protected TextView mImageTextView
protected ImageView mImageView
protected int mTextColor
protected boolean mUseBorder
protected boolean mUseIcon
protected static ViewOutlineProvider sOvalOutlineProvider
protected static ViewOutlineProvider sRoundRectOutlineProvider
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
FioriAvatarImage(Context context)
FioriAvatarImage(Context context, AttributeSet attrs)
FioriAvatarImage(Context context, AttributeSet attrs, int defStyleAttr)
FioriAvatarImage(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
Public Methods
Paint getBorderPaint()
Gets the paint used for the border.
int getIconSize()
Gets the size of the drawable in icon mode.
Drawable getImage()
Gets the drawable used as the image.
CharSequence getImageCharacter()
Gets the text used as 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.
ViewOutlineProvider getOvalProvider()
ViewOutlineProvider getRoundRectProvider()
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 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.
Protected Methods
void dispatchDraw(Canvas canvas)
void ensureImageTextView()
void ensureImageView()
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 refreshViews()
void updateImageOutlineShape()
[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 IMAGE_SHAPE_OVAL

Constant Value: 1 (0x00000001)

public static final int IMAGE_SHAPE_RECTANGLE

Constant Value: 0 (0x00000000)

public static final int IMAGE_SHAPE_ROUND_RECT

Constant Value: 2 (0x00000002)

Fields

protected int mBackgroundColor

protected float mBorderStrokeWidth

protected int mIconSize

protected CharSequence mImageCharacter

protected int mImageOutlineShape

protected int mImageSize

protected TextView mImageTextView

protected ImageView mImageView

protected int mTextColor

protected boolean mUseBorder

protected boolean mUseIcon

protected static ViewOutlineProvider sOvalOutlineProvider

protected static ViewOutlineProvider sRoundRectOutlineProvider

Public Constructors

public FioriAvatarImage (Context context)

public FioriAvatarImage (Context context, AttributeSet attrs)

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

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

Public Methods

public Paint getBorderPaint ()

Gets the paint used for the border.

Returns
  • Border paint

public int getIconSize ()

Gets the size of the drawable in icon mode.

Returns
  • Icon size

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 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 ViewOutlineProvider getOvalProvider ()

public ViewOutlineProvider getRoundRectProvider ()

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 IMAGE_SHAPE_RECTANGLE, 1 for IMAGE_SHAPE_OVAL, 2 for IMAGE_SHAPE_ROUND_RECT

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

Protected Methods

protected void dispatchDraw (Canvas canvas)

protected void ensureImageTextView ()

protected void ensureImageView ()

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 refreshViews ()

protected void updateImageOutlineShape ()