/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-22 18:56:17 UTC
  • Revision ID: edam@waxworlds.org-20101022185617-6p6ivjqt28avwlzo
- added file chooser
- changed directory edit box for a directory "browse" button
- wired file chooser in to configure vcf page
- fixed intro
- made app debuggable
- added licence and changelog

Show diffs side-by-side

added added

removed removed

1
1
/*
2
2
 * ConfigureVCF.java
3
3
 *
4
 
 * Copyright (C) 2010 Tim Marston <tim@ed.am>
 
4
 * Copyright (C) 2010 Tim Marston <edam@waxworlds.org>
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://ed.am/dev/android/export-contacts
 
8
 * http://www.waxworlds.org/edam/software/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 am.ed.exportcontacts;
 
24
package org.waxworlds.edam.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 );
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" );
 
49
//              setNextActivity( Doit.class );
67
50
 
68
51
                Button path_button = (Button)findViewById( R.id.path );
69
52
                path_button.setOnClickListener( new View.OnClickListener() {
111
94
        protected void updatePathButton()
112
95
        {
113
96
                Button path_button = (Button)findViewById( R.id.path );
114
 
                path_button.setText(
115
 
                        _file_chooser.prettyPrint( "/sdcard" + _path, true ) );
 
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 );
116
103
        }
117
104
 
118
105
        protected void onBrowse()
120
107
                // get path
121
108
                Button path_button = (Button)findViewById( R.id.path );
122
109
 
 
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
 
123
126
                // set a path for this incantation
124
127
                _file_chooser.setPath( path_button.getText().toString() );
125
128
 
134
137
                switch( id )
135
138
                {
136
139
                case DIALOG_FILECHOOSER:
137
 
                        ret = _file_chooser.onCreateDialog();
138
 
                        break;
 
140
                        ret = _file_chooser.onCreateDialog( this );
139
141
                }
140
142
 
141
143
                return ret;