/android/export-contacts

To get this branch, use:
bzr branch http://bzr.ed.am/android/export-contacts

« back to all changes in this revision

Viewing changes to src/org/waxworlds/edam/exportcontacts/ConfigureVCF.java

  • Committer: edam
  • Date: 2010-10-28 16:11:51 UTC
  • Revision ID: edam@waxworlds.org-20101028161151-rvtpjt1efsxmyfe5
- merged changes to file chooser from import contacts
- changed the browse button to show a full path

Show diffs side-by-side

added added

removed removed

48
48
 
49
49
//              setNextActivity( Doit.class );
50
50
 
 
51
                // create file chooser
 
52
                _file_chooser = new FileChooser( this );
 
53
                _file_chooser.setMode( FileChooser.MODE_DIR );
 
54
                String[] extensions = { "vcf" };
 
55
                _file_chooser.setExtensions( extensions );
 
56
                _file_chooser.setDismissListener(
 
57
                        new DialogInterface.OnDismissListener() {
 
58
                                public void onDismiss( DialogInterface dialog )
 
59
                                {
 
60
                                        if( _file_chooser.getOk() ) {
 
61
                                                _path = _file_chooser.getPath();
 
62
                                                updatePathButton();
 
63
                                        }
 
64
                                }
 
65
                        } );
 
66
                _file_chooser.setPathPrefix( "/sdcard" );
 
67
 
51
68
                Button path_button = (Button)findViewById( R.id.path );
52
69
                path_button.setOnClickListener( new View.OnClickListener() {
53
70
                        public void onClick( View view ) {
94
111
        protected void updatePathButton()
95
112
        {
96
113
                Button path_button = (Button)findViewById( R.id.path );
97
 
                path_button.setText( FileChooser.prettyPrint(
98
 
                        getApplicationContext(), "/sdcard" + _path, false ) );
99
 
                path_button.setCompoundDrawablesWithIntrinsicBounds(
100
 
                        getResources().getDrawable(
101
 
                                FileChooser.pathIcon( "/sdcard" + _path ) ), null,
102
 
                                getResources().getDrawable( R.drawable.browse ), null );
 
114
                path_button.setText(
 
115
                        _file_chooser.prettyPrint( "/sdcard" + _path, true ) );
103
116
        }
104
117
 
105
118
        protected void onBrowse()
107
120
                // get path
108
121
                Button path_button = (Button)findViewById( R.id.path );
109
122
 
110
 
                // create file chooser
111
 
                if( _file_chooser == null ) {
112
 
                        _file_chooser = new FileChooser( FileChooser.MODE_DIR );
113
 
                        String[] extensions = { "vcf" };
114
 
                        _file_chooser.setExtensions( extensions );
115
 
                        _file_chooser.setDismissListener(
116
 
                                new DialogInterface.OnDismissListener() {
117
 
                                        public void onDismiss( DialogInterface dialog )
118
 
                                        {
119
 
                                                _path = _file_chooser.getPath();
120
 
                                                updatePathButton();
121
 
                                        }
122
 
                                } );
123
 
                        _file_chooser.setPathPrefix( "/sdcard" );
124
 
                }
125
 
 
126
123
                // set a path for this incantation
127
124
                _file_chooser.setPath( path_button.getText().toString() );
128
125
 
137
134
                switch( id )
138
135
                {
139
136
                case DIALOG_FILECHOOSER:
140
 
                        ret = _file_chooser.onCreateDialog( this );
 
137
                        ret = _file_chooser.onCreateDialog();
 
138
                        break;
141
139
                }
142
140
 
143
141
                return ret;