/android/export-contacts

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

« back to all changes in this revision

Viewing changes to src/am/ed/exportcontacts/ContactsContractBackend.java

  • Committer: edam
  • Date: 2012-12-21 13:26:31 UTC
  • Revision ID: tim@ed.am-20121221132631-ofj30d60lvuxp4a3
added ContactsContract backend; removed references to Contacts types (conversion to/from backend types now done in backends); added support for exporting NOTEs

Show diffs side-by-side

added added

removed removed

1
1
/*
2
2
 * ContactsContractContactAccessor.java
3
3
 *
4
 
 * Copyright (C) 2011 to 2012 Tim Marston <tim@ed.am>
 
4
 * Copyright (C) 2011 Tim Marston <tim@ed.am>
5
5
 *
6
6
 * This file is part of the Export Contacts program (hereafter referred
7
7
 * to as "this program"). For more information, see
140
140
                                ContactsContract.Data.DATA4,
141
141
                        },
142
142
                        ContactsContract.Data.CONTACT_ID + " = ? AND " +
143
 
// column DELTED not found!?
144
 
//                              ContactsContract.Data.DELETED + " = 0 AND " +
 
143
                                ContactsContract.Data.DELETED + " = 0 AND " +
145
144
                                ContactsContract.Data.MIMETYPE + " IN ( ?, ?, ?, ?, ? )",
146
145
                        new String[] {
147
146
                                String.valueOf( id ),
171
170
                        // add email addresses
172
171
                        else if( type.equals( CommonDataKinds.Email.CONTENT_ITEM_TYPE ) )
173
172
                                contact.addEmail( contact.new EmailDetail(
174
 
                                        convertBackendTypeToType( CommonDataKinds.Email.class,
 
173
                                        convertBackendTypeToType( CommonDataKinds.Phone.class,
175
174
                                                cur.getInt( cur.getColumnIndex(
176
175
                                                        CommonDataKinds.Email.TYPE ) ) ),
177
176
                                        cur.getString( cur.getColumnIndex(
180
179
                        // add postal addresses
181
180
                        else if( type.equals( CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE ) )
182
181
                                contact.addAddress( contact.new AddressDetail(
183
 
                                        convertBackendTypeToType( CommonDataKinds.StructuredPostal.class,
 
182
                                        convertBackendTypeToType( CommonDataKinds.Phone.class,
184
183
                                                cur.getInt( cur.getColumnIndex(
185
184
                                                        CommonDataKinds.StructuredPostal.TYPE ) ) ),
186
185
                                        cur.getString( cur.getColumnIndex(
199
198
                                contact.addNote( cur.getString( cur.getColumnIndex(
200
199
                                        CommonDataKinds.Note.NOTE ) ) );
201
200
                }
202
 
                cur.close();
203
201
 
204
202
                return true;
205
203
        }