SourceForge: jmec64/jmec64: changeset 366:9bc091ba6983
some improvements to the Android FileDialog class
authorjoergjahnke
Tue Nov 03 20:22:19 2009 +0100 (6 weeks ago)
changeset 3669bc091ba6983
parent 365 adef882c55f4
child 367 09bff7b3bf76
some improvements to the Android FileDialog class
src/de/joergjahnke/c64/android/AndroidC64.java
src/de/joergjahnke/c64/android/AttachImageDialog.java
src/de/joergjahnke/common/android/FileDialog.java
     1.1 --- a/src/de/joergjahnke/c64/android/AndroidC64.java	Tue Nov 03 20:22:09 2009 +0100
     1.2 +++ b/src/de/joergjahnke/c64/android/AndroidC64.java	Tue Nov 03 20:22:19 2009 +0100
     1.3 @@ -32,10 +32,10 @@
     1.4  import de.joergjahnke.c64.core.C64;
     1.5  import de.joergjahnke.c64.drive.DriveHandler;
     1.6  import de.joergjahnke.c64.extendeddevices.EmulatorUtils;
     1.7 +import de.joergjahnke.common.android.FileDialog;
     1.8  import de.joergjahnke.common.android.WavePlayer;
     1.9  import de.joergjahnke.common.util.Observer;
    1.10  import de.joergjahnke.common.vmabstraction.androidvm.AndroidVMResourceLoader;
    1.11 -
    1.12  import java.io.BufferedInputStream;
    1.13  import java.io.File;
    1.14  import java.io.FileInputStream;
    1.15 @@ -372,7 +372,7 @@
    1.16                  final Intent loadFileIntent = new Intent();
    1.17  
    1.18                  loadFileIntent.setClass(this, AttachImageDialog.class);
    1.19 -                loadFileIntent.putExtra("de.joergjahnke.c64.android.prgdir", this.prefs.getString(SETTING_FILESEARCH_STARTDIR, "/"));
    1.20 +                loadFileIntent.putExtra(FileDialog.PROPERTY_START_DIR, this.prefs.getString(SETTING_FILESEARCH_STARTDIR, "/"));
    1.21                  startActivityForResult(loadFileIntent, MENU_ATTACHIMAGE);
    1.22                  break;
    1.23              }
    1.24 @@ -476,7 +476,7 @@
    1.25                      this.c64.getKeyboard().keyTyped(extras.getStringExtra("de.joergjahnke.c64.android.selectedKey").toUpperCase());
    1.26                      break;
    1.27                  case MENU_ATTACHIMAGE: {
    1.28 -                    final String data = extras.getStringExtra("de.joergjahnke.gameboy.android.currentFile");
    1.29 +                    final String data = extras.getStringExtra(FileDialog.PROPERTY_SELECTED_FILE);
    1.30  
    1.31                      try {
    1.32                          // attach the file
     2.1 --- a/src/de/joergjahnke/c64/android/AttachImageDialog.java	Tue Nov 03 20:22:09 2009 +0100
     2.2 +++ b/src/de/joergjahnke/c64/android/AttachImageDialog.java	Tue Nov 03 20:22:19 2009 +0100
     2.3 @@ -12,7 +12,6 @@
     2.4   */
     2.5  public class AttachImageDialog extends FileDialog {
     2.6  
     2.7 -    @SuppressWarnings("unchecked")
     2.8      @Override
     2.9      public List<String> getAcceptedFileTypes() {
    2.10          final List<String> types = new ArrayList<String>();
     3.1 --- a/src/de/joergjahnke/common/android/FileDialog.java	Tue Nov 03 20:22:09 2009 +0100
     3.2 +++ b/src/de/joergjahnke/common/android/FileDialog.java	Tue Nov 03 20:22:19 2009 +0100
     3.3 @@ -25,6 +25,14 @@
     3.4  public abstract class FileDialog extends ListActivity {
     3.5  
     3.6      /**
     3.7 +     * property name in the extras bundle describing the directory initial displayed
     3.8 +     */
     3.9 +    public static final String PROPERTY_START_DIR = FileDialog.class.getName() + ".prgdir";
    3.10 +    /**
    3.11 +     * property name in the extras bundle describing the directory initial displayed
    3.12 +     */
    3.13 +    public static final String PROPERTY_SELECTED_FILE = FileDialog.class.getName() + ".currentFile";
    3.14 +    /**
    3.15       * text we use for the parent directory
    3.16       */
    3.17      private final static String PARENT_DIR = "..";
    3.18 @@ -43,7 +51,7 @@
    3.19  
    3.20          // go to the root directory
    3.21          try {
    3.22 -            showDirectory(getIntent().getStringExtra("de.joergjahnke.c64.android.prgdir"));
    3.23 +            showDirectory(getIntent().getStringExtra(PROPERTY_START_DIR));
    3.24          } catch (NullPointerException e) {
    3.25              showDirectory("/");
    3.26          }
    3.27 @@ -61,7 +69,7 @@
    3.28              } else {
    3.29                  final Intent extras = new Intent();
    3.30  
    3.31 -                extras.putExtra("de.joergjahnke.gameboy.android.currentFile", this.currentFiles.get(position));
    3.32 +                extras.putExtra(PROPERTY_SELECTED_FILE, this.currentFiles.get(position));
    3.33                  setResult(RESULT_OK, extras);
    3.34                  finish();
    3.35              }