// 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) {}
//     }
// 
// }


import android.content.AsyncQueryHandler;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.util.Log;
import com.onegravity.contactpicker.Helper;
                case Constants.TOKEN_PHONE_LOOKUP: {
                    if (cursor != null && cursor.moveToFirst()) {
                        long contactId = cursor.getLong(Constants.PHONE_ID_COLUMN_INDEX);
                        String lookupKey = cursor.getString(Constants.PHONE_LOOKUP_STRING_COLUMN_INDEX);
                        lookupUri = ContactsContract.Contacts.getLookupUri(contactId, lookupKey);
                    }

                    break;
                }

                case Constants.TOKEN_EMAIL_LOOKUP_AND_TRIGGER:
                    trigger = true;
                    createUri = Uri.fromParts("mailto", extras.getString(Constants.EXTRA_URI_CONTENT), null);

                    // $FALL-THROUGH$

                case Constants.TOKEN_EMAIL_LOOKUP: {
                    if (cursor != null && cursor.moveToFirst()) {
                        long contactId = cursor.getLong(Constants.EMAIL_ID_COLUMN_INDEX);
                        String lookupKey = cursor.getString(Constants.EMAIL_LOOKUP_STRING_COLUMN_INDEX);
                        lookupUri = ContactsContract.Contacts.getLookupUri(contactId, lookupKey);
                    }
                    break;
                }
            }
        }
        catch (Exception e) {
            Log.w(getClass().getSimpleName(), "Failed to get data: " + e.getMessage());
        }
        finally {
// 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/ContactQueryHandler.java
import android.content.AsyncQueryHandler;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.util.Log;
import com.onegravity.contactpicker.Helper;

                case Constants.TOKEN_PHONE_LOOKUP: {
                    if (cursor != null && cursor.moveToFirst()) {
                        long contactId = cursor.getLong(Constants.PHONE_ID_COLUMN_INDEX);
                        String lookupKey = cursor.getString(Constants.PHONE_LOOKUP_STRING_COLUMN_INDEX);
                        lookupUri = ContactsContract.Contacts.getLookupUri(contactId, lookupKey);
                    }

                    break;
                }

                case Constants.TOKEN_EMAIL_LOOKUP_AND_TRIGGER:
                    trigger = true;
                    createUri = Uri.fromParts("mailto", extras.getString(Constants.EXTRA_URI_CONTENT), null);

                    // $FALL-THROUGH$

                case Constants.TOKEN_EMAIL_LOOKUP: {
                    if (cursor != null && cursor.moveToFirst()) {
                        long contactId = cursor.getLong(Constants.EMAIL_ID_COLUMN_INDEX);
                        String lookupKey = cursor.getString(Constants.EMAIL_LOOKUP_STRING_COLUMN_INDEX);
                        lookupUri = ContactsContract.Contacts.getLookupUri(contactId, lookupKey);
                    }
                    break;
                }
            }
        }
        catch (Exception e) {
            Log.w(getClass().getSimpleName(), "Failed to get data: " + e.getMessage());
        }
        finally {
            Helper.closeQuietly(cursor);