/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/am/ed/exportcontacts/ConfigureVCF.java

  • Committer: edam
  • Date: 2012-04-24 11:29:44 UTC
  • Revision ID: tim@ed.am-20120424112944-6fic236bul6r9cqi
changed all the URLs to ed.am, including copyrights, package names and project
site

Show diffs side-by-side

added added

removed removed

1
1
/*
2
2
 * ConfigureVCF.java
3
3
 *
4
 
 * Copyright (C) 2010 Tim Marston <edam@waxworlds.org>
 
4
 * Copyright (C) 2010 Tim Marston <tim@ed.am>
5
5
 *
6
6
 * This file is part of the Export Contacts program (hereafter referred
7
7
 * to as "this program"). For more information, see
8
 
 * http://www.waxworlds.org/edam/software/android/export-contacts
 
8
 * http://ed.am/dev/android/export-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.edam.exportcontacts;
 
24
package am.ed.exportcontacts;
25
25
 
26
26
import android.app.Dialog;
27
27
import android.content.DialogInterface;
46
46
                setContentView( R.layout.configure_vcf );
47
47
                super.onCreate( savedInstanceState );
48
48
 
49
 
//              setNextActivity( Doit.class );
 
49
                setNextActivity( Doit.class );
 
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" );
50
67
 
51
68
                Button path_button = (Button)findViewById( R.id.path );
52
69
                path_button.setOnClickListener( new View.OnClickListener() {
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;