diff options
Diffstat (limited to 'src/de/danoeh')
4 files changed, 43 insertions, 17 deletions
diff --git a/src/de/danoeh/antennapod/activity/AddFeedActivity.java b/src/de/danoeh/antennapod/activity/AddFeedActivity.java index c12ca4088..5d39659b6 100644 --- a/src/de/danoeh/antennapod/activity/AddFeedActivity.java +++ b/src/de/danoeh/antennapod/activity/AddFeedActivity.java @@ -35,6 +35,7 @@ public class AddFeedActivity extends SherlockActivity { private EditText etxtFeedurl; private Button butBrowseMiroGuide; + private Button butOpmlImport; private Button butConfirm; private Button butCancel; @@ -52,6 +53,7 @@ public class AddFeedActivity extends SherlockActivity { etxtFeedurl = (EditText) findViewById(R.id.etxtFeedurl); butBrowseMiroGuide = (Button) findViewById(R.id.butBrowseMiroguide); + butOpmlImport = (Button) findViewById(R.id.butOpmlImport); butConfirm = (Button) findViewById(R.id.butConfirm); butCancel = (Button) findViewById(R.id.butCancel); @@ -64,6 +66,15 @@ public class AddFeedActivity extends SherlockActivity { } }); + butOpmlImport.setOnClickListener(new OnClickListener() { + + @Override + public void onClick(View v) { + startActivity(new Intent(AddFeedActivity.this, + OpmlImportActivity.class)); + } + }); + butConfirm.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -125,7 +136,8 @@ public class AddFeedActivity extends SherlockActivity { @Override public void onConnectionSuccessful() { try { - requester.downloadFeed(AddFeedActivity.this, feed); + requester.downloadFeed(AddFeedActivity.this, + feed); if (progDialog.isShowing()) { progDialog.dismiss(); finish(); @@ -134,7 +146,7 @@ public class AddFeedActivity extends SherlockActivity { e.printStackTrace(); onConnectionFailure(DownloadError.ERROR_REQUEST_ERROR); } - + } @Override @@ -159,12 +171,13 @@ public class AddFeedActivity extends SherlockActivity { errorDialog.setTitle(R.string.error_label); errorDialog.setMessage(getString(R.string.error_msg_prefix) + " " + DownloadError.getErrorString(this, reason)); - errorDialog.setButton(getString(android.R.string.ok), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - errorDialog.dismiss(); - } - }); + errorDialog.setButton(getString(android.R.string.ok), + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + errorDialog.dismiss(); + } + }); if (progDialog.isShowing()) { progDialog.dismiss(); } @@ -181,7 +194,8 @@ public class AddFeedActivity extends SherlockActivity { switch (item.getItemId()) { case android.R.id.home: Intent intent = new Intent(this, MainActivity.class); - intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP + | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); return true; default: diff --git a/src/de/danoeh/antennapod/activity/MainActivity.java b/src/de/danoeh/antennapod/activity/MainActivity.java index b5f89b882..19ab9ecd3 100644 --- a/src/de/danoeh/antennapod/activity/MainActivity.java +++ b/src/de/danoeh/antennapod/activity/MainActivity.java @@ -118,12 +118,6 @@ public class MainActivity extends SherlockFragmentActivity { case R.id.show_player: startActivity(PlaybackService.getPlayerActivityIntent(this)); return true; - case R.id.opml_import: - startActivity(new Intent(this, OpmlImportActivity.class)); - return true; - case R.id.opml_export: - new OpmlExportWorker(this).executeAsync(); - return false; case R.id.search_item: onSearchRequested(); return true; @@ -146,7 +140,6 @@ public class MainActivity extends SherlockFragmentActivity { } boolean hasFeeds = !manager.getFeeds().isEmpty(); - menu.findItem(R.id.opml_export).setVisible(hasFeeds); menu.findItem(R.id.all_feed_refresh).setVisible(hasFeeds); return true; } diff --git a/src/de/danoeh/antennapod/activity/OpmlImportActivity.java b/src/de/danoeh/antennapod/activity/OpmlImportActivity.java index 6b59f9195..74b59cc72 100644 --- a/src/de/danoeh/antennapod/activity/OpmlImportActivity.java +++ b/src/de/danoeh/antennapod/activity/OpmlImportActivity.java @@ -208,7 +208,10 @@ public class OpmlImportActivity extends SherlockActivity { @Override protected void onPostExecute(Void result) { super.onPostExecute(result); - finish(); + Intent intent = new Intent(OpmlImportActivity.this, MainActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP + | Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); } }; diff --git a/src/de/danoeh/antennapod/activity/PreferenceActivity.java b/src/de/danoeh/antennapod/activity/PreferenceActivity.java index 9378f175c..78d865da5 100644 --- a/src/de/danoeh/antennapod/activity/PreferenceActivity.java +++ b/src/de/danoeh/antennapod/activity/PreferenceActivity.java @@ -11,6 +11,8 @@ import com.actionbarsherlock.view.MenuItem; import de.danoeh.antennapod.R; import de.danoeh.antennapod.asynctask.FlattrClickWorker; +import de.danoeh.antennapod.asynctask.OpmlExportWorker; +import de.danoeh.antennapod.feed.FeedManager; import de.danoeh.antennapod.util.flattr.FlattrUtils; /** The main preference activity */ @@ -20,6 +22,7 @@ public class PreferenceActivity extends SherlockPreferenceActivity { private static final String PREF_FLATTR_THIS_APP = "prefFlattrThisApp"; private static final String PREF_FLATTR_AUTH = "pref_flattr_authenticate"; private static final String PREF_FLATTR_REVOKE = "prefRevokeAccess"; + private static final String PREF_OPML_EXPORT = "prefOpmlExport"; private static final String PREF_ABOUT = "prefAbout"; @SuppressWarnings("deprecation") @@ -64,6 +67,19 @@ public class PreferenceActivity extends SherlockPreferenceActivity { }); + findPreference(PREF_OPML_EXPORT).setOnPreferenceClickListener( + new OnPreferenceClickListener() { + + @Override + public boolean onPreferenceClick(Preference preference) { + if (!FeedManager.getInstance().getFeeds().isEmpty()) { + new OpmlExportWorker(PreferenceActivity.this) + .executeAsync(); + } + return true; + } + }); + } @Override |