Projects >> platform_packages_apps_Phone >>d58025cd3578a30966f641877ff802abd68787cb

Chunk
Conflicting content
    private static final int MENU_IMPORT_ONE = 1;
    private static final int MENU_IMPORT_ALL = 2;
    private ProgressDialog mProgressDialog;
<<<<<<< HEAD


    @Override
    protected void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        registerForContextMenu(getListView());
=======
    
    private static class NamePhoneTypePair {
        final String name;
        final int phoneType;
        public NamePhoneTypePair(String nameWithPhoneType) {
            // Look for /W /H /M or /O at the end of the name signifying the type
            int nameLen = nameWithPhoneType.length();
            if (nameLen - 2 >= 0 && nameWithPhoneType.charAt(nameLen - 2) == '/') {
                char c = Character.toUpperCase(nameWithPhoneType.charAt(nameLen - 1));
                if (c == 'W') {
                    phoneType = Phone.TYPE_WORK;
                } else if (c == 'M' || c == 'O') {
                    phoneType = Phone.TYPE_MOBILE;
                } else if (c == 'H') {
                    phoneType = Phone.TYPE_HOME;
                } else {
                    phoneType = Phone.TYPE_OTHER;
                }
                name = nameWithPhoneType.substring(0, nameLen - 2);
            } else {
                phoneType = Phone.TYPE_OTHER;
                name = nameWithPhoneType;
            }
        }
>>>>>>> ced63bc52301ba1cce003e22a576b832dbb049d0
    }

    private class ImportAllSimContactsThread extends Thread
Solution content
    private static final int MENU_IMPORT_ONE = 1;
    private static final int MENU_IMPORT_ALL = 2;
    private ProgressDialog mProgressDialog;

    private static class NamePhoneTypePair {
        final String name;
        final int phoneType;
        public NamePhoneTypePair(String nameWithPhoneType) {
            // Look for /W /H /M or /O at the end of the name signifying the type
            int nameLen = nameWithPhoneType.length();
            if (nameLen - 2 >= 0 && nameWithPhoneType.charAt(nameLen - 2) == '/') {
                char c = Character.toUpperCase(nameWithPhoneType.charAt(nameLen - 1));
                if (c == 'W') {
                    phoneType = Phone.TYPE_WORK;
                } else if (c == 'M' || c == 'O') {
                    phoneType = Phone.TYPE_MOBILE;
                } else if (c == 'H') {
                    phoneType = Phone.TYPE_HOME;
                } else {
                    phoneType = Phone.TYPE_OTHER;
                }
                name = nameWithPhoneType.substring(0, nameLen - 2);
            } else {
                phoneType = Phone.TYPE_OTHER;
                name = nameWithPhoneType;
            }
        }
    }

    private class ImportAllSimContactsThread extends Thread
File
SimContacts.java
Developer's decision
Version 2
Kind of conflict
Annotation
Attribute
Class signature
Method declaration
Method invocation
Method signature
Chunk
Conflicting content
    private class ImportAllSimContactsThread extends Thread
            implements OnCancelListener, OnClickListener {
        boolean mCanceled = false;
<<<<<<< HEAD

        public ImportAllThread() {
            super("ImportAllThread");
=======
        
        public ImportAllSimContactsThread() {
            super("ImportAllSimContactsThread");
>>>>>>> ced63bc52301ba1cce003e22a576b832dbb049d0
        }

        @Override
Solution content
    private class ImportAllSimContactsThread extends Thread
            implements OnCancelListener, OnClickListener {

        boolean mCanceled = false;

        public ImportAllSimContactsThread() {
            super("ImportAllSimContactsThread");
        }

        @Override
File
SimContacts.java
Developer's decision
Manual
Kind of conflict
Method invocation
Method signature
Chunk
Conflicting content
        @Override
        public void run() {
<<<<<<< HEAD
            ContentValues map = new ContentValues();
            ContentResolver cr = getContentResolver();
            Object[] parsed = new Object[2];

            mCursor.moveToPosition(-1);
            while (!mCanceled && mCursor.moveToNext()) {
                String name = mCursor.getString(0);
                String number = mCursor.getString(1);
                String email = mCursor.getString(2);
                String[] emails = null;
                if (email != null) {
                    emails = email.split(",");
                }
                Uri personUrl = parseName(name, parsed);

                if (personUrl == null) {
                    map.clear();
                    map.put(Contacts.People.NAME, (String) parsed[0]);
                    personUrl = People.createPersonInMyContactsGroup(cr, map);
                    if (personUrl == null) {
                        Log.e(TAG, "Error inserting person " + map);
                        continue;
                    }
                }

                map.clear();
                map.put(Contacts.People.Phones.NUMBER, number);
                map.put(Contacts.People.Phones.TYPE, (Integer) parsed[1]);
                // TODO() : Add email address to contacts.
                // The provider is being changed.
                Uri numberUrl = cr.insert(
                        Uri.withAppendedPath(personUrl, Contacts.People.Phones.CONTENT_DIRECTORY),
                        map);

=======
            final ContentValues emptyContentValues = new ContentValues();
            final ContentResolver resolver = getContentResolver();

            mCursor.moveToPosition(-1);
            while (!mCanceled && mCursor.moveToNext()) {
                actuallyImportOneSimContact(mCursor, resolver);
>>>>>>> ced63bc52301ba1cce003e22a576b832dbb049d0
                mProgressDialog.incrementProgressBy(1);
            }
Solution content
        @Override
        public void run() {
            final ContentValues emptyContentValues = new ContentValues();
            final ContentResolver resolver = getContentResolver();

            mCursor.moveToPosition(-1);
            while (!mCanceled && mCursor.moveToNext()) {
                actuallyImportOneSimContact(mCursor, resolver);
                mProgressDialog.incrementProgressBy(1);
            }
File
SimContacts.java
Developer's decision
Version 2
Kind of conflict
Comment
If statement
Method invocation
Variable
While statement
Chunk
Conflicting content
        return super.onContextItemSelected(item);
    }

<<<<<<< HEAD

=======
    @Override
>>>>>>> ced63bc52301ba1cce003e22a576b832dbb049d0
    public void onCreateContextMenu(ContextMenu menu, View v,
            ContextMenu.ContextMenuInfo menuInfo) {
        if (menuInfo instanceof AdapterView.AdapterContextMenuInfo) {
Solution content
        return super.onContextItemSelected(item);
    }

    @Override
    public void onCreateContextMenu(ContextMenu menu, View v,
            ContextMenu.ContextMenuInfo menuInfo) {
        if (menuInfo instanceof AdapterView.AdapterContextMenuInfo) {
File
SimContacts.java
Developer's decision
Version 2
Kind of conflict
Annotation
Chunk
Conflicting content
    @Override
    public void onListItemClick(ListView l, View v, int position, long id) {
<<<<<<< HEAD
        importOne(position);
    }

    private void importOne(int position) {
        if (mCursor.moveToPosition(position)) {
            String name = mCursor.getString(NAME_COLUMN);
            String number = mCursor.getString(NUMBER_COLUMN);
            String email = mCursor.getString(EMAILS_COLUMN);
            Object[] parsed = new Object[2];
            Uri personUrl = parseName(name, parsed);
            String[] emails = null;
            Log.d(TAG, "Email string is " + email);
            if (email != null) {
                emails = email.split(",");
            }

            Intent intent;
            if (personUrl == null) {
                // Add a new contact
                intent = new Intent(Contacts.Intents.Insert.ACTION,
                        Contacts.People.CONTENT_URI);
                intent.putExtra(Contacts.Intents.Insert.NAME, (String)parsed[0]);
                intent.putExtra(Contacts.Intents.Insert.PHONE, number);
                intent.putExtra(Contacts.Intents.Insert.PHONE_TYPE, ((Integer)parsed[1]).intValue());
                // TODO() : Add email address to contacts.
                // The provider is being changed.
            } else {
                // Add the number to an existing contact
                intent = new Intent(Intent.ACTION_EDIT, personUrl);
                intent.putExtra(Contacts.Intents.Insert.PHONE, number);
                intent.putExtra(Contacts.Intents.Insert.PHONE_TYPE, ((Integer)parsed[1]).intValue());
                // TODO() : Add email address to contacts.
                // The provider is being changed.
            }
            startActivity(intent);
        }
    }

    /**
     * Parse the name looking for /W /H /M or /O at the end, signifying the type.
     *
     * @param name The name from the SIM card
     * @param parsed slot 0 is filled in with the name, and slot 1 is filled
     * in with the type
     */
    private Uri parseName(String name, Object[] parsed) {
        // default to TYPE_MOBILE so you can send SMSs to the numbers
        int type = Contacts.PhonesColumns.TYPE_MOBILE;

        // Look for /W /H /M or /O at the end of the name signifying the type
        int nameLen = name.length();
        if (nameLen - 2 >= 0 && name.charAt(nameLen - 2) == '/') {
            char c = Character.toUpperCase(name.charAt(nameLen - 1));
            if (c == 'W') {
                type = Contacts.PhonesColumns.TYPE_WORK;
            } else if (c == 'M') {
                type = Contacts.PhonesColumns.TYPE_MOBILE;
            } else if (c == 'H') {
                type = Contacts.PhonesColumns.TYPE_HOME;
            } else if (c == 'O') {
                type = Contacts.PhonesColumns.TYPE_MOBILE;
            }
            name = name.substring(0, nameLen - 2);
        }
        parsed[0] = name;
        parsed[1] = type;

        StringBuilder where = new StringBuilder(Contacts.People.NAME);
        where.append('=');
        DatabaseUtils.appendEscapedSQLString(where, name);
        Uri url = null;
        Cursor c = getContentResolver().query(Contacts.People.CONTENT_URI,
                new String[] {Contacts.People._ID},
                where.toString(), null, null);
        if (c != null) {
            if (c.moveToFirst()) {
                url = ContentUris.withAppendedId(Contacts.People.CONTENT_URI, c.getLong(0));
            }
            c.deactivate();
        }
        return url;
=======
        importOneSimContact(position);
>>>>>>> ced63bc52301ba1cce003e22a576b832dbb049d0
    }

    @Override
Solution content
    @Override
    public void onListItemClick(ListView l, View v, int position, long id) {
        importOneSimContact(position);
    }

    @Override
File
SimContacts.java
Developer's decision
Version 2
Kind of conflict
Array access
Comment
If statement
Method declaration
Method invocation
Method signature
Return statement
Variable