24
24
private final static int DIALOG_CONTINUEORABORT = 1;
25
25
private final static int DIALOG_MERGEPROMPT = 2;
27
public final static int MESSAGE_FINISHED_ALLDONE = 0;
28
public final static int MESSAGE_FINISHED = 1;
29
public final static int MESSAGE_FINISHED_GOBACK = 2;
30
public final static int MESSAGE_ERROR = 3;
31
public final static int MESSAGE_CONTINUEORABORT = 4;
32
public final static int MESSAGE_SETPROGRESSMESSAGE = 5;
33
public final static int MESSAGE_SETMAXPROGRESS = 6;
34
public final static int MESSAGE_SETTMPPROGRESS = 7;
35
public final static int MESSAGE_SETPROGRESS = 8;
36
public final static int MESSAGE_MERGEPROMPT = 9;
37
public final static int MESSAGE_CONTACTOVERWRITTEN = 10;
38
public final static int MESSAGE_CONTACTCREATED = 11;
39
public final static int MESSAGE_CONTACTMERGED = 12;
40
public final static int MESSAGE_CONTACTSKIPPED = 13;
42
27
private boolean _startedProgress;
43
28
private int _maxProgress;
44
29
private int _tmpProgress;
62
47
public void handleMessage( Message msg ) {
65
case MESSAGE_FINISHED_ALLDONE:
66
( (TextView)findViewById( R.id.doit_alldone ) ).
67
setVisibility( View.VISIBLE );
69
case MESSAGE_FINISHED:
50
case Importer.MESSAGE_FINISHED:
70
51
( (LinearLayout)findViewById( R.id.doit_closedisplay ) ).
71
52
setVisibility( View.VISIBLE );
73
case MESSAGE_FINISHED_GOBACK:
54
case Importer.MESSAGE_FINISHED_BACK:
74
55
( (Button)findViewById( R.id.back ) ).setEnabled( true );
57
case Importer.MESSAGE_ERROR:
77
58
Doit.this._dialogMessage = (String)msg.obj;
78
59
showDialog( DIALOG_ERROR );
80
case MESSAGE_CONTINUEORABORT:
61
case Importer.MESSAGE_CONTINUEORABORT:
81
62
Doit.this._dialogMessage = (String)msg.obj;
82
63
showDialog( DIALOG_CONTINUEORABORT );
84
case MESSAGE_SETPROGRESSMESSAGE:
65
case Importer.MESSAGE_SETPROGRESSMESSAGE:
85
66
( (TextView)findViewById( R.id.doit_percentage ) ).
86
67
setText( (String)msg.obj );
88
case MESSAGE_SETMAXPROGRESS:
69
case Importer.MESSAGE_SETMAXPROGRESS:
89
70
if( _maxProgress > 0 ) {
90
71
if( _tmpProgress == _maxProgress )
91
72
_tmpProgress = (Integer)msg.obj;
95
76
_maxProgress = (Integer)msg.obj;
98
case MESSAGE_SETTMPPROGRESS:
79
case Importer.MESSAGE_SETTMPPROGRESS:
99
80
_tmpProgress = (Integer)msg.obj;
102
case MESSAGE_SETPROGRESS:
83
case Importer.MESSAGE_SETPROGRESS:
103
84
_startedProgress = true;
104
85
_progress = (Integer)msg.obj;
107
case MESSAGE_MERGEPROMPT:
88
case Importer.MESSAGE_MERGEPROMPT:
108
89
_dialogMessage = (String)msg.obj;
109
90
showDialog( DIALOG_MERGEPROMPT );
111
case MESSAGE_CONTACTOVERWRITTEN:
92
case Importer.MESSAGE_CONTACTOVERWRITTEN:
112
93
_countOverwrites++;
115
case MESSAGE_CONTACTCREATED:
96
case Importer.MESSAGE_CONTACTCREATED:
119
case MESSAGE_CONTACTMERGED:
100
case Importer.MESSAGE_CONTACTMERGED:
123
case MESSAGE_CONTACTSKIPPED:
104
case Importer.MESSAGE_CONTACTSKIPPED:
358
339
if( _importer != null )
360
// try and flag worker thread - did we need to?
361
if( _importer.setAbort() )
363
// wait for worker thread to end
369
catch( InterruptedException e ) {}
341
_importer.setAbort();
373
Toast.makeText( this, R.string.doit_importaborted,
374
Toast.LENGTH_LONG ).show();
347
catch( InterruptedException e ) {}