Mercurial > directorypicker
changeset 2:a684ded7d920 default tip
Prevent crash when not passed a bundle. Thanks to Curtis Tuplin for the fix.
author | Brad Greco |
---|---|
date | Wed, 30 May 2012 21:33:07 -0500 |
parents | adceb82e0818 |
children | |
files | .classpath AndroidManifest.xml CHANGELOG.TXT default.properties src/net/bgreco/DirectoryPicker.java |
diffstat | 5 files changed, 39 insertions(+), 39 deletions(-) [+] |
line wrap: on
line diff
--- a/.classpath Sat Jun 04 22:20:54 2011 -0400 +++ b/.classpath Wed May 30 21:33:07 2012 -0500 @@ -3,5 +3,6 @@ <classpathentry kind="src" path="src"/> <classpathentry kind="src" path="gen"/> <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> - <classpathentry kind="output" path="bin"/> + <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> + <classpathentry kind="output" path="bin/classes"/> </classpath>
--- a/AndroidManifest.xml Sat Jun 04 22:20:54 2011 -0400 +++ b/AndroidManifest.xml Wed May 30 21:33:07 2012 -0500 @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="net.bgreco" - android:versionCode="1" - android:versionName="1.0"> + android:versionCode="2" + android:versionName="1.0.1"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".DirectoryPicker"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CHANGELOG.TXT Wed May 30 21:33:07 2012 -0500 @@ -0,0 +1,5 @@ +Version 1.0.1 2012-05-30 +* Prevent crash when not passed a bundle. Thanks to Curtis Tuplin for the fix. + +Version 1.0 2011-06-04 +* Initial release \ No newline at end of file
--- a/default.properties Sat Jun 04 22:20:54 2011 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system use, -# "build.properties", and override values to adapt the script to your -# project structure. - -# Project target. -target=android-4 -android.library=true
--- a/src/net/bgreco/DirectoryPicker.java Sat Jun 04 22:20:54 2011 -0400 +++ b/src/net/bgreco/DirectoryPicker.java Wed May 30 21:33:07 2012 -0500 @@ -1,4 +1,22 @@ package net.bgreco; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collections; + +import android.app.ListActivity; +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; +import android.os.Environment; +import android.view.View; +import android.widget.AdapterView; +import android.widget.AdapterView.OnItemClickListener; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.ListView; +import android.widget.Toast; + /** Copyright (C) 2011 by Brad Greco <brad@bgreco.net> @@ -20,22 +38,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -import java.io.File; -import java.util.ArrayList; -import java.util.Collections; - -import android.app.ListActivity; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import android.os.Environment; -import android.view.View; -import android.widget.AdapterView; -import android.widget.AdapterView.OnItemClickListener; -import android.widget.ArrayAdapter; -import android.widget.Button; -import android.widget.ListView; -import android.widget.Toast; public class DirectoryPicker extends ListActivity { @@ -45,20 +47,24 @@ public static final String CHOSEN_DIRECTORY = "chosenDir"; public static final int PICK_DIRECTORY = 43522432; private File dir; + private boolean showHidden = false; + private boolean onlyDirs = true ; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle extras = getIntent().getExtras(); dir = Environment.getExternalStorageDirectory(); - String preferredStartDir = extras.getString(START_DIR); - final boolean showHidden = extras.getBoolean(SHOW_HIDDEN, false); - final boolean onlyDirs = extras.getBoolean(ONLY_DIRS, true); - if(preferredStartDir != null) { - File startDir = new File(preferredStartDir); - if(startDir.isDirectory()) { - dir = startDir; - } + if (extras != null) { + String preferredStartDir = extras.getString(START_DIR); + showHidden = extras.getBoolean(SHOW_HIDDEN, false); + onlyDirs = extras.getBoolean(ONLY_DIRS, true); + if(preferredStartDir != null) { + File startDir = new File(preferredStartDir); + if(startDir.isDirectory()) { + dir = startDir; + } + } } setContentView(R.layout.chooser_list);