/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/org/waxworlds/edam/exportcontacts/VcardExporter.java

  • Committer: edam
  • Date: 2011-06-11 08:22:04 UTC
  • Revision ID: edam@waxworlds.org-20110611082204-u2v1ri3a8iayq9b4
- added ContactReader interface
- added ContactsContactReader class to read old-style android.Contacts data
- updated FileChooser from import contacts app
- updated TODO
- added Doit activity
- added Exporter
- added VcardExporter that writes vCards

Show diffs side-by-side

added added

removed removed

55
55
 
56
56
                // check if the output file already exists
57
57
                if( file.exists() && file.length() > 0 )
58
 
                        if( !showContinue( R.string.error_vcf_exists ) )
59
 
                                finish( ACTION_ABORT );
 
58
                        showContinue( R.string.error_vcf_exists );
60
59
 
61
60
                // open file
62
61
                try {
83
82
                        // length of the line we'll be pulling off
84
83
                        int len = 75;
85
84
 
86
 
                        // if splitting at this length would break apart a codepoint, use
87
 
                        // one less char
88
 
                        if( Character.isHighSurrogate( line.charAt( len - 1 ) ) )
89
 
                                len--;
90
 
 
91
85
                        // count how many backslashes would be at the end of the line we're
92
86
                        // pulling off
93
87
                        int count = 0;
176
170
                        return false;
177
171
 
178
172
                // append header
179
 
                out.append( "BEGIN:VCARD\n" );
 
173
                out.append( "VCARD:BEGIN\n" );
180
174
                out.append( "VERSION:3.0\n" );
181
175
 
182
176
                // append formatted name
276
270
                }
277
271
 
278
272
                // append footer
279
 
                out.append( "END:VCARD\n" );
 
273
                out.append( "VCARD:END\n" );
280
274
 
281
275
                // write to file
282
276
                try {