/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-10-03 16:58:29 UTC
  • Revision ID: edam@waxworlds.org-20091003165829-vxhwdodf3400ugs3
Tags: 0.9
- converted project to use Android 1.5 SDK
- cleaned-up some whitespace/newlines in source

Show diffs side-by-side

added added

removed removed

32
32
public class ImportContacts extends Activity
33
33
{
34
34
        public static final int STATE_NONE = 0;
35
 
        public static final int STATE_IMPORT_VCF = 1;
36
 
        public static final int STATE_MERGE = 2;
37
 
        public static final int STATE_DOIT = 3;
 
35
        public static final int STATE_INTRO = 1;
 
36
        public static final int STATE_CONFIGURE_VCF = 3;
 
37
        public static final int STATE_MERGE = 4;
 
38
        public static final int STATE_DOIT = 5;
38
39
 
39
40
        private Stack< Integer > _stateStack;
40
41
 
41
42
        /** Called when the activity is first created. */
42
43
        @Override
43
 
    public void onCreate(Bundle savedInstanceState)
44
 
    {
 
44
        public void onCreate( Bundle savedInstanceState )
 
45
        {
45
46
                super.onCreate(savedInstanceState);
46
47
 
47
48
                _stateStack = new Stack< Integer >();
48
49
 
49
 
                startState( STATE_IMPORT_VCF );
50
 
    }
 
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
                }
 
62
        }
 
63
 
 
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
        }
51
72
 
52
73
        @Override
53
74
        protected void onActivityResult(int requestCode, int resultCode, Intent data)
70
91
                                }
71
92
                        }
72
93
                        startState( newState );
 
94
 
73
95
                }
74
96
        }
75
97
 
90
112
                // figure out the class
91
113
                Class cls = null;
92
114
                switch( newState ) {
93
 
                case STATE_IMPORT_VCF: cls = ImportVCF.class; break;
 
115
                case STATE_INTRO: cls = Intro.class; break;
 
116
                case STATE_CONFIGURE_VCF: cls = ConfigureVCF.class; break;
94
117
                case STATE_MERGE: cls = Merge.class; break;
95
118
                case STATE_DOIT: cls = Doit.class; break;
96
119
                }
100
123
                if( _stateStack.size() > 1 ) i.putExtra( "backstate", true );
101
124
                startActivityForResult( i, 0 );
102
125
        }
103
 
}
 
 
'\\ No newline at end of file'
 
126
}