93
93
public void handleMessage( Message msg ) {
96
case MESSAGE_FINISHED_ALLDONE:
97
97
( (TextView)findViewById( R.id.doit_alldone ) ).
98
setVisibility( View.VISIBLE );
100
case MESSAGE_FINISHED:
98
setVisibility( View.VISIBLE );
99
( (Button)findViewById( R.id.back ) ).setEnabled( false );
101
100
updateNext( NEXT_CLOSE );
102
101
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(
110
107
case MESSAGE_ERROR:
111
Doit.this._dialogMessage = (String)msg.obj;
108
_dialogMessage = (String)msg.obj;
112
109
showDialog( DIALOG_ERROR );
114
111
case MESSAGE_CONTINUEORABORT:
115
Doit.this._dialogMessage = (String)msg.obj;
112
_dialogMessage = (String)msg.obj;
116
113
showDialog( DIALOG_CONTINUEORABORT );
118
115
case MESSAGE_SETPROGRESSMESSAGE:
206
203
// saving the state of an import sounds complicated! Lets just abort!
204
if( _nextAction != NEXT_CLOSE )
211
protected Dialog onCreateDialog(int id)
209
protected Dialog onCreateDialog( int id )
215
213
case DIALOG_ERROR:
216
214
return new AlertDialog.Builder( this )
217
.setIcon( R.drawable.alert_dialog_icon )
218
.setTitle( R.string.error_title )
220
.setPositiveButton( R.string.error_ok,
221
new DialogInterface.OnClickListener() {
215
.setIcon( R.drawable.alert_dialog_icon )
216
.setTitle( R.string.error_title )
218
.setPositiveButton( R.string.error_ok,
219
new DialogInterface.OnClickListener() {
222
220
public void onClick(DialogInterface dialog,
224
223
Doit.this._importer.wake();
227
.setOnCancelListener( _dialogOnCancelListener )
226
.setOnCancelListener( _dialogOnCancelListener )
229
228
case DIALOG_CONTINUEORABORT:
230
229
return new AlertDialog.Builder( this )
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 )
230
.setIcon( R.drawable.alert_dialog_icon )
231
.setTitle( R.string.error_title )
233
.setPositiveButton( R.string.error_continue,
234
new DialogInterface.OnClickListener() {
235
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,
247
Doit.this._importer.wake(
248
Importer.RESPONSE_NEGATIVE );
251
.setOnCancelListener( _dialogOnCancelListener )
252
253
case DIALOG_MERGEPROMPT:
253
254
// custom layout in an AlertDialog
254
255
LayoutInflater factory = LayoutInflater.from( this );
255
256
final View dialogView = factory.inflate(
256
R.layout.mergeprompt, null );
257
R.layout.mergeprompt, null );
257
258
( (CheckBox)dialogView.findViewById( R.id.mergeprompt_always ) ).
258
setOnCheckedChangeListener(
259
new CompoundButton.OnCheckedChangeListener() {
260
public void onCheckedChanged( CompoundButton buttonView,
261
boolean isChecked ) {
262
Doit.this._mergePromptAlwaysSelected = isChecked;
259
setOnCheckedChangeListener(
260
new CompoundButton.OnCheckedChangeListener() {
261
public void onCheckedChanged( CompoundButton buttonView,
264
Doit.this._mergePromptAlwaysSelected = isChecked;
265
267
( (Button)dialogView.findViewById( R.id.merge_keep ) ).
266
setOnClickListener( _mergePromptButtonListener );
268
setOnClickListener( _mergePromptButtonListener );
267
269
( (Button)dialogView.findViewById( R.id.merge_overwrite ) ).
268
setOnClickListener( _mergePromptButtonListener );
270
setOnClickListener( _mergePromptButtonListener );
269
271
( (Button)dialogView.findViewById( R.id.merge_merge ) ).
270
setOnClickListener( _mergePromptButtonListener );
272
setOnClickListener( _mergePromptButtonListener );
271
273
( (Button)dialogView.findViewById( R.id.abort ) ).
272
setOnClickListener( _mergePromptButtonListener );
274
setOnClickListener( _mergePromptButtonListener );
273
275
_mergePromptAlwaysSelected = false;
274
276
return new AlertDialog.Builder( this )
275
.setIcon( R.drawable.alert_dialog_icon )
276
.setTitle( R.string.mergeprompt_title )
277
.setView( dialogView )
278
.setOnCancelListener( _dialogOnCancelListener )
277
.setIcon( R.drawable.alert_dialog_icon )
278
.setTitle( R.string.mergeprompt_title )
279
.setView( dialogView )
280
.setOnCancelListener( _dialogOnCancelListener )
284
private OnClickListener _mergePromptButtonListener = new OnClickListener() {
286
private OnClickListener _mergePromptButtonListener = new OnClickListener() {
285
287
public void onClick( View view )
288
290
if( view.getId() == R.id.abort )
293
// else, response (just check we haven't aborted already!)
294
else if( Doit.this._importer != null ) {
293
295
int responseExtra = _mergePromptAlwaysSelected?
294
296
Importer.RESPONSEEXTRA_ALWAYS : Importer.RESPONSEEXTRA_NONE;
295
297
Doit.this._importer.wake( convertIdToAction( view.getId() ),