public static final class

HtcUnionContact.ContactUtils

extends Object
java.lang.Object
   ↳ android.provider.HtcUnionContact.ContactUtils

Class Overview

Utilities for Contacts

Summary

Constants
int CALL_TYPE_COLUMN_INDEX
int DATE_COLUMN_INDEX
int EVENTS_EVENT_ID_COLUMN
int EVENTS_ID_COLUMN
int EVENTS_PERSON_COLUMN
int EVENT_ID_COLUMN
int ID_COLUMN_INDEX
String MY_CONTACT_ACCOUNT_NAME
String MY_CONTACT_ACCOUNT_TYPE
String MY_CONTACT_SOURCE_ID
int NUMBER_COLUMN_INDEX
String WHERE_NEW_MISS_CALL
Fields
public static final String[] CALL_LOG_PROJECTION The projection to use when querying the call log table
public static final String[] EVENTS_PROJECTION
public static final String[] EVENT_PROJECTION
Public Constructors
HtcUnionContact.ContactUtils()
Public Methods
static void addFavorite(Context context, long personId)
static long addGroup(Context context, String groupName)
This method is used to add a new group
static void addGroupMember(Context context, long groupId, long personId)
This method is used to add a contact to a group
static void deleteContact(Context context, long personId)
This method is used to delete a specific contact
static void deleteGroup(Context context, long groupId)
This method is used to delete a group
static void deleteGroupMember(Context context, long groupId, long personId)
This method is used to delete a contact from a group
static int deleteMyCotactCardInfoEntry(Context context, long id)
static void drawBottomLeftOverlay(Bitmap bmSrc, Bitmap bmOverlay)
static Bitmap getCenterCropImage(String filepath, int cropWidth, int cropHeight)
Obtain center crop bitmap
static Bitmap getCenterCropImage(ContentResolver resolver, Uri uri, int cropWidth, int cropHeight)
Obtain center crop bitmap
static Intent getEditMyContactCardIntent()
static String getMailAddressByUri(ContentResolver resolver, Uri u)
This method is used to get mail address only for this type of uri
static Bundle getMyContactIds(ContentResolver resolver)
final static Bitmap getMyContactPossiblePhotoBitmap(ContentResolver resolver, BitmapFactory.Options opts)
This method is used to get the my contact bitmap
static Cursor getNewMissedCalls(ContentResolver r, long contactId)
static String getPhoneNumberByUri(ContentResolver resolver, Uri u)
This method is used to get phone number only for this type of uri
static String getPhoneNumberTypeShortString(Context context, int type)
static String getPhoneNumberTypeShortStringWithColon(Context context, int type)
Get the short representation of phone number type end with colon.
static String getPhoneNumberTypeString(Context context, int type)
static Uri getQueryContactUriByName(Context context, String name)
TODO This method is used to query contact's uri by full name
static Uri getQueryContactUriByNumber(Context context, String number)
TODO This method is used to query contact's uri by full name
static Bitmap getScaledBitmap(byte[] data, int nTargetWidth, int nTargetHeight, byte[] inTempStorage)
static Bitmap getScaledBitmap(byte[] data, int nTargeWidth, int nTargetHeight)
static Bitmap getScaledBitmap(String filePath, int nTargetWidth, int nTargetHeight, byte[] inTempStorage)
static Bitmap getScaledCenterCropBitmap(byte[] data, int nTargetWidth, int nTargetHeight)
static Bitmap getScaledCenterCropBitmap(Bitmap bmSrc, byte[] overlay, int nTargetSize)
This method is deprecated. Use the one in Phone_Contacts module instead
static Bitmap getScaledCenterCropBitmap(byte[] data, int nTargetWidth, int nTargetHeight, Bitmap bmOverlay)
static Bitmap getScaledCenterCropBitmap(Bitmap bmSrc, int nTargetWidth, int nTargetHeight)
static Bitmap getScaledCenterCropBitmap(String filePath, int nTargetWidth, int nTargetHeight)
static Bitmap getScaledCenterCropBitmap(byte[] data, int nTargetWidth, int nTargetHeight, byte[] overlay)
static String getSimpleCallerNameByNumber(Context context, String number)
static String getUnreadMessageQuertForMailAddressSelection(ContentResolver r, long personId)
static Intent getViewContactCardIntent(long personId)
static Intent getViewOrEditMyContactCardIntent(Context context)
Generate a intent to view or edit my contact card.
static Intent getViewOrEditMyContactCardIntent()
Generate a intent to view or edit my contact card.
static Uri insertMyCotactCardInfoEntry(Context context, ContentValues values)
static boolean isPeopleEvent(Context context, Uri eventUri)
static Cursor queryContactEmailAddresses(Context context, long person)
To query the emails of a give contact.
static Cursor queryContactMethodsInfo(Context context, Uri contactUri)
static Cursor queryContactsByName(Context context, String name)
This method is used to query contacts by full name
static Cursor queryContactsByNumber(Context context, String number)
This method is used to query contacts by number
static long queryFavoritesGroupId(Context context)
Query the group name with specific group ID
static Cursor queryGroupContains(Context context, long personId)
This method is used to query which group the contact belongs to.
static Cursor queryGroupMembers(Context context, long groupId)
This method is used to query speciic group members
static int queryMissedCallCount(ContentResolver r, long personId)
static Cursor queryMyCotactCardInfo(Context context)
This method is used to query my contact info
static Cursor queryNonGroupMembers(Context context, long groupId)
This method is used to query contacts that are not belong to the specific group
static Cursor queryPeopleInfo(Context context, Uri contactUri)
static Cursor queryPhonesInfo(Context context, Uri contactUri)
static int queryUnreadEmailCount(ContentResolver r, long personId)
static int queryUnreadMessageCount(ContentResolver r, long personId)
static boolean setContactPhoto(Context context, long personId, Bitmap photo)
This method is used to set specific contact photo
static void setPersonalRingtone(Context context, long personId, Uri ringtoneUri)
This method is used to set rington to a specfic contact
static int updateGroupNameWithId(Context context, long groupId, String name)
Update the existed group's name with the given name
static void updateImageViewWithContactPhoto(Context context, ImageView imageView, Uri contactUri, int placeholderImageResource)
This method is used to set the Contact Image to a image view
static void updateImageViewWithGroupPhoto(Context context, ImageView imageView, Uri groupUri, int placeholderImageResource)
This method is used to set the Group Image to a image view
static void updateImageViewWithMyContactPhoto(Context context, ImageView imageView, int placeholderImageResource)
This method is used to set the my contact Image to a image view
final static void updateImageViewWithMyContactPossiblePhoto(ContentResolver resolver, ImageView imageView, int placeholderImageResource, BitmapFactory.Options opts)
This method is used to set the my contact Image to a image view
static int updateMyCotactCardInfoEntry(Context context, ContentValues values, long id)
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int CALL_TYPE_COLUMN_INDEX

Constant Value: 3 (0x00000003)

public static final int DATE_COLUMN_INDEX

Constant Value: 2 (0x00000002)

public static final int EVENTS_EVENT_ID_COLUMN

Constant Value: 2 (0x00000002)

public static final int EVENTS_ID_COLUMN

Constant Value: 0 (0x00000000)

public static final int EVENTS_PERSON_COLUMN

Constant Value: 1 (0x00000001)

public static final int EVENT_ID_COLUMN

Constant Value: 0 (0x00000000)

public static final int ID_COLUMN_INDEX

Constant Value: 0 (0x00000000)

public static final String MY_CONTACT_ACCOUNT_NAME

Constant Value: "HTC"

public static final String MY_CONTACT_ACCOUNT_TYPE

Constant Value: "DeviceOnly"

public static final String MY_CONTACT_SOURCE_ID

Constant Value: "HTC_01"

public static final int NUMBER_COLUMN_INDEX

Constant Value: 1 (0x00000001)

public static final String WHERE_NEW_MISS_CALL

Constant Value: "type=3 AND new=1 "

Fields

public static final String[] CALL_LOG_PROJECTION

The projection to use when querying the call log table

public static final String[] EVENTS_PROJECTION

public static final String[] EVENT_PROJECTION

Public Constructors

public HtcUnionContact.ContactUtils ()

Public Methods

public static void addFavorite (Context context, long personId)

public static long addGroup (Context context, String groupName)

This method is used to add a new group

public static void addGroupMember (Context context, long groupId, long personId)

This method is used to add a contact to a group

public static void deleteContact (Context context, long personId)

This method is used to delete a specific contact

public static void deleteGroup (Context context, long groupId)

This method is used to delete a group

public static void deleteGroupMember (Context context, long groupId, long personId)

This method is used to delete a contact from a group

public static int deleteMyCotactCardInfoEntry (Context context, long id)

public static void drawBottomLeftOverlay (Bitmap bmSrc, Bitmap bmOverlay)

public static Bitmap getCenterCropImage (String filepath, int cropWidth, int cropHeight)

Obtain center crop bitmap

Parameters
filepath the image file path
cropWidth new image width
cropHeight new image height
Returns
  • crop bitmap

public static Bitmap getCenterCropImage (ContentResolver resolver, Uri uri, int cropWidth, int cropHeight)

Obtain center crop bitmap

Parameters
resolver content resolver
uri content uri
cropWidth new image width
cropHeight new image height
Returns
  • crop bitmap

public static Intent getEditMyContactCardIntent ()

public static String getMailAddressByUri (ContentResolver resolver, Uri u)

This method is used to get mail address only for this type of uri

Parameters
u content://com.android.contacts/data/#

public static Bundle getMyContactIds (ContentResolver resolver)

Returns
  • Bundle return bundle with raw contact id and contact id it is better that call this method in non UI thread get raw contact id by getLong(ContactsContract.RawContacts._ID) get contact id by getLong(ContactsContract.RawContacts.CONTACT_ID) *

public static final Bitmap getMyContactPossiblePhotoBitmap (ContentResolver resolver, BitmapFactory.Options opts)

This method is used to get the my contact bitmap

public static Cursor getNewMissedCalls (ContentResolver r, long contactId)

Parameters
r the content resolver
contactId the person ID
Returns
  • a cursor contains all new missed call belongs to specified person

public static String getPhoneNumberByUri (ContentResolver resolver, Uri u)

This method is used to get phone number only for this type of uri

Parameters
u content://com.android.contacts/data/#

public static String getPhoneNumberTypeShortString (Context context, int type)

public static String getPhoneNumberTypeShortStringWithColon (Context context, int type)

Get the short representation of phone number type end with colon. A performance version

Parameters
type The phone number type
Returns
  • The short represenation string

public static String getPhoneNumberTypeString (Context context, int type)

public static Uri getQueryContactUriByName (Context context, String name)

TODO This method is used to query contact's uri by full name

public static Uri getQueryContactUriByNumber (Context context, String number)

TODO This method is used to query contact's uri by full name

public static Bitmap getScaledBitmap (byte[] data, int nTargetWidth, int nTargetHeight, byte[] inTempStorage)

public static Bitmap getScaledBitmap (byte[] data, int nTargeWidth, int nTargetHeight)

public static Bitmap getScaledBitmap (String filePath, int nTargetWidth, int nTargetHeight, byte[] inTempStorage)

public static Bitmap getScaledCenterCropBitmap (byte[] data, int nTargetWidth, int nTargetHeight)

public static Bitmap getScaledCenterCropBitmap (Bitmap bmSrc, byte[] overlay, int nTargetSize)

This method is deprecated.
Use the one in Phone_Contacts module instead

@return

public static Bitmap getScaledCenterCropBitmap (byte[] data, int nTargetWidth, int nTargetHeight, Bitmap bmOverlay)

public static Bitmap getScaledCenterCropBitmap (Bitmap bmSrc, int nTargetWidth, int nTargetHeight)

public static Bitmap getScaledCenterCropBitmap (String filePath, int nTargetWidth, int nTargetHeight)

public static Bitmap getScaledCenterCropBitmap (byte[] data, int nTargetWidth, int nTargetHeight, byte[] overlay)

public static String getSimpleCallerNameByNumber (Context context, String number)

public static String getUnreadMessageQuertForMailAddressSelection (ContentResolver r, long personId)

public static Intent getViewContactCardIntent (long personId)

public static Intent getViewOrEditMyContactCardIntent (Context context)

Generate a intent to view or edit my contact card. If my contact card information is non-set, return edit intent, otherwise, return view intent Need permission: "android.permission.READ_CONTACTS"

Parameters
context The content resolver context
Returns
  • The view/edit my contact card intent

public static Intent getViewOrEditMyContactCardIntent ()

Generate a intent to view or edit my contact card. If my contact card information is non-set, return edit intent, otherwise, return view intent

Returns
  • The view or edit intent

public static Uri insertMyCotactCardInfoEntry (Context context, ContentValues values)

public static boolean isPeopleEvent (Context context, Uri eventUri)

public static Cursor queryContactEmailAddresses (Context context, long person)

To query the emails of a give contact. Deprecated, please use com.htc.provider.ContactsContract.CommonDataKinds.Email.queryContactEmailAddresses

Parameters
context The context
person The person's id
Returns
  • the cursor

public static Cursor queryContactMethodsInfo (Context context, Uri contactUri)

public static Cursor queryContactsByName (Context context, String name)

This method is used to query contacts by full name

public static Cursor queryContactsByNumber (Context context, String number)

This method is used to query contacts by number

public static long queryFavoritesGroupId (Context context)

Query the group name with specific group ID

Parameters
context The context. Used to get the content resolver.
Returns
  • The group id. Get 0 if not existed.

public static Cursor queryGroupContains (Context context, long personId)

This method is used to query which group the contact belongs to.

public static Cursor queryGroupMembers (Context context, long groupId)

This method is used to query speciic group members

public static int queryMissedCallCount (ContentResolver r, long personId)

public static Cursor queryMyCotactCardInfo (Context context)

This method is used to query my contact info

public static Cursor queryNonGroupMembers (Context context, long groupId)

This method is used to query contacts that are not belong to the specific group

public static Cursor queryPeopleInfo (Context context, Uri contactUri)

public static Cursor queryPhonesInfo (Context context, Uri contactUri)

public static int queryUnreadEmailCount (ContentResolver r, long personId)

public static int queryUnreadMessageCount (ContentResolver r, long personId)

public static boolean setContactPhoto (Context context, long personId, Bitmap photo)

This method is used to set specific contact photo

public static void setPersonalRingtone (Context context, long personId, Uri ringtoneUri)

This method is used to set rington to a specfic contact

public static int updateGroupNameWithId (Context context, long groupId, String name)

Update the existed group's name with the given name

Parameters
context The context. Used to get the content resolver.
groupId The target group ID
name The new name of specific group
Returns
  • The updated group ID. Return -1 if update fail or wrong

public static void updateImageViewWithContactPhoto (Context context, ImageView imageView, Uri contactUri, int placeholderImageResource)

This method is used to set the Contact Image to a image view

public static void updateImageViewWithGroupPhoto (Context context, ImageView imageView, Uri groupUri, int placeholderImageResource)

This method is used to set the Group Image to a image view

public static void updateImageViewWithMyContactPhoto (Context context, ImageView imageView, int placeholderImageResource)

This method is used to set the my contact Image to a image view

public static final void updateImageViewWithMyContactPossiblePhoto (ContentResolver resolver, ImageView imageView, int placeholderImageResource, BitmapFactory.Options opts)

This method is used to set the my contact Image to a image view

public static int updateMyCotactCardInfoEntry (Context context, ContentValues values, long id)