// 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;
    private ShapeDrawable mTriangle;
    private Paint mLinePaint;
    private float mOffset;

    // pressed overlay
    private boolean mIsPressed;
    private ShapeDrawable mPressedOverlay;

    private boolean mRoundContactPictures = true;

    private String mKey;

    private float mDensity;

    public ContactBadge(Context context) {
        this(context, null);
    }

    public ContactBadge(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public ContactBadge(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);

        if (!isInEditMode()) {
            mQueryHandler = new ContactQueryHandler(context, mExcludeMimes);
        }
        setOnClickListener(this);

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

    private ShapeDrawable mTriangle;
    private Paint mLinePaint;
    private float mOffset;

    // pressed overlay
    private boolean mIsPressed;
    private ShapeDrawable mPressedOverlay;

    private boolean mRoundContactPictures = true;

    private String mKey;

    private float mDensity;

    public ContactBadge(Context context) {
        this(context, null);
    }

    public ContactBadge(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public ContactBadge(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);

        if (!isInEditMode()) {
            mQueryHandler = new ContactQueryHandler(context, mExcludeMimes);
        }
        setOnClickListener(this);

        mDensity = Helper.getDisplayMetrics(context).density;