// Path: library/src/main/java/com/onegravity/contactpicker/Helper.java
// public class Helper {
// 
//     public static boolean isNullOrEmpty(CharSequence string){
//         return string == null || string.length() == 0;
//     }
// 
//     public static DisplayMetrics getDisplayMetrics(Context context) {
//         Display display = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
//         DisplayMetrics metrics = new DisplayMetrics();
//         display.getMetrics( metrics );
//         return metrics;
//     }
// 
//     public static void closeQuietly(Cursor cursor) {
//         try {
//             cursor.close();
//         }
//         catch (Exception ignore) {}
//     }
// 
//     public static void closeQuietly(Closeable closeable) {
//         try {
//             if (closeable != null) {
//                 closeable.close();
//             }
//         } catch (IOException ignore) {}
//     }
// 
// }
// 
// Path: library/src/main/java/com/onegravity/contactpicker/picture/Constants.java
// static final String[] EMAIL_LOOKUP_PROJECTION = new String[]{
//         ContactsContract.RawContacts.CONTACT_ID,
//         ContactsContract.Contacts.LOOKUP_KEY,
// };
// 
// Path: library/src/main/java/com/onegravity/contactpicker/picture/Constants.java
// static final String[] PHONE_LOOKUP_PROJECTION = new String[]{
//         ContactsContract.PhoneLookup._ID,
//         ContactsContract.PhoneLookup.LOOKUP_KEY,
// };
// 
// Path: library/src/main/java/com/onegravity/contactpicker/picture/Constants.java
// static final int TOKEN_EMAIL_LOOKUP = 0;
// 
// Path: library/src/main/java/com/onegravity/contactpicker/picture/Constants.java
// static final int TOKEN_PHONE_LOOKUP = 1;


import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources.Theme;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.OvalShape;
import android.graphics.drawable.shapes.PathShape;
import android.graphics.drawable.shapes.RectShape;
import android.graphics.drawable.shapes.Shape;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.provider.ContactsContract.CommonDataKinds.Email;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.PhoneLookup;
import android.provider.ContactsContract.QuickContact;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import com.onegravity.contactpicker.Helper;
import com.onegravity.contactpicker.R;
import static com.onegravity.contactpicker.picture.Constants.EMAIL_LOOKUP_PROJECTION;
import static com.onegravity.contactpicker.picture.Constants.PHONE_LOOKUP_PROJECTION;
import static com.onegravity.contactpicker.picture.Constants.TOKEN_EMAIL_LOOKUP;
import static com.onegravity.contactpicker.picture.Constants.TOKEN_PHONE_LOOKUP;
     * not available, as an extra query will have to be performed to lookup the URI based on the
     * phone number.
     *
     * @param phoneNumber The phone number of the contact.
     * @param lazyLookup  If this is true, the lookup query will not be performed  until this view is
     *                    clicked.
     */
    public void assignContactFromPhone(String phoneNumber, boolean lazyLookup) {
        assignContactFromPhone(phoneNumber, lazyLookup, new Bundle());
    }

    /**
     * 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.
     *
     * @param phoneNumber The phone number of the contact.
     * @param lazyLookup  If this is true, the lookup query will not be performed  until this view is
     *                    clicked.
     * @param extras      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
     *                    {@link android.provider.ContactsContract.Intents.Insert}
     */
    public void assignContactFromPhone(String phoneNumber, boolean lazyLookup, Bundle extras) {
        mContactPhone = phoneNumber;
        mExtras = extras;
        if (!lazyLookup && mQueryHandler != null) {
            mQueryHandler.startQuery(TOKEN_PHONE_LOOKUP, null,
                    Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, mContactPhone),
// Path: library/src/main/java/com/onegravity/contactpicker/Helper.java
// public class Helper {
// 
//     public static boolean isNullOrEmpty(CharSequence string){
//         return string == null || string.length() == 0;
//     }
// 
//     public static DisplayMetrics getDisplayMetrics(Context context) {
//         Display display = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
//         DisplayMetrics metrics = new DisplayMetrics();
//         display.getMetrics( metrics );
//         return metrics;
//     }
// 
//     public static void closeQuietly(Cursor cursor) {
//         try {
//             cursor.close();
//         }
//         catch (Exception ignore) {}
//     }
// 
//     public static void closeQuietly(Closeable closeable) {
//         try {
//             if (closeable != null) {
//                 closeable.close();
//             }
//         } catch (IOException ignore) {}
//     }
// 
// }
// 
// Path: library/src/main/java/com/onegravity/contactpicker/picture/Constants.java
// static final String[] EMAIL_LOOKUP_PROJECTION = new String[]{
//         ContactsContract.RawContacts.CONTACT_ID,
//         ContactsContract.Contacts.LOOKUP_KEY,
// };
// 
// Path: library/src/main/java/com/onegravity/contactpicker/picture/Constants.java
// static final String[] PHONE_LOOKUP_PROJECTION = new String[]{
//         ContactsContract.PhoneLookup._ID,
//         ContactsContract.PhoneLookup.LOOKUP_KEY,
// };
// 
// Path: library/src/main/java/com/onegravity/contactpicker/picture/Constants.java
// static final int TOKEN_EMAIL_LOOKUP = 0;
// 
// Path: library/src/main/java/com/onegravity/contactpicker/picture/Constants.java
// static final int TOKEN_PHONE_LOOKUP = 1;


// Path: library/src/main/java/com/onegravity/contactpicker/picture/ContactBadge.java
import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources.Theme;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.OvalShape;
import android.graphics.drawable.shapes.PathShape;
import android.graphics.drawable.shapes.RectShape;
import android.graphics.drawable.shapes.Shape;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.provider.ContactsContract.CommonDataKinds.Email;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.PhoneLookup;
import android.provider.ContactsContract.QuickContact;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import com.onegravity.contactpicker.Helper;
import com.onegravity.contactpicker.R;
import static com.onegravity.contactpicker.picture.Constants.EMAIL_LOOKUP_PROJECTION;
import static com.onegravity.contactpicker.picture.Constants.PHONE_LOOKUP_PROJECTION;
import static com.onegravity.contactpicker.picture.Constants.TOKEN_EMAIL_LOOKUP;
import static com.onegravity.contactpicker.picture.Constants.TOKEN_PHONE_LOOKUP;

     * not available, as an extra query will have to be performed to lookup the URI based on the
     * phone number.
     *
     * @param phoneNumber The phone number of the contact.
     * @param lazyLookup  If this is true, the lookup query will not be performed  until this view is
     *                    clicked.
     */
    public void assignContactFromPhone(String phoneNumber, boolean lazyLookup) {
        assignContactFromPhone(phoneNumber, lazyLookup, new Bundle());
    }

    /**
     * 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.
     *
     * @param phoneNumber The phone number of the contact.
     * @param lazyLookup  If this is true, the lookup query will not be performed  until this view is
     *                    clicked.
     * @param extras      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
     *                    {@link android.provider.ContactsContract.Intents.Insert}
     */
    public void assignContactFromPhone(String phoneNumber, boolean lazyLookup, Bundle extras) {
        mContactPhone = phoneNumber;
        mExtras = extras;
        if (!lazyLookup && mQueryHandler != null) {
            mQueryHandler.startQuery(TOKEN_PHONE_LOOKUP, null,
                    Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, mContactPhone),
                    PHONE_LOOKUP_PROJECTION, null, null, null, mContactQueryHandlerCallback);