Added in API level 5

QuickContactBadge


open class QuickContactBadge : ImageView, View.OnClickListener
kotlin.Any
   ↳ android.view.View
   ↳ android.widget.ImageView
   ↳ android.widget.QuickContactBadge

Widget used to show an image with the standard QuickContact badge and on-click behavior.

Summary

Inherited XML attributes
Inherited constants
Public constructors

QuickContactBadge(context: Context!, attrs: AttributeSet!)

QuickContactBadge(context: Context!, attrs: AttributeSet!, defStyleAttr: Int)

QuickContactBadge(context: Context!, attrs: AttributeSet!, defStyleAttr: Int, defStyleRes: Int)

Public methods
open Unit
assignContactFromEmail(emailAddress: String!, lazyLookup: Boolean)

Assign a contact based on an email address.

open Unit
assignContactFromEmail(emailAddress: String!, lazyLookup: Boolean, extras: Bundle!)

Assign a contact based on an email address.

open Unit
assignContactFromPhone(phoneNumber: String!, lazyLookup: Boolean)

Assign a contact based on a phone number.

open Unit
assignContactFromPhone(phoneNumber: String!, lazyLookup: Boolean, extras: Bundle!)

Assign a contact based on a phone number.

open Unit
assignContactUri(contactUri: Uri!)

Assign the contact uri that this QuickContactBadge should be associated with.

open Unit

This function is called whenever the view hotspot changes and needs to be propagated to drawables or child views managed by the view.

open CharSequence!

Return the class name of this object to be used for accessibility purposes.

open Unit

Called when a view has been clicked.

open Unit
setExcludeMimes(excludeMimes: Array<String!>!)

Set a list of specific MIME-types to exclude and not display.

open Unit

Resets the contact photo to the default state.

open Unit
setMode(size: Int)

This call has no effect anymore, as there is only one QuickContact mode

open Unit
setOverlay(overlay: Drawable!)

Assigns the drawable that is to be drawn on top of the assigned contact photo.

open Unit
setPrioritizedMimeType(prioritizedMimeType: String!)

Set which mimetype should be prioritized in the QuickContacts UI.

Protected methods
open Unit

This function is called whenever the state of the view changes in such a way that it impacts the state of drawables being shown.

open Unit

This is called when the view is attached to a window.

open Unit
onDraw(canvas: Canvas)

Implement this to do your drawing.

Inherited functions
Properties
Array<String!>!

Inherited properties

Public constructors

QuickContactBadge

Added in API level 5
QuickContactBadge(context: Context!)

QuickContactBadge

Added in API level 5
QuickContactBadge(
    context: Context!,
    attrs: AttributeSet!)

QuickContactBadge

Added in API level 5
QuickContactBadge(
    context: Context!,
    attrs: AttributeSet!,
    defStyleAttr: Int)

QuickContactBadge

Added in API level 21
QuickContactBadge(
    context: Context!,
    attrs: AttributeSet!,
    defStyleAttr: Int,
    defStyleRes: Int)

Public methods

assignContactFromEmail

Added in API level 5
open fun assignContactFromEmail(
    emailAddress: String!,
    lazyLookup: Boolean
): Unit

Assign a contact based on an email address. This should only be used when the contact's URI is not available, as an extra query will have to be performed to lookup the URI based on the email.

Parameters
emailAddress String!: The email address of the contact.
lazyLookup Boolean: If this is true, the lookup query will not be performed until this view is clicked.

assignContactFromEmail

Added in API level 18
open fun assignContactFromEmail(
    emailAddress: String!,
    lazyLookup: Boolean,
    extras: Bundle!
): Unit

Assign a contact based on an email address. This should only be used when the contact's URI is not available, as an extra query will have to be performed to lookup the URI based on the email.

Parameters
emailAddress String!: The email address of the contact.
lazyLookup Boolean: If this is true, the lookup query will not be performed until this view is clicked.
extras Bundle!: A bundle of extras to populate the contact edit page with if the contact is not found and the user chooses to add the email address to an existing contact or create a new contact. Uses the same string constants as those found in android.provider.ContactsContract.Intents.Insert

assignContactFromPhone

Added in API level 5
open fun assignContactFromPhone(
    phoneNumber: String!,
    lazyLookup: Boolean
): Unit

Assign a contact based on a phone number. This should only be used when the contact's URI is not available, as an extra query will have to be performed to lookup the URI based on the phone number.

Parameters
phoneNumber String!: The phone number of the contact.
lazyLookup Boolean: If this is true, the lookup query will not be performed until this view is clicked.

assignContactFromPhone

Added in API level 18
open fun assignContactFromPhone(
    phoneNumber: String!,
    lazyLookup: Boolean,
    extras: Bundle!
): Unit

Assign a contact based on a phone number. This should only be used when the contact's URI is not available, as an extra query will have to be performed to lookup the URI based on the phone number.

Parameters
phoneNumber String!: The phone number of the contact.
lazyLookup Boolean: If this is true, the lookup query will not be performed until this view is clicked.
extras Bundle!: A bundle of extras to populate the contact edit page with if the contact is not found and the user chooses to add the phone number to an existing contact or create a new contact. Uses the same string constants as those found in android.provider.ContactsContract.Intents.Insert

assignContactUri

Added in API level 5
open fun assignContactUri(contactUri: Uri!): Unit

Assign the contact uri that this QuickContactBadge should be associated with. Note that this is only used for displaying the QuickContact window and won't bind the contact's photo for you. Call setImageDrawable(android.graphics.drawable.Drawable) to set the photo.

Parameters
contactUri Uri!: Either a Contacts.CONTENT_URI or Contacts.CONTENT_LOOKUP_URI style URI.

drawableHotspotChanged

Added in API level 21
open fun drawableHotspotChanged(
    x: Float,
    y: Float
): Unit

This function is called whenever the view hotspot changes and needs to be propagated to drawables or child views managed by the view.

Dispatching to child views is handled by dispatchDrawableHotspotChanged(float,float).

Be sure to call through to the superclass when overriding this function.
If you override this method you must call through to the superclass implementation.

Parameters
x Float: hotspot x coordinate
y Float: hotspot y coordinate

getAccessibilityClassName

Added in API level 23
open fun getAccessibilityClassName(): CharSequence!

Return the class name of this object to be used for accessibility purposes. Subclasses should only override this if they are implementing something that should be seen as a completely new class of view when used by accessibility, unrelated to the class it is deriving from. This is used to fill in AccessibilityNodeInfo.setClassName.

onClick

Added in API level 5
open fun onClick(v: View!): Unit

Called when a view has been clicked.

Parameters
v View!: The view that was clicked.

setExcludeMimes

Added in API level 5
open fun setExcludeMimes(excludeMimes: Array<String!>!): Unit

Set a list of specific MIME-types to exclude and not display. For example, this can be used to hide the Contacts.CONTENT_ITEM_TYPE profile icon.

setImageToDefault

Added in API level 11
open fun setImageToDefault(): Unit

Resets the contact photo to the default state.

setMode

Added in API level 5
open fun setMode(size: Int): Unit

This call has no effect anymore, as there is only one QuickContact mode

setOverlay

Added in API level 21
open fun setOverlay(overlay: Drawable!): Unit

Assigns the drawable that is to be drawn on top of the assigned contact photo.

Parameters
overlay Drawable!: Drawable to be drawn over the assigned contact photo. Must have a non-zero instrinsic width and height.

setPrioritizedMimeType

Added in API level 23
open fun setPrioritizedMimeType(prioritizedMimeType: String!): Unit

Set which mimetype should be prioritized in the QuickContacts UI. For example, passing the value Email.CONTENT_ITEM_TYPE can cause emails to be displayed more prominently in QuickContacts.

Protected methods

drawableStateChanged

Added in API level 5
protected open fun drawableStateChanged(): Unit

This function is called whenever the state of the view changes in such a way that it impacts the state of drawables being shown.

If the View has a StateListAnimator, it will also be called to run necessary state change animations.

Be sure to call through to the superclass when overriding this function.
If you override this method you must call through to the superclass implementation.

onAttachedToWindow

Added in API level 5
protected open fun onAttachedToWindow(): Unit

This is called when the view is attached to a window. At this point it has a Surface and will start drawing. Note that this function is guaranteed to be called before onDraw(android.graphics.Canvas), however it may be called any time before the first onDraw -- including before or after onMeasure(int,int).
If you override this method you must call through to the superclass implementation.

onDraw

Added in API level 5
protected open fun onDraw(canvas: Canvas): Unit

Implement this to do your drawing.

Parameters
canvas Canvas: the canvas on which the background will be drawn.
This value cannot be null.

Properties

mExcludeMimes

Added in API level 5
protected var mExcludeMimes: Array<String!>!