93
93
public void handleMessage( Message msg ) {
96
case MESSAGE_FINISHED_ALLDONE:
97
97
( (TextView)findViewById( R.id.doit_alldone ) ).
98
setVisibility( View.VISIBLE );
99
( (Button)findViewById( R.id.back ) ).setEnabled( false );
98
setVisibility( View.VISIBLE );
100
case MESSAGE_FINISHED:
100
101
updateNext( NEXT_CLOSE );
101
102
findViewById( R.id.doit_abort_disp ).setVisibility(
105
case MESSAGE_FINISHED_GOBACK:
106
( (Button)findViewById( R.id.back ) ).setEnabled( true );
107
findViewById( R.id.doit_abort_disp ).setVisibility(
107
110
case MESSAGE_ERROR:
108
_dialogMessage = (String)msg.obj;
111
Doit.this._dialogMessage = (String)msg.obj;
109
112
showDialog( DIALOG_ERROR );
111
114
case MESSAGE_CONTINUEORABORT:
112
_dialogMessage = (String)msg.obj;
115
Doit.this._dialogMessage = (String)msg.obj;
113
116
showDialog( DIALOG_CONTINUEORABORT );
115
118
case MESSAGE_SETPROGRESSMESSAGE:
203
// close any open dialogs
205
dismissDialog( _currentDialogId );
207
catch( Exception e ) {
210
206
// saving the state of an import sounds complicated! Lets just abort!
215
protected Dialog onCreateDialog( int id )
211
protected Dialog onCreateDialog(int id)
219
215
case DIALOG_ERROR:
220
216
return new AlertDialog.Builder( this )
221
.setIcon( R.drawable.alert_dialog_icon )
222
.setTitle( R.string.error_title )
224
.setPositiveButton( R.string.error_ok,
225
new DialogInterface.OnClickListener() {
217
.setIcon( R.drawable.alert_dialog_icon )
218
.setTitle( R.string.error_title )
220
.setPositiveButton( R.string.error_ok,
221
new DialogInterface.OnClickListener() {
226
222
public void onClick(DialogInterface dialog,
229
224
Doit.this._importer.wake();
232
.setOnCancelListener( _dialogOnCancelListener )
227
.setOnCancelListener( _dialogOnCancelListener )
234
229
case DIALOG_CONTINUEORABORT:
235
230
return new AlertDialog.Builder( this )
236
.setIcon( R.drawable.alert_dialog_icon )
237
.setTitle( R.string.error_title )
239
.setPositiveButton( R.string.error_continue,
240
new DialogInterface.OnClickListener() {
241
public void onClick(DialogInterface dialog,
244
Doit.this._importer.wake(
245
Importer.RESPONSE_POSITIVE );
248
.setNegativeButton( R.string.error_abort,
249
new DialogInterface.OnClickListener() {
250
public void onClick(DialogInterface dialog,
253
Doit.this._importer.wake(
254
Importer.RESPONSE_NEGATIVE );
257
.setOnCancelListener( _dialogOnCancelListener )
231
.setIcon( R.drawable.alert_dialog_icon )
232
.setTitle( R.string.error_title )
234
.setPositiveButton( R.string.error_continue,
235
new DialogInterface.OnClickListener() {
236
public void onClick(DialogInterface dialog,
238
Doit.this._importer.wake(
239
Importer.RESPONSE_POSITIVE );
242
.setNegativeButton( R.string.error_abort,
243
new DialogInterface.OnClickListener() {
244
public void onClick(DialogInterface dialog,
246
Doit.this._importer.wake(
247
Importer.RESPONSE_NEGATIVE );
250
.setOnCancelListener( _dialogOnCancelListener )
259
252
case DIALOG_MERGEPROMPT:
260
253
// custom layout in an AlertDialog
261
254
LayoutInflater factory = LayoutInflater.from( this );
262
255
final View dialogView = factory.inflate(
263
R.layout.mergeprompt, null );
256
R.layout.mergeprompt, null );
264
257
( (CheckBox)dialogView.findViewById( R.id.mergeprompt_always ) ).
265
setOnCheckedChangeListener(
266
new CompoundButton.OnCheckedChangeListener() {
267
public void onCheckedChanged( CompoundButton buttonView,
270
Doit.this._mergePromptAlwaysSelected = isChecked;
258
setOnCheckedChangeListener(
259
new CompoundButton.OnCheckedChangeListener() {
260
public void onCheckedChanged( CompoundButton buttonView,
261
boolean isChecked ) {
262
Doit.this._mergePromptAlwaysSelected = isChecked;
273
265
( (Button)dialogView.findViewById( R.id.merge_keep ) ).
274
setOnClickListener( _mergePromptButtonListener );
266
setOnClickListener( _mergePromptButtonListener );
275
267
( (Button)dialogView.findViewById( R.id.merge_overwrite ) ).
276
setOnClickListener( _mergePromptButtonListener );
268
setOnClickListener( _mergePromptButtonListener );
277
269
( (Button)dialogView.findViewById( R.id.merge_merge ) ).
278
setOnClickListener( _mergePromptButtonListener );
270
setOnClickListener( _mergePromptButtonListener );
279
271
( (Button)dialogView.findViewById( R.id.abort ) ).
280
setOnClickListener( _mergePromptButtonListener );
272
setOnClickListener( _mergePromptButtonListener );
281
273
_mergePromptAlwaysSelected = false;
282
274
return new AlertDialog.Builder( this )
283
.setIcon( R.drawable.alert_dialog_icon )
284
.setTitle( R.string.mergeprompt_title )
285
.setView( dialogView )
286
.setOnCancelListener( _dialogOnCancelListener )
275
.setIcon( R.drawable.alert_dialog_icon )
276
.setTitle( R.string.mergeprompt_title )
277
.setView( dialogView )
278
.setOnCancelListener( _dialogOnCancelListener )
292
private OnClickListener _mergePromptButtonListener = new OnClickListener() {
284
private OnClickListener _mergePromptButtonListener = new OnClickListener() {
293
285
public void onClick( View view )