diff --git a/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java index bd2c7f9a6..c6f2cc84b 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java @@ -8,7 +8,10 @@ import android.content.SharedPreferences; import android.graphics.LightingColorFilter; import android.os.Build; import android.os.Bundle; +import android.text.Spannable; +import android.text.SpannableString; import android.text.TextUtils; +import android.text.style.ForegroundColorSpan; import android.util.Log; import android.view.MenuItem; import android.view.View; @@ -288,11 +291,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity { dialog.show(); } } else { - String errorMsg = status.getReason().getErrorString(OnlineFeedViewActivity.this); - if (status.getReasonDetailed() != null) { - errorMsg += " (" + status.getReasonDetailed() + ")"; - } - showErrorDialog(errorMsg); + showErrorDialog(status.getReason().getErrorString(OnlineFeedViewActivity.this), status.getReasonDetailed()); } } @@ -324,18 +323,17 @@ public class OnlineFeedViewActivity extends AppCompatActivity { parser = Observable.fromCallable(this::doParseFeed) .subscribeOn(Schedulers.computation()) .observeOn(AndroidSchedulers.mainThread()) - .subscribe(optionalResult -> { - if(optionalResult.isPresent()) { - FeedHandlerResult result = optionalResult.get(); - beforeShowFeedInformation(result.feed); - showFeedInformation(result.feed, result.alternateFeedUrls); - } - }, error -> { - String errorMsg = DownloadError.ERROR_PARSER_EXCEPTION.getErrorString( - OnlineFeedViewActivity.this) + " (" + error.getMessage() + ")"; - showErrorDialog(errorMsg); - Log.d(TAG, "Feed parser exception: " + Log.getStackTraceString(error)); - }); + .subscribe( + optionalResult -> { + if (optionalResult.isPresent()) { + FeedHandlerResult result = optionalResult.get(); + beforeShowFeedInformation(result.feed); + showFeedInformation(result.feed, result.alternateFeedUrls); + } + }, error -> { + showErrorDialog(error.getMessage(), ""); + Log.d(TAG, "Feed parser exception: " + Log.getStackTraceString(error)); + }); } @NonNull @@ -350,8 +348,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity { if (dialogShown) { return Optional.empty(); } else { - Log.d(TAG, "Supplied feed is an HTML web page that has no references to any feed"); - throw e; + throw new UnsupportedFeedtypeException(getString(R.string.download_error_unsupported_type_html)); } } else { throw e; @@ -570,12 +567,16 @@ public class OnlineFeedViewActivity extends AppCompatActivity { } @UiThread - private void showErrorDialog(String errorMsg) { + private void showErrorDialog(String errorMsg, String details) { if (!isFinishing() && !isPaused) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.error_label); if (errorMsg != null) { - builder.setMessage(errorMsg); + String total = errorMsg + "\n\n" + details; + SpannableString errorMessage = new SpannableString(total); + errorMessage.setSpan(new ForegroundColorSpan(0x88888888), + errorMsg.length(), total.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + builder.setMessage(errorMessage); } else { builder.setMessage(R.string.download_error_error_unknown); } diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index 8bdd735f2..c29a24ead 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -255,7 +255,7 @@ The podcast host\'s server sent a website, not a podcast. The podcast host\'s server does not know where to find the file. It may have been deleted. Connection Error - Unknown Host + Cannot find the server. Check if the address is typed correctly and if you have a working network connection. Authentication Error File Type Error The podcast host\'s server refuses to respond.