Merge with latest from Corey's backup branch.

------------------------------------------------------------
Use --include-merges or -n0 to see merged revisions.
pull/14/head
Tim Su 16 years ago
parent 5ab900f323
commit cbc9d6d941

@ -3,6 +3,8 @@ package com.timsu.astrid.widget;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.util.Log;
import com.timsu.astrid.R;
import java.io.File;
import java.io.FilenameFilter;
@ -30,9 +32,9 @@ public class FilePickerBuilder extends AlertDialog.Builder implements DialogInte
return file.isFile();
}
};
this.callback = callback;
setTitle(title);
setPath(path);
this.callback = callback;
}
public void setFilter(FilenameFilter filter) {
@ -40,6 +42,7 @@ public class FilePickerBuilder extends AlertDialog.Builder implements DialogInte
}
private void setPath(File path) {
if (path != null && path.exists()) {
this.path = path.getAbsolutePath();
// Reverse the order of the file list so newest timestamped file is first.
List<String> fileList = Arrays.asList(path.list(filter));
@ -47,6 +50,10 @@ public class FilePickerBuilder extends AlertDialog.Builder implements DialogInte
Collections.reverse(fileList);
files = (String[]) fileList.toArray();
setItems(files, this);
} else {
Log.e("FilePicker", "Cannot access sdcard.");
setMessage(R.string.error_sdcard + "sdcard");
}
}
@Override

Loading…
Cancel
Save