aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/files/FileList.java
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching/files/FileList.java')
-rw-r--r--main/src/cgeo/geocaching/files/FileList.java23
1 files changed, 9 insertions, 14 deletions
diff --git a/main/src/cgeo/geocaching/files/FileList.java b/main/src/cgeo/geocaching/files/FileList.java
index df95085..31daeb4 100644
--- a/main/src/cgeo/geocaching/files/FileList.java
+++ b/main/src/cgeo/geocaching/files/FileList.java
@@ -1,9 +1,11 @@
package cgeo.geocaching.files;
+import cgeo.geocaching.Intents;
import cgeo.geocaching.R;
import cgeo.geocaching.StoredList;
import cgeo.geocaching.activity.AbstractListActivity;
import cgeo.geocaching.utils.FileUtils;
+import cgeo.geocaching.utils.IOUtils;
import cgeo.geocaching.utils.Log;
import org.apache.commons.collections.CollectionUtils;
@@ -33,7 +35,7 @@ public abstract class FileList<T extends ArrayAdapter<File>> extends AbstractLis
private T adapter = null;
private ProgressDialog waitDialog = null;
private SearchFilesThread searchingThread = null;
- private int listId = StoredList.STANDARD_LIST_ID;
+ protected int listId = StoredList.STANDARD_LIST_ID;
private String[] extensions;
final private Handler changeWaitDialogHandler = new Handler() {
@@ -91,7 +93,7 @@ public abstract class FileList<T extends ArrayAdapter<File>> extends AbstractLis
Bundle extras = getIntent().getExtras();
if (extras != null) {
- listId = extras.getInt("list");
+ listId = extras.getInt(Intents.EXTRA_LIST_ID);
}
if (listId <= StoredList.TEMPORARY_LIST_ID) {
listId = StoredList.STANDARD_LIST_ID;
@@ -182,7 +184,7 @@ public abstract class FileList<T extends ArrayAdapter<File>> extends AbstractLis
Log.w("No external media mounted.");
}
} catch (Exception e) {
- Log.e("cgFileList.loadFiles.run: " + e.toString());
+ Log.e("cgFileList.loadFiles.run", e);
}
changeWaitDialogHandler.sendMessage(Message.obtain(changeWaitDialogHandler, 0, "loaded directories"));
@@ -242,15 +244,8 @@ public abstract class FileList<T extends ArrayAdapter<File>> extends AbstractLis
Log.e("Could not get additional mount points for user content. " +
"Proceeding with external storage only (" + extStorage + ")");
} finally {
- try {
- if (fr != null) {
- fr.close();
- }
- if (br != null) {
- br.close();
- }
- } catch (IOException e) {
- }
+ IOUtils.closeQuietly(fr);
+ IOUtils.closeQuietly(br);
}
}
return storages;
@@ -283,8 +278,8 @@ public abstract class FileList<T extends ArrayAdapter<File>> extends AbstractLis
private void setExtensions(final String[] extensionsIn) {
extensions = extensionsIn;
for (int i = 0; i < extensions.length; i++) {
- String extension = extensions[i];
- if (extension.length() == 0 || extension.charAt(0) != '.') {
+ final String extension = extensions[i];
+ if (StringUtils.isEmpty(extension) || extension.charAt(0) != '.') {
extensions[i] = "." + extension;
}
}