bzr branch
http://bzr.ed.am/android/import-contacts
53
by edam
abstracted the android contacts API in to an interface, ready to be switched to |
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 |
||
25 |
package am.ed.importcontacts; |
|
26 |
||
27 |
import am.ed.importcontacts.Importer.ContactData; |
|
28 |
||
29 |
||
30 |
public interface Backend |
|
31 |
{ |
|
32 |
/** |
|
33 |
* Build-up our contacts cache, using contacts on the device. |
|
34 |
* @param cache the contacts cache to populate |
|
35 |
*/ |
|
36 |
public void populateCache( ContactsCache cache ); |
|
37 |
||
38 |
/** |
|
39 |
* Delete a contact |
|
40 |
* @param id of the contact to delete |
|
41 |
*/ |
|
42 |
public void deleteContact( Long id ); |
|
43 |
||
44 |
/** |
|
45 |
* Add a contact |
|
46 |
* @param name name of the new contact |
|
47 |
* @return the new contact's id, or 0 on failure |
|
48 |
*/ |
|
49 |
public Long addContact( String name ); |
|
50 |
||
51 |
/** |
|
52 |
* Add a phone number to an existing contact |
|
53 |
* @param id the existing contact's id |
|
54 |
* @param number the phone number |
|
55 |
* @param data data about the number |
|
56 |
*/ |
|
57 |
public void addContactPhone( Long id, String number, |
|
58 |
ContactData.PreferredDetail data ); |
|
59 |
||
60 |
/** |
|
61 |
* Add an email address to an existing contact |
|
62 |
* @param id the existing contact's id |
|
63 |
* @param email the email address |
|
64 |
* @param data data about the email address |
|
65 |
*/ |
|
66 |
public void addContactEmail( Long id, String email, |
|
67 |
ContactData.PreferredDetail data ); |
|
68 |
||
69 |
/** |
|
70 |
* Add an address to an existing contact |
|
71 |
* @param id the existing contact's id |
|
72 |
* @param address the address |
|
73 |
* @param data data about the address |
|
74 |
*/ |
|
75 |
public void addContactAddresses( Long id, String address, |
|
76 |
ContactData.TypeDetail data ); |
|
77 |
||
78 |
/** |
|
79 |
* Add a title and organisation to an existing contact |
|
80 |
* @param id the existing contact's id |
|
81 |
* @param organisation the organisation |
|
82 |
* @param data data about the organisation |
|
83 |
*/ |
|
84 |
public void addContactOrganisation( Long id, String organisation, |
|
85 |
ContactData.ExtraDetail data ); |
|
86 |
} |