View that displays the profile photo of a supplied profile ID, while conforming to user specified dimensions.
Hereda de: | FrameLayout |
Paquete: | widget |
ProfilePictureView(Context)
Constructor
public ProfilePictureView(Context context)
Parámetro | Descripción |
---|---|
context | Context for this View |
ProfilePictureView(Context, AttributeSet)
Constructor
public ProfilePictureView(Context context, AttributeSet attrs)
Parámetro | Descripción |
---|---|
context | Context for this View |
attrs | AttributeSet for this View. The attribute 'preset_size' is processed here |
ProfilePictureView(Context, AttributeSet, int)
Constructor
public ProfilePictureView(Context context, AttributeSet attrs, int defStyle)
Parámetro | Descripción |
---|---|
context | Context for this View |
attrs | AttributeSet for this View. The attribute 'preset_size' is processed here |
defStyle | Default style for this View |
getPresetSize()
Gets the current preset size type
public final int getPresetSize()
setPresetSize(int)
Apply a preset size to this profile photo
public final void setPresetSize(int sizeType)
Parámetro | Descripción |
---|---|
sizeType | The size type to apply: SMALL, NORMAL or LARGE |
isCropped()
Indicates whether the cropped version of the profile photo has been chosen
public final boolean isCropped()
setCropped(boolean)
Sets the profile photo to be the cropped version, or the original version
public final void setCropped(boolean showCroppedVersion)
Parámetro | Descripción |
---|---|
showCroppedVersion | True to select the cropped version False to select the standard version |
getProfileId()
Returns the profile Id for the current profile photo
public final String getProfileId()
setProfileId(String)
Sets the profile Id for this profile photo
public final void setProfileId(String profileId)
Parámetro | Descripción |
---|---|
profileId | The profileId NULL/Empty String will show the blank profile photo |
getOnErrorListener()
Returns the current OnErrorListener for this instance of ProfilePictureView
public final OnErrorListener getOnErrorListener()
setOnErrorListener(OnErrorListener)
Sets an OnErrorListener for this instance of ProfilePictureView to call into when certain exceptions occur.
public final void setOnErrorListener(OnErrorListener onErrorListener)
Parámetro | Descripción |
---|---|
onErrorListener | The Listener object to set |
setDefaultProfilePicture(Bitmap)
The ProfilePictureView will display the provided image while the specified profile is being loaded, or if the specified profile is not available.
public final void setDefaultProfilePicture(Bitmap inputBitmap)
Parámetro | Descripción |
---|---|
inputBitmap | The bitmap to render until the actual profile is loaded. |
onMeasure(int, int)
Overriding onMeasure to handle the case where WRAP_CONTENT might be specified in the layout. Since we don't know the dimensions of the profile photo, we need to handle this case specifically.
The approach is to default to a NORMAL sized amount of space in the case that a preset size is not specified. This logic is applied to both width and height
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
Parámetro | Descripción |
---|---|
widthMeasureSpec | |
heightMeasureSpec |
onLayout(boolean, int, int, int, int)
In addition to calling super.Layout(), we also attempt to get a new image that is properly size for the layout dimensions
protected void onLayout(boolean changed, int left, int top, int right, int bottom)
Parámetro | Descripción |
---|---|
changed | |
left | |
top | |
right | |
bottom |
onSaveInstanceState()
Some of the current state is returned as a Bundle to allow quick restoration of the ProfilePictureView object in scenarios like orientation changes.
protected Parcelable onSaveInstanceState()
onRestoreInstanceState(Parcelable)
If the passed in state is a Bundle, an attempt is made to restore from it.
protected void onRestoreInstanceState(Parcelable state)
Parámetro | Descripción |
---|---|
state | A Parcelable containing the current state |
onDetachedFromWindow()
protected void onDetachedFromWindow()
TAG
public static final String TAG
CUSTOM
public static final int CUSTOM
SMALL
public static final int SMALL
NORMAL
public static final int NORMAL
LARGE
public static final int LARGE