/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/Backend.java

  • Committer: edam
  • Date: 2011-05-02 18:28:24 UTC
  • Revision ID: edam@waxworlds.org-20110502182824-acgdi3qfxfzqgely
- fixed logic for vcard field types (home, work, cell, etc) so it works
- updated NEWS and TODO
- rewrote most of ContactsCache, including a new ContactIdentifier class to identify contacts in the cache and new cache building code
- contacts now identified in the same way that Andoid displays them (by name, or organisation, or number, or email, in that order)
- propper handling and support for organisations and titles
- validation of imported contact now done by Importer, not VcfImporter
- separated sanitisation and normalisation (for cache lookups)
- generacised PhoneData, EmailData and AddressData classes
- ContactData is now aware of primary numbers, emails and organisations (defaults to the first prefrred one seen, or the first one seen where none is preferred)

Show diffs side-by-side

added added

removed removed

1
 
/*
2
 
 * Backend.java
3
 
 *
4
 
 * Copyright (C) 2012 Tim Marston <tim@ed.am>
5
 
 *
6
 
 * This file is part of the Import Contacts program (hereafter referred
7
 
 * to as "this program"). For more information, see
8
 
 * http://ed.am/dev/android/import-contacts
9
 
 *
10
 
 * This program is free software: you can redistribute it and/or modify
11
 
 * it under the terms of the GNU General Public License as published by
12
 
 * the Free Software Foundation, either version 3 of the License, or
13
 
 * (at your option) any later version.
14
 
 *
15
 
 * This program is distributed in the hope that it will be useful,
16
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 
 * GNU General Public License for more details.
19
 
 *
20
 
 * You should have received a copy of the GNU General Public License
21
 
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
 
 */
23
 
 
24
 
package am.ed.importcontacts;
25
 
 
26
 
import am.ed.importcontacts.Importer.ContactData;
27
 
 
28
 
public interface Backend
29
 
{
30
 
        /**
31
 
         * Build-up our contacts cache, using contacts on the device.
32
 
         * @param cache the contacts cache to populate
33
 
         */
34
 
        public void populateCache( ContactsCache cache );
35
 
 
36
 
        /**
37
 
         * Delete a contact from the device.
38
 
         * @param id of the contact to delete
39
 
         */
40
 
        public void deleteContact( Long id );
41
 
 
42
 
        /**
43
 
         * Add a contact to the device.
44
 
         * @param name name of the new contact
45
 
         * @return the new contact's id, or null on failure
46
 
         */
47
 
        public Long addContact( String name );
48
 
 
49
 
        /**
50
 
         * Add a phone number to an existing contact on the device.
51
 
         * @param id the existing contact's id
52
 
         * @param number the phone number
53
 
         * @param data data about the number
54
 
         */
55
 
        public void addContactPhone( Long id, String number,
56
 
                ContactData.PreferredDetail data );
57
 
 
58
 
        /**
59
 
         * Add an email address to an existing contact on the device.
60
 
         * @param id the existing contact's id
61
 
         * @param email the email address
62
 
         * @param data data about the email address
63
 
         */
64
 
        public void addContactEmail( Long id, String email,
65
 
                ContactData.PreferredDetail data );
66
 
 
67
 
        /**
68
 
         * Add an address to an existing contact on the device.
69
 
         * @param id the existing contact's id
70
 
         * @param address the address
71
 
         * @param data data about the address
72
 
         */
73
 
        public void addContactAddresses( Long id, String address,
74
 
                ContactData.TypeDetail data );
75
 
 
76
 
        /**
77
 
         * Add a title and organisation to an existing contact on the device.
78
 
         * @param id the existing contact's id
79
 
         * @param organisation the organisation
80
 
         * @param data data about the organisation
81
 
         */
82
 
        public void addContactOrganisation( Long id, String organisation,
83
 
                ContactData.ExtraDetail data );
84
 
}