/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/importcontacts/WizardActivity.java

  • Committer: edam
  • Date: 2009-02-02 06:38:20 UTC
  • Revision ID: edam@waxworlds.org-20090202063820-a37ptsjcj8ipgodn
- renamed ImportVCF class to ConfigureVCF
- save/restore back button state
- trying to save/restore state in ImpoirtContacts, but it doesn't work

Show diffs side-by-side

added added

removed removed

 
1
/*
 
2
 * WizardActivity.java
 
3
 *
 
4
 * Copyright (C) 2009 Tim Marston <edam@waxworlds.org>
 
5
 *
 
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
 
9
 *
 
10
 * This program is free software: you can redistribute it and/or modify
 
11
 * it under the terms of the GNU General Public License as published by
 
12
 * the Free Software Foundation, either version 3 of the License, or
 
13
 * (at your option) any later version.
 
14
 *
 
15
 * This program is distributed in the hope that it will be useful,
 
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
18
 * GNU General Public License for more details.
 
19
 *
 
20
 * You should have received a copy of the GNU General Public License
 
21
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
22
 */
 
23
 
1
24
package org.waxworlds.importcontacts;
2
25
 
3
26
import android.app.Activity;
9
32
 
10
33
public class WizardActivity extends Activity
11
34
{
12
 
        private int _nextState = 0;
 
35
        private int _nextState;
 
36
        private boolean _backEnabled;
13
37
 
14
38
        @Override
15
39
        protected void onCreate(Bundle savedInstanceState)
16
40
        {
17
41
                super.onCreate(savedInstanceState);
18
42
 
 
43
                _nextState = 0;
 
44
 
 
45
                // deal with saved state vs. defaults
 
46
                if( savedInstanceState == null)
 
47
                {
 
48
                        _backEnabled = false;
 
49
 
 
50
                        Bundle extras = getIntent().getExtras();
 
51
                        if( extras != null )
 
52
                                _backEnabled = extras.getBoolean( "backstate" );
 
53
                }
 
54
                else
 
55
                {
 
56
                        _backEnabled = savedInstanceState.getBoolean( "_backEnabled" );
 
57
                }
 
58
 
 
59
                // enable/disable back button
 
60
                ( (Button)findViewById( R.id.back ) ).setEnabled( _backEnabled );
 
61
 
19
62
                // set up next button
20
63
                Button next = (Button)findViewById( R.id.next );
21
64
                next.setOnClickListener( new View.OnClickListener() {
22
65
                        public void onClick( View view ) {
23
 
                                switchToState( _nextState );
 
66
                                onNext();
24
67
                        }
25
68
                } );
26
69
 
32
75
                                finish();
33
76
                        }
34
77
                } );
35
 
 
36
 
                // enable back button?
37
 
                Bundle extras = getIntent().getExtras();
38
 
                if( extras != null ) {
39
 
                        Boolean backstate = extras.getBoolean( "backstate" );
40
 
                        if( backstate != null )
41
 
                                ( (Button)findViewById( R.id.back ) ).setEnabled( true );
42
 
                }
 
78
        }
 
79
 
 
80
        @Override
 
81
        protected void onSaveInstanceState( Bundle outState ) {
 
82
                super.onSaveInstanceState(outState);
 
83
                outState.putBoolean( "_backEnabled", _backEnabled );
 
84
        }
 
85
/*
 
86
        @Override
 
87
        protected void onPause()
 
88
        {
 
89
                super.onPause();
 
90
        }
 
91
 
 
92
        @Override
 
93
        protected void onResume()
 
94
        {
 
95
                super.onResume();
 
96
        }
 
97
*/
 
98
        protected void onNext()
 
99
        {
 
100
                switchToState( _nextState );
43
101
        }
44
102
 
45
103
        protected void setNextState( int nextState )