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

  • Committer: Tim Marston
  • Date: 2013-10-20 17:52:21 UTC
  • Revision ID: tim@ed.am-20131020175221-7f9i6dhl55xz39ui
eclipse file changes (who knows!)

Show diffs side-by-side

added added

removed removed

1
1
/*
2
2
 * Doit.java
3
3
 *
4
 
 * Copyright (C) 2009 Tim Marston <edam@waxworlds.org>
 
4
 * Copyright (C) 2009 Tim Marston <tim@ed.am>
5
5
 *
6
6
 * This file is part of the Import Contacts program (hereafter referred
7
 
 * to as "this program"). For more information, see
8
 
 * http://www.waxworlds.org/edam/software/android/import-contacts
 
7
 * to as "this program").  For more information, see
 
8
 * http://ed.am/dev/android/import-contacts
9
9
 *
10
10
 * This program is free software: you can redistribute it and/or modify
11
11
 * it under the terms of the GNU General Public License as published by
21
21
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
22
 */
23
23
 
24
 
package org.waxworlds.importcontacts;
 
24
package am.ed.importcontacts;
25
25
 
26
26
import android.app.AlertDialog;
27
27
import android.app.Dialog;
46
46
        private final static int DIALOG_CONTINUEORABORT = 1;
47
47
        private final static int DIALOG_MERGEPROMPT = 2;
48
48
 
49
 
        public final static int MESSAGE_FINISHED_ALLDONE = 0;
50
 
        public final static int MESSAGE_FINISHED = 1;
51
 
        public final static int MESSAGE_FINISHED_GOBACK = 2;
 
49
        public final static int MESSAGE_ALLDONE = 0;
 
50
        public final static int MESSAGE_ABORT = 1;
52
51
        public final static int MESSAGE_ERROR = 3;
53
52
        public final static int MESSAGE_CONTINUEORABORT = 4;
54
53
        public final static int MESSAGE_SETPROGRESSMESSAGE = 5;
69
68
        public final static int NEXT_BEGIN = 0;
70
69
        public final static int NEXT_CLOSE = 1;
71
70
 
72
 
        private boolean _startedProgress;
73
 
        private int _maxProgress;
74
 
        private int _tmpProgress;
 
71
        private boolean _started_progress;
 
72
        private int _max_progress;
 
73
        private int _tmp_progress;
75
74
        private int _progress;
76
 
        protected String _dialogMessage;
77
 
        private Dialog _mergePromptDialog;
78
 
        private boolean _mergePromptAlwaysSelected;
79
 
        private int _nextAction;
 
75
        protected String _dialog_message;
 
76
        private Dialog _merge_prompt_dialog;
 
77
        private boolean _merge_prompt_always_selected;
 
78
        private int _next_action;
 
79
        private int _current_dialog_id;
80
80
 
81
 
        private int _countOverwrites;
82
 
        private int _countCreates;
83
 
        private int _countMerges;
84
 
        private int _countSkips;
 
81
        private int _count_overwrites;
 
82
        private int _count_creates;
 
83
        private int _count_merges;
 
84
        private int _count_skips;
85
85
 
86
86
        protected Importer _importer = null;
87
87
 
93
93
                public void handleMessage( Message msg ) {
94
94
                        switch( msg.what )
95
95
                        {
96
 
                        case MESSAGE_FINISHED_ALLDONE:
 
96
                        case MESSAGE_ALLDONE:
97
97
                                ( (TextView)findViewById( R.id.doit_alldone ) ).
98
 
                                                setVisibility( View.VISIBLE );
99
 
                                // fall through
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(
103
 
                                                View.GONE );
 
102
                                        View.GONE );
104
103
                                break;
105
 
                        case MESSAGE_FINISHED_GOBACK:
106
 
                                ( (Button)findViewById( R.id.back ) ).setEnabled( true );
107
 
                                findViewById( R.id.doit_abort_disp ).setVisibility(
108
 
                                                View.GONE );
 
104
                        case MESSAGE_ABORT:
 
105
                                manualAbort();
109
106
                                break;
110
107
                        case MESSAGE_ERROR:
111
 
                                Doit.this._dialogMessage = (String)msg.obj;
 
108
                                _dialog_message = (String)msg.obj;
112
109
                                showDialog( DIALOG_ERROR );
113
110
                                break;
114
111
                        case MESSAGE_CONTINUEORABORT:
115
 
                                Doit.this._dialogMessage = (String)msg.obj;
 
112
                                _dialog_message = (String)msg.obj;
116
113
                                showDialog( DIALOG_CONTINUEORABORT );
117
114
                                break;
118
115
                        case MESSAGE_SETPROGRESSMESSAGE:
119
116
                                ( (TextView)findViewById( R.id.doit_percentage ) ).
120
 
                                                setText( (String)msg.obj );
 
117
                                        setText( (String)msg.obj );
121
118
                                break;
122
119
                        case MESSAGE_SETMAXPROGRESS:
123
 
                                if( _maxProgress > 0 ) {
124
 
                                        if( _tmpProgress == _maxProgress - 1 )
125
 
                                                _tmpProgress = (Integer)msg.obj;
126
 
                                        if( _progress == _maxProgress - 1 )
 
120
                                if( _max_progress > 0 ) {
 
121
                                        if( _tmp_progress == _max_progress - 1 )
 
122
                                                _tmp_progress = (Integer)msg.obj;
 
123
                                        if( _progress == _max_progress - 1 )
127
124
                                                _progress = (Integer)msg.obj;
128
125
                                }
129
 
                                _maxProgress = (Integer)msg.obj;
 
126
                                _max_progress = (Integer)msg.obj;
130
127
                                updateProgress();
131
128
                                break;
132
129
                        case MESSAGE_SETTMPPROGRESS:
133
 
                                _tmpProgress = (Integer)msg.obj;
 
130
                                _tmp_progress = (Integer)msg.obj;
134
131
                                updateProgress();
135
132
                                break;
136
133
                        case MESSAGE_SETPROGRESS:
137
 
                                _startedProgress = true;
 
134
                                _started_progress = true;
138
135
                                _progress = (Integer)msg.obj;
139
136
                                updateProgress();
140
137
                                break;
141
138
                        case MESSAGE_MERGEPROMPT:
142
 
                                _dialogMessage = (String)msg.obj;
 
139
                                _dialog_message = (String)msg.obj;
143
140
                                showDialog( DIALOG_MERGEPROMPT );
144
141
                                break;
145
142
                        case MESSAGE_CONTACTOVERWRITTEN:
146
 
                                _countOverwrites++;
 
143
                                _count_overwrites++;
147
144
                                updateStats();
148
145
                                break;
149
146
                        case MESSAGE_CONTACTCREATED:
150
 
                                _countCreates++;
 
147
                                _count_creates++;
151
148
                                updateStats();
152
149
                                break;
153
150
                        case MESSAGE_CONTACTMERGED:
154
 
                                _countMerges++;
 
151
                                _count_merges++;
155
152
                                updateStats();
156
153
                                break;
157
154
                        case MESSAGE_CONTACTSKIPPED:
158
 
                                _countSkips++;
 
155
                                _count_skips++;
159
156
                                updateStats();
160
157
                                break;
161
158
                        default:
165
162
        }
166
163
 
167
164
        @Override
168
 
        protected void onCreate(Bundle savedInstanceState)
 
165
        protected void onCreate(Bundle saved_instance_state)
169
166
        {
170
167
                setContentView( R.layout.doit );
171
 
                super.onCreate( savedInstanceState );
 
168
                super.onCreate( saved_instance_state );
172
169
 
173
170
                // hide page 2
174
171
                ( findViewById( R.id.doit_page_2 ) ).setVisibility( View.GONE );
181
178
                        }
182
179
                } );
183
180
 
184
 
                _startedProgress = false;
185
 
                _maxProgress = 0;
186
 
                _tmpProgress = 0;
 
181
                _started_progress = false;
 
182
                _max_progress = 0;
 
183
                _tmp_progress = 0;
187
184
                _progress = 0;
188
185
                _handler = new DoitHandler();
189
186
 
190
 
                _countOverwrites = 0;
191
 
                _countCreates = 0;
192
 
                _countMerges = 0;
193
 
                _countSkips = 0;
 
187
                _count_overwrites = 0;
 
188
                _count_creates = 0;
 
189
                _count_merges = 0;
 
190
                _count_skips = 0;
194
191
 
195
192
                updateNext( NEXT_BEGIN );
196
193
 
204
201
                super.onPause();
205
202
 
206
203
                // saving the state of an import sounds complicated! Lets just abort!
207
 
                abortImport( true );
 
204
                if( _next_action != NEXT_CLOSE )
 
205
                        manualAbort( true );
208
206
        }
209
207
 
210
208
        @Override
211
 
        protected Dialog onCreateDialog(int id)
 
209
        protected Dialog onCreateDialog( int id )
212
210
        {
213
211
                switch( id )
214
212
                {
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 )
219
 
                                        .setMessage( "" )
220
 
                                        .setPositiveButton( R.string.error_ok,
221
 
                                                        new DialogInterface.OnClickListener() {
222
 
                                                public void onClick(DialogInterface dialog,
223
 
                                                                int whichButton) {
224
 
                                                        Doit.this._importer.wake();
 
215
                                .setIcon( R.drawable.alert_dialog_icon )
 
216
                                .setTitle( R.string.error_title )
 
217
                                .setMessage( "" )
 
218
                                .setPositiveButton( R.string.error_ok,
 
219
                                        new DialogInterface.OnClickListener() {
 
220
                                                public void onClick( DialogInterface dialog,
 
221
                                                        int whichButton )
 
222
                                                {
 
223
                                                        if( Doit.this != null )
 
224
                                                                Doit.this._importer.wake();
225
225
                                                }
226
226
                                        } )
227
 
                                        .setOnCancelListener( _dialogOnCancelListener )
228
 
                                        .create();
 
227
                                .setOnCancelListener( _dialog_on_cancel_listener )
 
228
                                .create();
229
229
                case DIALOG_CONTINUEORABORT:
230
230
                        return new AlertDialog.Builder( this )
231
 
                                        .setIcon( R.drawable.alert_dialog_icon )
232
 
                                        .setTitle( R.string.error_title )
233
 
                                        .setMessage( "" )
234
 
                                        .setPositiveButton( R.string.error_continue,
235
 
                                                        new DialogInterface.OnClickListener() {
236
 
                                                public void onClick(DialogInterface dialog,
237
 
                                                                int whichButton) {
238
 
                                                        Doit.this._importer.wake(
 
231
                                .setIcon( R.drawable.alert_dialog_icon )
 
232
                                .setTitle( R.string.error_title )
 
233
                                .setMessage( "" )
 
234
                                .setPositiveButton( R.string.error_continue,
 
235
                                        new DialogInterface.OnClickListener() {
 
236
                                                public void onClick( DialogInterface dialog,
 
237
                                                        int which_button )
 
238
                                                {
 
239
                                                        if( Doit.this != null )
 
240
                                                                Doit.this._importer.wake(
239
241
                                                                        Importer.RESPONSE_POSITIVE );
240
242
                                                }
241
243
                                        } )
242
 
                                        .setNegativeButton( R.string.error_abort,
243
 
                                                        new DialogInterface.OnClickListener() {
244
 
                                                public void onClick(DialogInterface dialog,
245
 
                                                                int whichButton) {
246
 
                                                        Doit.this._importer.wake(
 
244
                                .setNegativeButton( R.string.error_abort,
 
245
                                        new DialogInterface.OnClickListener() {
 
246
                                                public void onClick( DialogInterface dialog,
 
247
                                                        int which_button )
 
248
                                                {
 
249
                                                        if( Doit.this != null )
 
250
                                                                Doit.this._importer.wake(
247
251
                                                                        Importer.RESPONSE_NEGATIVE );
248
252
                                                }
249
253
                                        } )
250
 
                                        .setOnCancelListener( _dialogOnCancelListener )
251
 
                                        .create();
 
254
                                .setOnCancelListener( _dialog_on_cancel_listener )
 
255
                                .create();
252
256
                case DIALOG_MERGEPROMPT:
253
257
                        // custom layout in an AlertDialog
254
258
                        LayoutInflater factory = LayoutInflater.from( this );
255
 
                        final View dialogView = factory.inflate(
256
 
                                        R.layout.mergeprompt, null );
257
 
                        ( (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;
263
 
                                }
264
 
                        } );
265
 
                        ( (Button)dialogView.findViewById( R.id.merge_keep ) ).
266
 
                                        setOnClickListener( _mergePromptButtonListener );
267
 
                        ( (Button)dialogView.findViewById( R.id.merge_overwrite ) ).
268
 
                                        setOnClickListener( _mergePromptButtonListener );
269
 
                        ( (Button)dialogView.findViewById( R.id.merge_merge ) ).
270
 
                                        setOnClickListener( _mergePromptButtonListener );
271
 
                        ( (Button)dialogView.findViewById( R.id.abort ) ).
272
 
                                        setOnClickListener( _mergePromptButtonListener );
273
 
                        _mergePromptAlwaysSelected = false;
 
259
                        final View dialog_view = factory.inflate(
 
260
                                R.layout.mergeprompt, null );
 
261
                        ( (CheckBox)dialog_view.findViewById( R.id.mergeprompt_always ) ).
 
262
                                setOnCheckedChangeListener(
 
263
                                        new CompoundButton.OnCheckedChangeListener() {
 
264
                                                public void onCheckedChanged(
 
265
                                                        CompoundButton button_view, boolean is_checked )
 
266
                                                {
 
267
                                                        if( Doit.this != null )
 
268
                                                                Doit.this._merge_prompt_always_selected =
 
269
                                                                        is_checked;
 
270
                                                }
 
271
                                        } );
 
272
                        ( (Button)dialog_view.findViewById( R.id.merge_keep ) ).
 
273
                                setOnClickListener( _merge_prompt_button_listener );
 
274
                        ( (Button)dialog_view.findViewById( R.id.merge_overwrite ) ).
 
275
                                setOnClickListener( _merge_prompt_button_listener );
 
276
                        ( (Button)dialog_view.findViewById( R.id.merge_merge ) ).
 
277
                                setOnClickListener( _merge_prompt_button_listener );
 
278
                        ( (Button)dialog_view.findViewById( R.id.abort ) ).
 
279
                                setOnClickListener( _merge_prompt_button_listener );
 
280
                        _merge_prompt_always_selected = false;
274
281
                        return new AlertDialog.Builder( this )
275
 
                                        .setIcon( R.drawable.alert_dialog_icon )
276
 
                                        .setTitle( R.string.mergeprompt_title )
277
 
                                        .setView( dialogView )
278
 
                                        .setOnCancelListener( _dialogOnCancelListener )
279
 
                                        .create();
 
282
                                .setIcon( R.drawable.alert_dialog_icon )
 
283
                                .setTitle( R.string.mergeprompt_title )
 
284
                                .setView( dialog_view )
 
285
                                .setOnCancelListener( _dialog_on_cancel_listener )
 
286
                                .create();
280
287
                }
281
288
                return null;
282
289
        }
283
290
 
284
 
        private OnClickListener _mergePromptButtonListener = new OnClickListener() {
 
291
        private OnClickListener _merge_prompt_button_listener =
 
292
                new OnClickListener()
 
293
        {
285
294
                public void onClick( View view )
286
295
                {
 
296
                        if( Doit.this == null ) return;
 
297
 
287
298
                        // handle abort
288
299
                        if( view.getId() == R.id.abort )
289
300
                                manualAbort();
290
301
 
291
 
                        // else, response
292
 
                        else {
293
 
                                int responseExtra = _mergePromptAlwaysSelected?
294
 
                                                Importer.RESPONSEEXTRA_ALWAYS : Importer.RESPONSEEXTRA_NONE;
 
302
                        // else, response (just check we haven't aborted already!)
 
303
                        else if( Doit.this._importer != null ) {
 
304
                                int response_extra = _merge_prompt_always_selected?
 
305
                                        Importer.RESPONSEEXTRA_ALWAYS : Importer.RESPONSEEXTRA_NONE;
295
306
                                Doit.this._importer.wake( convertIdToAction( view.getId() ),
296
 
                                                responseExtra );
 
307
                                        response_extra );
297
308
                        }
298
309
 
299
310
                        // close dialog and free (don't keep a reference)
300
 
                        Doit.this._mergePromptDialog.dismiss();
301
 
                        Doit.this._mergePromptDialog = null;
 
311
                        Doit.this._merge_prompt_dialog.dismiss();
 
312
                        Doit.this._merge_prompt_dialog = null;
302
313
                }
303
314
        };
304
315
 
308
319
                Button next = (Button)findViewById( R.id.next );
309
320
                next.setEnabled( false );
310
321
 
311
 
                switch( _nextAction )
 
322
                switch( _next_action )
312
323
                {
313
324
                case NEXT_BEGIN:
314
325
                        importContacts();
315
326
                        break;
316
327
                case NEXT_CLOSE:
317
 
                        setResult( RESULT_CANCELED );
 
328
                        setResult( RESULT_OK );
318
329
                        finish();
319
330
                        break;
320
331
                }
322
333
 
323
334
        private void manualAbort()
324
335
        {
325
 
                abortImport( false );
 
336
                manualAbort( false );
 
337
        }
 
338
 
 
339
        private void manualAbort( boolean show_toaster_popup )
 
340
        {
 
341
                abortImport( show_toaster_popup );
 
342
 
326
343
                updateNext( NEXT_CLOSE );
327
344
                ( (Button)findViewById( R.id.back ) ).setEnabled( true );
328
345
                findViewById( R.id.doit_abort_disp ).setVisibility( View.GONE );
 
346
                ( (TextView)findViewById( R.id.doit_aborted ) ).
 
347
                        setVisibility( View.VISIBLE );
 
348
                ( (TextView)findViewById( R.id.doit_alldone ) ).
 
349
                        setVisibility( View.GONE );
 
350
 
 
351
                // close any open dialogs
 
352
                try {
 
353
                        dismissDialog( _current_dialog_id );
 
354
                }
 
355
                catch( Exception e ) {
 
356
                        // ignore errors
 
357
                }
329
358
        }
330
359
 
331
 
        private void updateNext( int nextAction )
 
360
        private void updateNext( int next_action )
332
361
        {
333
362
                Button next = (Button)findViewById( R.id.next );
334
 
                switch( nextAction ) {
 
363
                switch( next_action ) {
335
364
                case NEXT_BEGIN:        next.setText( R.string.doit_begin ); break;
336
365
                case NEXT_CLOSE:        next.setText( R.string.doit_close ); break;
337
366
                }
338
367
                next.setEnabled( true );
339
 
                _nextAction = nextAction;
 
368
                _next_action = next_action;
340
369
        }
341
370
 
342
371
        public static int convertIdToAction( int id ) {
357
386
                }
358
387
        }
359
388
 
360
 
        private DialogInterface.OnCancelListener _dialogOnCancelListener =
361
 
                        new DialogInterface.OnCancelListener() {
 
389
        private DialogInterface.OnCancelListener _dialog_on_cancel_listener =
 
390
                new DialogInterface.OnCancelListener()
 
391
        {
362
392
                public void onCancel( DialogInterface dialog ) {
363
 
                        setResult( RESULT_CANCELED );
364
 
                        finish();
 
393
                        manualAbort();
365
394
                }
366
395
        };
367
396
 
 
397
 
368
398
        @Override
369
 
        protected void onActivityResult( int requestCode, int resultCode,
370
 
                        Intent data )
 
399
        protected void onActivityResult( int request_code, int result_code,
 
400
                Intent data )
371
401
        {
372
402
                // if we're cancelling, abort any import
373
 
                if( resultCode == RESULT_CANCELED )
 
403
                if( result_code == RESULT_CANCELED )
374
404
                        abortImport( true );
375
405
        }
376
406
 
377
407
        @Override
378
 
        protected void onPrepareDialog(int id, Dialog dialog)
 
408
        protected void onPrepareDialog( int id, Dialog dialog )
379
409
        {
 
410
                _current_dialog_id = id;
 
411
 
380
412
                switch( id )
381
413
                {
382
414
                case DIALOG_ERROR:      // fall through
383
415
                case DIALOG_CONTINUEORABORT:
384
416
                        // set dialog message
385
 
                        ( (AlertDialog)dialog ).setMessage( _dialogMessage );
 
417
                        ( (AlertDialog)dialog ).setMessage( _dialog_message );
386
418
                        break;
387
419
                case DIALOG_MERGEPROMPT:
388
420
                        // set contact's name
389
 
                        ( (TextView)dialog.findViewById( R.id.mergeprompt_name ) ).setText(
390
 
                                        _dialogMessage );
 
421
                        ( (TextView)dialog.findViewById( R.id.mergeprompt_name ) )
 
422
                                .setText( _dialog_message );
391
423
                        // and set up reference to dialog
392
 
                        _mergePromptDialog = dialog;
 
424
                        _merge_prompt_dialog = dialog;
393
425
                        break;
394
426
                }
395
427
 
406
438
                ( (Button)findViewById( R.id.back ) ).setEnabled( false );
407
439
 
408
440
                // create importer
409
 
                _importer = new VCFImporter( this );
 
441
                _importer = new VcardImporter( this );
410
442
 
411
443
                // start the service's thread
412
444
                _importer.start();
415
447
        private void updateProgress()
416
448
        {
417
449
                ProgressBar bar = (ProgressBar)findViewById( R.id.doit_progress );
418
 
                TextView outOf = (TextView)findViewById( R.id.doit_outof );
 
450
                TextView out_of = (TextView)findViewById( R.id.doit_outof );
419
451
 
420
 
                if( _maxProgress > 0 )
 
452
                if( _max_progress > 0 )
421
453
                {
422
 
                        bar.setMax( _maxProgress );
423
 
                        bar.setSecondaryProgress( _tmpProgress );
 
454
                        bar.setMax( _max_progress );
 
455
                        bar.setSecondaryProgress( _tmp_progress );
424
456
 
425
 
                        if( _startedProgress )
 
457
                        if( _started_progress )
426
458
                        {
427
459
                                ( (TextView)findViewById( R.id.doit_percentage ) ).setText(
428
 
                                                (int)Math.round( 100 * _progress / _maxProgress ) + "%" );
429
 
                                outOf.setText( _progress + "/" + _maxProgress );
 
460
                                        (int)Math.round( 100 * _progress / _max_progress ) + "%" );
 
461
                                out_of.setText( _progress + "/" + _max_progress );
430
462
                                bar.setProgress( _progress );
431
463
                        }
432
464
                }
435
467
        private void updateStats()
436
468
        {
437
469
                ( (TextView)findViewById( R.id.doit_overwrites ) ).setText(
438
 
                                "" + _countOverwrites );
 
470
                        "" + _count_overwrites );
439
471
                ( (TextView)findViewById( R.id.doit_creates ) ).setText(
440
 
                                "" + _countCreates );
 
472
                        "" + _count_creates );
441
473
                ( (TextView)findViewById( R.id.doit_merges ) ).setText(
442
 
                                "" + _countMerges );
 
474
                        "" + _count_merges );
443
475
                ( (TextView)findViewById( R.id.doit_skips ) ).setText(
444
 
                                "" + _countSkips );
 
476
                        "" + _count_skips );
445
477
        }
446
478
 
447
 
        private void abortImport( boolean showToasterPopup )
 
479
        private void abortImport( boolean show_toaster_popup )
448
480
        {
449
481
                if( _importer != null )
450
482
                {
461
493
                                }
462
494
 
463
495
                                // notify the user
464
 
                                if( showToasterPopup )
 
496
                                if( show_toaster_popup )
465
497
                                        Toast.makeText( this, R.string.doit_importaborted,
466
 
                                                        Toast.LENGTH_LONG ).show();
 
498
                                                Toast.LENGTH_LONG ).show();
467
499
                        }
468
500
                }
469
501