Merge pull request #6200 from ByteHamster/detailed-error-message
Show human readable error message on details dialog
This commit is contained in:
commit
bc3b717911
|
@ -8,6 +8,7 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
|
import de.danoeh.antennapod.core.util.DownloadErrorLabel;
|
||||||
import de.danoeh.antennapod.model.download.DownloadStatus;
|
import de.danoeh.antennapod.model.download.DownloadStatus;
|
||||||
import de.danoeh.antennapod.core.storage.DBReader;
|
import de.danoeh.antennapod.core.storage.DBReader;
|
||||||
import de.danoeh.antennapod.event.MessageEvent;
|
import de.danoeh.antennapod.event.MessageEvent;
|
||||||
|
@ -21,7 +22,6 @@ public class DownloadLogDetailsDialog extends MaterialAlertDialogBuilder {
|
||||||
super(context);
|
super(context);
|
||||||
|
|
||||||
String url = "unknown";
|
String url = "unknown";
|
||||||
String message = context.getString(R.string.download_successful);
|
|
||||||
if (status.getFeedfileType() == FeedMedia.FEEDFILETYPE_FEEDMEDIA) {
|
if (status.getFeedfileType() == FeedMedia.FEEDFILETYPE_FEEDMEDIA) {
|
||||||
FeedMedia media = DBReader.getFeedMedia(status.getFeedfileId());
|
FeedMedia media = DBReader.getFeedMedia(status.getFeedfileId());
|
||||||
if (media != null) {
|
if (media != null) {
|
||||||
|
@ -34,11 +34,13 @@ public class DownloadLogDetailsDialog extends MaterialAlertDialogBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String message = context.getString(R.string.download_successful);
|
||||||
if (!status.isSuccessful()) {
|
if (!status.isSuccessful()) {
|
||||||
message = status.getReasonDetailed();
|
message = status.getReasonDetailed();
|
||||||
}
|
}
|
||||||
|
|
||||||
String messageFull = context.getString(R.string.download_error_details_message, message, url);
|
String messageFull = context.getString(R.string.download_log_details_message,
|
||||||
|
context.getString(DownloadErrorLabel.from(status.getReason())), message, url);
|
||||||
setTitle(R.string.download_error_details);
|
setTitle(R.string.download_error_details);
|
||||||
setMessage(messageFull);
|
setMessage(messageFull);
|
||||||
setPositiveButton(android.R.string.ok, null);
|
setPositiveButton(android.R.string.ok, null);
|
||||||
|
|
|
@ -256,7 +256,7 @@
|
||||||
<string name="download_pending">Download pending</string>
|
<string name="download_pending">Download pending</string>
|
||||||
<string name="download_running">Download running</string>
|
<string name="download_running">Download running</string>
|
||||||
<string name="download_error_details">Details</string>
|
<string name="download_error_details">Details</string>
|
||||||
<string name="download_error_details_message">%1$s \n\nFile URL:\n%2$s</string>
|
<string name="download_log_details_message">%1$s \n\nTechnical reason: \n%2$s \n\nFile URL:\n%3$s</string>
|
||||||
<string name="download_error_tap_for_details">Tap to view details.</string>
|
<string name="download_error_tap_for_details">Tap to view details.</string>
|
||||||
<string name="download_error_device_not_found">Storage Device not found</string>
|
<string name="download_error_device_not_found">Storage Device not found</string>
|
||||||
<string name="download_error_insufficient_space">There is not enough space left on your device.</string>
|
<string name="download_error_insufficient_space">There is not enough space left on your device.</string>
|
||||||
|
|
Loading…
Reference in New Issue