diff options
Diffstat (limited to 'app/src/main/java/de/danoeh')
3 files changed, 24 insertions, 11 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/DirectoryChooserActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/DirectoryChooserActivity.java index 303af3334..fcd2680fa 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/DirectoryChooserActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/DirectoryChooserActivity.java @@ -5,7 +5,6 @@ import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; -import android.os.Environment; import android.os.FileObserver; import android.support.v4.app.NavUtils; import android.support.v7.app.ActionBarActivity; @@ -158,7 +157,7 @@ public class DirectoryChooserActivity extends ActionBarActivity { listDirectoriesAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, filenames); listDirectories.setAdapter(listDirectoriesAdapter); - changeDirectory(Environment.getExternalStorageDirectory()); + changeDirectory(UserPreferences.getDataFolder(this, null)); } /** diff --git a/app/src/main/java/de/danoeh/antennapod/asynctask/OpmlExportWorker.java b/app/src/main/java/de/danoeh/antennapod/asynctask/OpmlExportWorker.java index 6bba956a6..68e144b40 100644 --- a/app/src/main/java/de/danoeh/antennapod/asynctask/OpmlExportWorker.java +++ b/app/src/main/java/de/danoeh/antennapod/asynctask/OpmlExportWorker.java @@ -24,10 +24,10 @@ import de.danoeh.antennapod.core.util.LangUtils; */ public class OpmlExportWorker extends AsyncTask<Void, Void, Void> { private static final String TAG = "OpmlExportWorker"; - private static final String DEFAULT_OUTPUT_NAME = "antennapod-feeds.opml"; + public static final String DEFAULT_OUTPUT_NAME = "antennapod-feeds.opml"; public static final String EXPORT_DIR = "export/"; - private Context context; + private final Context context; private File output; private ProgressDialog progDialog; diff --git a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java index a8636874d..b608a0919 100644 --- a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java +++ b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java @@ -61,6 +61,8 @@ public class PreferenceController { public static final String PREF_EXPANDED_NOTIFICATION = "prefExpandNotify"; private static final String PREF_PERSISTENT_NOTIFICATION = "prefPersistNotify"; + private static final int REQUEST_CHOOSE_DATA_DIR = 1; + private static final int REQUEST_CHOOSE_OMPL_EXPORT_DIR = 2; private final PreferenceUI ui; @@ -150,9 +152,12 @@ public class PreferenceController { @Override public boolean onPreferenceClick(Preference preference) { - new OpmlExportWorker(activity) - .executeAsync(); - + Intent intent = new Intent(activity, + DirectoryChooserActivity.class); + intent.putExtra(DirectoryChooserActivity.NON_EMPTY_DIRECTORY_WARNING, false); + activity.startActivityForResult(intent, + REQUEST_CHOOSE_OMPL_EXPORT_DIR + ); return true; } } @@ -167,7 +172,7 @@ public class PreferenceController { DirectoryChooserActivity.class); intent.putExtra(DirectoryChooserActivity.NON_EMPTY_DIRECTORY_WARNING, true); activity.startActivityForResult(intent, - DirectoryChooserActivity.RESULT_CODE_DIR_SELECTED + REQUEST_CHOOSE_DATA_DIR ); return true; } @@ -312,9 +317,18 @@ public class PreferenceController { if (resultCode == DirectoryChooserActivity.RESULT_CODE_DIR_SELECTED) { String dir = data .getStringExtra(DirectoryChooserActivity.RESULT_SELECTED_DIR); - if (BuildConfig.DEBUG) - Log.d(TAG, "Setting data folder"); - UserPreferences.setDataFolder(dir); + switch(requestCode) { + case REQUEST_CHOOSE_DATA_DIR: + if (BuildConfig.DEBUG) + Log.d(TAG, "Setting data folder"); + UserPreferences.setDataFolder(dir); + break; + case REQUEST_CHOOSE_OMPL_EXPORT_DIR: + File path = new File(dir, OpmlExportWorker.DEFAULT_OUTPUT_NAME); + new OpmlExportWorker(ui.getActivity(), path) + .executeAsync(); + break; + } } } |