/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: Tim Marston
  • Date: 2013-07-19 15:59:00 UTC
  • Revision ID: tim@ed.am-20130719155900-3g89jcjfdndwctyb
added support for birthdays

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 to 2013 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
144
144
                                ContactsContract.Data.DATA4,
145
145
                        },
146
146
                        ContactsContract.Data.CONTACT_ID + " = ? AND " +
147
 
// column DELTED not found!?
 
147
// column DELETED not found!?
148
148
//                              ContactsContract.Data.DELETED + " = 0 AND " +
149
 
                                ContactsContract.Data.MIMETYPE + " IN ( ?, ?, ?, ?, ? )",
 
149
                                ContactsContract.Data.MIMETYPE + " IN ( ?, ?, ?, ?, ?, ? ) ",
150
150
                        new String[] {
151
151
                                String.valueOf( id ),
152
152
                                CommonDataKinds.Phone.CONTENT_ITEM_TYPE,
154
154
                                CommonDataKinds.Organization.CONTENT_ITEM_TYPE,
155
155
                                CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE,
156
156
                                CommonDataKinds.Note.CONTENT_ITEM_TYPE,
 
157
                                CommonDataKinds.Event.CONTENT_ITEM_TYPE,
157
158
                        },
158
159
                        ContactsContract.Data.IS_SUPER_PRIMARY + " DESC, " +
159
160
                                ContactsContract.Data.RAW_CONTACT_ID + ", " +
202
203
                        else if( type.equals( CommonDataKinds.Note.CONTENT_ITEM_TYPE ) )
203
204
                                contact.addNote( cur.getString( cur.getColumnIndex(
204
205
                                        CommonDataKinds.Note.NOTE ) ) );
 
206
 
 
207
                        // add birthday
 
208
                        else if( type.equals( CommonDataKinds.Event.CONTENT_ITEM_TYPE ) ) {
 
209
                                int event = cur.getInt( cur.getColumnIndex(
 
210
                                        CommonDataKinds.Event.TYPE ) );
 
211
                                if( event == CommonDataKinds.Event.TYPE_BIRTHDAY )
 
212
                                        contact.setBirthday( cur.getString( cur.getColumnIndex(
 
213
                                                CommonDataKinds.Event.START_DATE ) ) );
 
214
                        }
205
215
                }
206
216
                cur.close();
207
217