summaryrefslogtreecommitdiff
path: root/src/de/danoeh/antennapod/activity
diff options
context:
space:
mode:
authordaniel oeh <daniel.oeh@gmail.com>2013-08-05 14:57:37 +0200
committerdaniel oeh <daniel.oeh@gmail.com>2013-08-05 14:57:37 +0200
commit75b13431fed4dbc4e259ead8a3762143be740432 (patch)
tree0107281d2021c326d3acb557b0ad1c1d36019d2e /src/de/danoeh/antennapod/activity
parent3f5e2faff941f220c7a882bfba4f86e85219d7ba (diff)
parent95148ace8e44df4fa3b8cc6b6afc83bed6be4d04 (diff)
downloadAntennaPod-75b13431fed4dbc4e259ead8a3762143be740432.zip
Merge branch 'develop' into feedmanager_removal
Conflicts: src/de/danoeh/antennapod/activity/PreferenceActivity.java src/de/danoeh/antennapod/feed/FeedManager.java src/de/danoeh/antennapod/service/PlaybackService.java src/de/danoeh/antennapod/service/download/DownloadService.java src/de/danoeh/antennapod/service/download/DownloadStatus.java src/de/danoeh/antennapod/service/download/HttpDownloader.java src/de/danoeh/antennapod/storage/DownloadRequester.java src/de/danoeh/antennapod/storage/PodDBAdapter.java src/de/danoeh/antennapod/util/playback/PlaybackController.java
Diffstat (limited to 'src/de/danoeh/antennapod/activity')
-rw-r--r--src/de/danoeh/antennapod/activity/AddFeedActivity.java17
-rw-r--r--src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java11
-rw-r--r--src/de/danoeh/antennapod/activity/PreferenceActivity.java48
3 files changed, 50 insertions, 26 deletions
diff --git a/src/de/danoeh/antennapod/activity/AddFeedActivity.java b/src/de/danoeh/antennapod/activity/AddFeedActivity.java
index 39434fa87..545b53494 100644
--- a/src/de/danoeh/antennapod/activity/AddFeedActivity.java
+++ b/src/de/danoeh/antennapod/activity/AddFeedActivity.java
@@ -2,6 +2,8 @@ package de.danoeh.antennapod.activity;
import java.util.Date;
+import org.apache.commons.lang3.StringUtils;
+
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
@@ -44,6 +46,9 @@ public class AddFeedActivity extends SherlockActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
+ if (AppConfig.DEBUG)
+ Log.d(TAG, "Was started with Intent " + getIntent().getAction()
+ + " and Data " + getIntent().getDataString());
setTheme(UserPreferences.getTheme());
super.onCreate(savedInstanceState);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
@@ -54,6 +59,10 @@ public class AddFeedActivity extends SherlockActivity {
progDialog = new ProgressDialog(this);
etxtFeedurl = (EditText) findViewById(R.id.etxtFeedurl);
+ if (StringUtils.equals(getIntent().getAction(), Intent.ACTION_VIEW)) {
+ etxtFeedurl.setText(getIntent().getDataString());
+ }
+
butBrowseMiroGuide = (Button) findViewById(R.id.butBrowseMiroguide);
butOpmlImport = (Button) findViewById(R.id.butOpmlImport);
butConfirm = (Button) findViewById(R.id.butConfirm);
@@ -101,7 +110,7 @@ public class AddFeedActivity extends SherlockActivity {
if (intent.getAction() != null
&& intent.getAction().equals(Intent.ACTION_SEND)) {
if (AppConfig.DEBUG)
- Log.d(TAG, "Was started with ACTION_SEND intent");
+ Log.d(TAG, "Resuming with ACTION_SEND intent");
String text = intent.getStringExtra(Intent.EXTRA_TEXT);
if (text != null) {
etxtFeedurl.setText(text);
@@ -152,7 +161,7 @@ public class AddFeedActivity extends SherlockActivity {
}
@Override
- public void onConnectionFailure(int reason) {
+ public void onConnectionFailure(DownloadError reason) {
handleDownloadError(reason);
}
});
@@ -168,11 +177,11 @@ public class AddFeedActivity extends SherlockActivity {
progDialog.setMessage(getString(R.string.loading_label));
}
- private void handleDownloadError(int reason) {
+ private void handleDownloadError(DownloadError reason) {
final AlertDialog errorDialog = new AlertDialog.Builder(this).create();
errorDialog.setTitle(R.string.error_label);
errorDialog.setMessage(getString(R.string.error_msg_prefix) + " "
- + DownloadError.getErrorString(this, reason));
+ + reason.getErrorString(this));
errorDialog.setButton(getString(android.R.string.ok),
new DialogInterface.OnClickListener() {
@Override
diff --git a/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java b/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java
index 50ff38e22..ce58babc0 100644
--- a/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java
+++ b/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java
@@ -89,9 +89,8 @@ public abstract class OnlineFeedViewActivity extends SherlockFragmentActivity {
if (status.isSuccessful()) {
parseFeed();
} else {
- String errorMsg = DownloadError.getErrorString(
- OnlineFeedViewActivity.this,
- status.getReason());
+ String errorMsg = status.getReason().getErrorString(
+ OnlineFeedViewActivity.this);
if (errorMsg != null
&& status.getReasonDetailed() != null) {
errorMsg += " ("
@@ -191,9 +190,9 @@ public abstract class OnlineFeedViewActivity extends SherlockFragmentActivity {
}
});
} else {
- final String errorMsg = DownloadError.getErrorString(
- OnlineFeedViewActivity.this,
- DownloadError.ERROR_PARSER_EXCEPTION)
+ final String errorMsg =
+ DownloadError.ERROR_PARSER_EXCEPTION.getErrorString(
+ OnlineFeedViewActivity.this)
+ " (" + reasonDetailed + ")";
runOnUiThread(new Runnable() {
diff --git a/src/de/danoeh/antennapod/activity/PreferenceActivity.java b/src/de/danoeh/antennapod/activity/PreferenceActivity.java
index 14d9c29cc..be5fc2c26 100644
--- a/src/de/danoeh/antennapod/activity/PreferenceActivity.java
+++ b/src/de/danoeh/antennapod/activity/PreferenceActivity.java
@@ -12,6 +12,7 @@ import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
+import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.Preference.OnPreferenceClickListener;
@@ -147,32 +148,47 @@ public class PreferenceActivity extends SherlockPreferenceActivity {
.setOnPreferenceChangeListener(
new OnPreferenceChangeListener() {
+
@Override
- public boolean onPreferenceChange(
- Preference preference, Object newValue) {
- if (newValue instanceof String) {
- setEpisodeCacheSizeText(Integer
- .valueOf((String) newValue));
- }
+ public boolean onPreferenceChange(Preference preference, Object o) {
+ checkItemVisibility();
return true;
}
});
- findPreference(UserPreferences.PREF_ENABLE_AUTODL)
- .setOnPreferenceClickListener(new OnPreferenceClickListener() {
-
- @Override
- public boolean onPreferenceClick(Preference preference) {
- checkItemVisibility();
- return true;
- }
- });
-
+ buildUpdateIntervalPreference();
buildAutodownloadSelectedNetworsPreference();
setSelectedNetworksEnabled(UserPreferences
.isEnableAutodownloadWifiFilter());
}
+ private void buildUpdateIntervalPreference() {
+ ListPreference pref = (ListPreference) findPreference(UserPreferences.PREF_UPDATE_INTERVAL);
+ String[] values = getResources().getStringArray(
+ R.array.update_intervall_values);
+ String[] entries = new String[values.length];
+ for (int x = 0; x < values.length; x++) {
+ Integer v = Integer.parseInt(values[x]);
+ switch (v) {
+ case 0:
+ entries[x] = getString(R.string.pref_update_interval_hours_manual);
+ break;
+ case 1:
+ entries[x] = v
+ + " "
+ + getString(R.string.pref_update_interval_hours_singular);
+ break;
+ default:
+ entries[x] = v + " "
+ + getString(R.string.pref_update_interval_hours_plural);
+ break;
+
+ }
+ }
+ pref.setEntries(entries);
+
+ }
+
private void setSelectedNetworksEnabled(boolean b) {
if (selectedNetworks != null) {
for (Preference p : selectedNetworks) {