/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/org/waxworlds/edam/importcontacts/VCFImporter.java

  • Committer: edam
  • Date: 2010-07-04 14:44:48 UTC
  • Revision ID: edam@waxworlds.org-20100704144448-1m30v811opup20fs
- got rid of the pretend ImportContacts activity alltogether (and made the Intro activity the startup one)
- massively simplified the WizzardActivity class so it works propperly
- moved all code to org.waxworlds.edam
- added an "aborted" message when the importion is aborted
- simplified the 3 actions the worker thread can take when stopping (only 2 were actualy used) to "aborted" or "alldone"
- changed intro message to match website
- bugfix: don't blow up when the My Contacts group is missing

Show diffs side-by-side

added added

removed removed

67
67
                        // open directory
68
68
                        String location = prefs.getString( "location", "" );
69
69
                        File dir = new File( location );
70
 
                        if( !dir.exists() )
 
70
                        if( !dir.exists() || !dir.isDirectory() )
71
71
                                showError( R.string.error_locationnotfound );
72
72
 
73
 
                        // directory, or file?
74
 
                        if( dir.isDirectory() )
75
 
                        {
76
 
                                // get files
77
 
                                class VCardFilter implements FilenameFilter {
78
 
                                        public boolean accept( File dir, String name ) {
79
 
                                                return name.toLowerCase().endsWith( ".vcf" );
80
 
                                        }
 
73
                        // get files
 
74
                        class VCardFilter implements FilenameFilter {
 
75
                                public boolean accept( File dir, String name ) {
 
76
                                        return name.toLowerCase().endsWith( ".vcf" );
81
77
                                }
82
 
                                files = dir.listFiles( new VCardFilter() );
83
 
                        }
84
 
                        else
85
 
                        {
86
 
                                // use just this file
87
 
                                files = new File[ 1 ];
88
 
                                files[ 0 ] = dir;
89
 
                        }
 
78
                        }
 
79
                        files = dir.listFiles( new VCardFilter() );
90
80
                }
91
81
                catch( SecurityException e ) {
92
82
                        showError( R.string.error_locationpermissions );