/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/ImportContacts.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

33
33
{
34
34
        public static final int STATE_NONE = 0;
35
35
        public static final int STATE_INTRO = 1;
36
 
        public static final int STATE_IMPORT_VCF = 3;
 
36
        public static final int STATE_CONFIGURE_VCF = 3;
37
37
        public static final int STATE_MERGE = 4;
38
38
        public static final int STATE_DOIT = 5;
39
39
 
41
41
 
42
42
        /** Called when the activity is first created. */
43
43
        @Override
44
 
    public void onCreate(Bundle savedInstanceState)
 
44
    public void onCreate( Bundle savedInstanceState )
45
45
    {
46
46
                super.onCreate(savedInstanceState);
47
47
 
48
48
                _stateStack = new Stack< Integer >();
49
49
 
50
 
                startState( STATE_INTRO );
 
50
                if( savedInstanceState == null )
 
51
                {
 
52
                        startState( STATE_INTRO );
 
53
                }
 
54
                else
 
55
                {
 
56
                        int[] stack = savedInstanceState.getIntArray( "_stateStack" );
 
57
                        for( int n = 0; n < stack.length; n++ )
 
58
                                _stateStack.push( stack[ n ] );
 
59
                        int lastState = _stateStack.pop();
 
60
                        startState( lastState );
 
61
                }
51
62
    }
52
63
 
53
64
        @Override
 
65
        protected void onSaveInstanceState(Bundle outState) {
 
66
                super.onSaveInstanceState(outState);
 
67
                int[] stack = new int[ _stateStack.size() ];
 
68
                for( int n = 0; n < _stateStack.size(); n++ )
 
69
                        stack[ n ] = _stateStack.elementAt( n );
 
70
                outState.putIntArray( "_stateStack", stack );
 
71
        }
 
72
 
 
73
        @Override
54
74
        protected void onActivityResult(int requestCode, int resultCode, Intent data)
55
75
        {
56
76
                super.onActivityResult(requestCode, resultCode, data);
71
91
                                }
72
92
                        }
73
93
                        startState( newState );
 
94
 
74
95
                }
75
96
        }
76
97
 
92
113
                Class cls = null;
93
114
                switch( newState ) {
94
115
                case STATE_INTRO: cls = Intro.class; break;
95
 
                case STATE_IMPORT_VCF: cls = ImportVCF.class; break;
 
116
                case STATE_CONFIGURE_VCF: cls = ConfigureVCF.class; break;
96
117
                case STATE_MERGE: cls = Merge.class; break;
97
118
                case STATE_DOIT: cls = Doit.class; break;
98
119
                }