/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/VcardImporter.java

  • Committer: edam
  • Date: 2011-06-04 16:52:28 UTC
  • Revision ID: edam@waxworlds.org-20110604165228-jam230oo29u1m06u
- properly handle multiple TYPE= params in one entry in a v3.0 vCard
- when deciding which phone number to use as the pimary number, a voice number takes precedence over a non-voice (fax or pager) number of the same standing in terms of being preferred or not.

Show diffs side-by-side

added added

removed removed

568
568
 
569
569
                                // determine whether we care about this entry
570
570
                                final HashSet< String > interesting_fields =
571
 
                                        new HashSet< String >( Arrays.asList( new String[] { "N",
572
 
                                                "FN", "ORG", "TITLE", "TEL", "EMAIL", "ADR", "LABEL" }
 
571
                                        new HashSet< String >( Arrays.asList( new String[]
 
572
                                                { "N", "FN", "ORG", "TITLE", "TEL", "EMAIL", "ADR" }
573
573
                                ) );
574
574
                                boolean is_interesting_field =
575
575
                                        interesting_fields.contains( name_param_parts[ 0 ] );
676
676
                                        parseEMAIL( name_param_parts, complete_value );
677
677
                                else if( name_param_parts[ 0 ].equals( "ADR" ) )
678
678
                                        parseADR( name_param_parts, complete_value );
679
 
                                else if( name_param_parts[ 0 ].equals( "LABEL" ) )
680
 
                                        parseLABEL( name_param_parts, complete_value );
681
679
                        }
682
680
                }
683
681
 
935
933
                                }
936
934
 
937
935
                        Set< String > types = extractTypes( params, Arrays.asList(
938
 
                                "PREF", "WORK", "HOME" ) );
939
 
 
940
 
                        // add address
941
 
                        int type;
942
 
                        if( types.contains( "WORK" ) )
943
 
                                type = Contacts.ContactMethods.TYPE_WORK;
944
 
                        else
945
 
                                type = Contacts.ContactMethods.TYPE_HOME;
946
 
 
947
 
                        addAddress( unescapeValue( value ), type );
948
 
                }
949
 
 
950
 
                private void parseLABEL( String[] params, String value )
951
 
                {
952
 
                        Set< String > types = extractTypes( params, Arrays.asList(
953
 
                                "PREF", "WORK", "HOME" ) );
 
936
                                "PREF", "WORK", "HOME", "INTERNET" ) );
954
937
 
955
938
                        // add address
956
939
                        int type;