/android/import-contacts

To get this branch, use:
bzr branch http://bzr.ed.am/android/import-contacts

« back to all changes in this revision

Viewing changes to src/am/ed/importcontacts/Importer.java

  • Committer: edam
  • Date: 2012-10-23 16:00:27 UTC
  • Revision ID: tim@ed.am-20121023160027-2jb0r4b4v78rewh1
updated TODO

Show diffs side-by-side

added added

removed removed

1
1
/*
2
2
 * Importer.java
3
3
 *
4
 
 * Copyright (C) 2009 to 2012 Tim Marston <tim@ed.am>
 
4
 * Copyright (C) 2009 to 2011 Tim Marston <tim@ed.am>
5
5
 *
6
6
 * This file is part of the Import Contacts program (hereafter referred
7
7
 * to as "this program"). For more information, see
35
35
import android.os.Message;
36
36
import android.provider.Contacts.PhonesColumns;
37
37
 
 
38
 
38
39
public class Importer extends Thread
39
40
{
40
41
        public final static int ACTION_ABORT = 1;
270
271
                        email = sanitisesEmailAddress( email );
271
272
                        if( email == null )
272
273
                        {
273
 
                                // TODO: warn that an imported email address is being ignored
 
274
                                // TODO: warn that an imported email addtrss is being ignored
274
275
                                return;
275
276
                        }
276
277
 
417
418
                        // update UI
418
419
                        setProgressMessage( R.string.doit_caching );
419
420
 
420
 
                        // create the appropriate backend
421
421
//                      if( Integer.parseInt( android.os.Build.VERSION.SDK ) >= 5 )
422
 
//                              _backend = new ContactsContractBackend( _doit );
 
422
//                              _backend = new ContactsContractBackend();
423
423
//                      else
424
424
                                _backend = new ContactsBackend( _doit );
425
425
 
692
692
                                _backend.deleteContact( id );
693
693
 
694
694
                                // update cache
695
 
                                _contacts_cache.removeLookup( cache_identifier );
 
695
                                _contacts_cache.removeLookup( contact.getCacheIdentifier() );
696
696
                                _contacts_cache.removeAssociatedData( id );
697
697
 
698
698
                                // show that we're overwriting a contact
711
711
                {
712
712
                        // create a new contact
713
713
                        id = _backend.addContact( contact._name );
714
 
                        if( id == null )
 
714
                        if( id == null || id <= 0 )
715
715
                                showError( R.string.error_unabletoaddcontact );
716
716
 
717
717
                        // update cache
718
 
                        _contacts_cache.addLookup( cache_identifier, id );
 
718
                        _contacts_cache.addLookup(
 
719
                                ContactsCache.createIdentifier( contact ), id );
719
720
 
720
721
                        // if we haven't already shown that we're overwriting a contact,
721
722
                        // show that we're creating a new contact