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

  • Committer: edam
  • Date: 2011-03-19 20:33:09 UTC
  • Revision ID: edam@waxworlds.org-20110319203309-5dzfyqrxwk94jtin
- formatting: removed some double-indents on overrunning lines
- updated TODO and NEWS
- rewrote central logic of parser so it makes more sense, looks nicer and has a small optimisation (getting name and params from line only when necessary)
- optimised unnecessary mutliple converting of lines to US-ASCII
- re-wrote line extraction from vcards so that we can lookahead for v3 folded lines
- added support for v3 folded lines

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
                                ( (Button)findViewById( R.id.back ) ).setEnabled( false );
100
100
                                updateNext( NEXT_CLOSE );
101
101
                                findViewById( R.id.doit_abort_disp ).setVisibility(
102
 
                                                View.GONE );
 
102
                                        View.GONE );
103
103
                                break;
104
104
                        case MESSAGE_ABORT:
105
105
                                manualAbort();
114
114
                                break;
115
115
                        case MESSAGE_SETPROGRESSMESSAGE:
116
116
                                ( (TextView)findViewById( R.id.doit_percentage ) ).
117
 
                                                setText( (String)msg.obj );
 
117
                                        setText( (String)msg.obj );
118
118
                                break;
119
119
                        case MESSAGE_SETMAXPROGRESS:
120
120
                                if( _maxProgress > 0 ) {
293
293
                        // else, response (just check we haven't aborted already!)
294
294
                        else if( Doit.this._importer != null ) {
295
295
                                int responseExtra = _mergePromptAlwaysSelected?
296
 
                                                Importer.RESPONSEEXTRA_ALWAYS : Importer.RESPONSEEXTRA_NONE;
 
296
                                        Importer.RESPONSEEXTRA_ALWAYS : Importer.RESPONSEEXTRA_NONE;
297
297
                                Doit.this._importer.wake( convertIdToAction( view.getId() ),
298
 
                                                responseExtra );
 
298
                                        responseExtra );
299
299
                        }
300
300
 
301
301
                        // close dialog and free (don't keep a reference)
344
344
                        dismissDialog( _currentDialogId );
345
345
                }
346
346
                catch( Exception e ) {
 
347
                        // ignore errors
347
348
                }
348
349
        }
349
350
 
408
409
                case DIALOG_MERGEPROMPT:
409
410
                        // set contact's name
410
411
                        ( (TextView)dialog.findViewById( R.id.mergeprompt_name ) ).setText(
411
 
                                        _dialogMessage );
 
412
                                _dialogMessage );
412
413
                        // and set up reference to dialog
413
414
                        _mergePromptDialog = dialog;
414
415
                        break;
446
447
                        if( _startedProgress )
447
448
                        {
448
449
                                ( (TextView)findViewById( R.id.doit_percentage ) ).setText(
449
 
                                                (int)Math.round( 100 * _progress / _maxProgress ) + "%" );
 
450
                                        (int)Math.round( 100 * _progress / _maxProgress ) + "%" );
450
451
                                outOf.setText( _progress + "/" + _maxProgress );
451
452
                                bar.setProgress( _progress );
452
453
                        }
456
457
        private void updateStats()
457
458
        {
458
459
                ( (TextView)findViewById( R.id.doit_overwrites ) ).setText(
459
 
                                "" + _countOverwrites );
 
460
                        "" + _countOverwrites );
460
461
                ( (TextView)findViewById( R.id.doit_creates ) ).setText(
461
 
                                "" + _countCreates );
 
462
                        "" + _countCreates );
462
463
                ( (TextView)findViewById( R.id.doit_merges ) ).setText(
463
 
                                "" + _countMerges );
 
464
                        "" + _countMerges );
464
465
                ( (TextView)findViewById( R.id.doit_skips ) ).setText(
465
 
                                "" + _countSkips );
 
466
                        "" + _countSkips );
466
467
        }
467
468
 
468
469
        private void abortImport( boolean showToasterPopup )
484
485
                                // notify the user
485
486
                                if( showToasterPopup )
486
487
                                        Toast.makeText( this, R.string.doit_importaborted,
487
 
                                                        Toast.LENGTH_LONG ).show();
 
488
                                                Toast.LENGTH_LONG ).show();
488
489
                        }
489
490
                }
490
491