Described download errors in more detail
This commit is contained in:
parent
352df348cb
commit
d4141d19a0
@ -68,16 +68,14 @@ public class DownloadLogAdapter extends BaseAdapter {
|
||||
holder.icon.setContentDescription(context.getString(R.string.download_successful));
|
||||
holder.secondaryActionButton.setVisibility(View.INVISIBLE);
|
||||
holder.reason.setVisibility(View.GONE);
|
||||
holder.tapForDetails.setVisibility(View.GONE);
|
||||
} else {
|
||||
holder.icon.setTextColor(ContextCompat.getColor(context, R.color.download_failed_red));
|
||||
holder.icon.setText("{fa-times-circle}");
|
||||
holder.icon.setContentDescription(context.getString(R.string.error_label));
|
||||
String reasonText = status.getReason().getErrorString(context);
|
||||
if (status.getReasonDetailed() != null) {
|
||||
reasonText += ": " + status.getReasonDetailed();
|
||||
}
|
||||
holder.reason.setText(reasonText);
|
||||
holder.reason.setText(status.getReason().getErrorString(context));
|
||||
holder.reason.setVisibility(View.VISIBLE);
|
||||
holder.tapForDetails.setVisibility(View.VISIBLE);
|
||||
|
||||
if (newerWasSuccessful(position, status.getFeedfileType(), status.getFeedfileId())) {
|
||||
holder.secondaryActionButton.setVisibility(View.INVISIBLE);
|
||||
|
@ -20,6 +20,7 @@ public class DownloadItemViewHolder extends RecyclerView.ViewHolder {
|
||||
public final TextView type;
|
||||
public final TextView date;
|
||||
public final TextView reason;
|
||||
public final TextView tapForDetails;
|
||||
|
||||
public DownloadItemViewHolder(Context context, ViewGroup parent) {
|
||||
super(LayoutInflater.from(context).inflate(R.layout.downloadlog_item, parent, false));
|
||||
@ -27,6 +28,7 @@ public class DownloadItemViewHolder extends RecyclerView.ViewHolder {
|
||||
type = itemView.findViewById(R.id.txtvType);
|
||||
icon = itemView.findViewById(R.id.txtvIcon);
|
||||
reason = itemView.findViewById(R.id.txtvReason);
|
||||
tapForDetails = itemView.findViewById(R.id.txtvTapForDetails);
|
||||
secondaryActionButton = itemView.findViewById(R.id.secondaryActionButton);
|
||||
secondaryActionIcon = itemView.findViewById(R.id.secondaryActionIcon);
|
||||
title = itemView.findViewById(R.id.txtvTitle);
|
||||
|
@ -83,6 +83,14 @@
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
tools:text="@string/design_time_downloaded_log_failure_reason"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtvTapForDetails"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:text="@string/download_error_tap_for_details"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/secondary_action"/>
|
||||
|
@ -137,6 +137,9 @@ public class HttpDownloader extends Downloader {
|
||||
} else if (response.code() == HttpURLConnection.HTTP_FORBIDDEN) {
|
||||
error = DownloadError.ERROR_FORBIDDEN;
|
||||
details = String.valueOf(response.code());
|
||||
} else if (response.code() == HttpURLConnection.HTTP_NOT_FOUND) {
|
||||
error = DownloadError.ERROR_NOT_FOUND;
|
||||
details = String.valueOf(response.code());
|
||||
} else {
|
||||
error = DownloadError.ERROR_HTTP_DATA_ERROR;
|
||||
details = String.valueOf(response.code());
|
||||
|
@ -58,6 +58,9 @@ public class FeedParserTask implements Callable<FeedHandlerResult> {
|
||||
e.printStackTrace();
|
||||
successful = false;
|
||||
reason = DownloadError.ERROR_UNSUPPORTED_TYPE;
|
||||
if ("html".equalsIgnoreCase(e.getRootElement())) {
|
||||
reason = DownloadError.ERROR_UNSUPPORTED_TYPE_HTML;
|
||||
}
|
||||
reasonDetailed = e.getMessage();
|
||||
} catch (InvalidFeedException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -36,9 +36,6 @@ public class UnsupportedFeedtypeException extends Exception {
|
||||
if (message != null) {
|
||||
return message;
|
||||
} else if (type == TypeGetter.Type.INVALID) {
|
||||
if ("html".equals(rootElement)) {
|
||||
return "The server returned a website, not a podcast feed";
|
||||
}
|
||||
return "Invalid type";
|
||||
} else {
|
||||
return "Type " + type + " not supported";
|
||||
|
@ -13,7 +13,7 @@ public enum DownloadError {
|
||||
ERROR_MALFORMED_URL(4, R.string.download_error_error_unknown),
|
||||
ERROR_IO_ERROR(5, R.string.download_error_io_error),
|
||||
ERROR_FILE_EXISTS(6, R.string.download_error_error_unknown),
|
||||
ERROR_DOWNLOAD_CANCELLED(7, R.string.download_error_error_unknown),
|
||||
ERROR_DOWNLOAD_CANCELLED(7, R.string.download_canceled_msg),
|
||||
ERROR_DEVICE_NOT_FOUND(8, R.string.download_error_device_not_found),
|
||||
ERROR_HTTP_DATA_ERROR(9, R.string.download_error_http_data_error),
|
||||
ERROR_NOT_ENOUGH_SPACE(10, R.string.download_error_insufficient_space),
|
||||
@ -23,8 +23,10 @@ public enum DownloadError {
|
||||
ERROR_UNAUTHORIZED(14, R.string.download_error_unauthorized),
|
||||
ERROR_FILE_TYPE(15, R.string.download_error_file_type_type),
|
||||
ERROR_FORBIDDEN(16, R.string.download_error_forbidden),
|
||||
ERROR_IO_WRONG_SIZE(17, R.string.download_wrong_size),
|
||||
ERROR_IO_BLOCKED(18, R.string.download_blocked);
|
||||
ERROR_IO_WRONG_SIZE(17, R.string.download_error_wrong_size),
|
||||
ERROR_IO_BLOCKED(18, R.string.download_error_blocked),
|
||||
ERROR_UNSUPPORTED_TYPE_HTML(19, R.string.download_error_unsupported_type_html),
|
||||
ERROR_NOT_FOUND(20, R.string.download_error_not_found);
|
||||
|
||||
private final int code;
|
||||
private final int resId;
|
||||
|
@ -179,7 +179,7 @@
|
||||
<string name="hide_not_queued_episodes_label">Not queued</string>
|
||||
<string name="hide_has_media_label">Has media</string>
|
||||
<string name="filtered_label">Filtered</string>
|
||||
<string name="refresh_failed_msg">{fa-exclamation-circle} Last Refresh failed</string>
|
||||
<string name="refresh_failed_msg">{fa-exclamation-circle} Last Refresh failed. Tap to view details.</string>
|
||||
<string name="open_podcast">Open Podcast</string>
|
||||
<string name="please_wait_for_data">Please wait until the data is loaded</string>
|
||||
|
||||
@ -245,20 +245,23 @@
|
||||
<string name="download_running">Download running</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_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_insufficient_space">Insufficient Space</string>
|
||||
<string name="download_error_insufficient_space">There is not enough space left on your device.</string>
|
||||
<string name="download_error_http_data_error">HTTP Data Error</string>
|
||||
<string name="download_error_error_unknown">Unknown Error</string>
|
||||
<string name="download_error_parser_exception">Parser Exception</string>
|
||||
<string name="download_error_parser_exception">The podcast host\'s server sent a broken podcast feed.</string>
|
||||
<string name="download_error_unsupported_type">Unsupported Feed Type</string>
|
||||
<string name="download_error_unsupported_type_html">The podcast host\'s server sent a website, not a podcast.</string>
|
||||
<string name="download_error_not_found">The podcast host\'s server does not know where to find the file. It may have been deleted.</string>
|
||||
<string name="download_error_connection_error">Connection Error</string>
|
||||
<string name="download_error_unknown_host">Unknown Host</string>
|
||||
<string name="download_error_unauthorized">Authentication Error</string>
|
||||
<string name="download_error_file_type_type">File Type Error</string>
|
||||
<string name="download_error_forbidden">Forbidden</string>
|
||||
<string name="download_error_forbidden">The podcast host\'s server refuses to respond.</string>
|
||||
<string name="download_canceled_msg">Download canceled</string>
|
||||
<string name="download_wrong_size">The server connection was lost before completing the download</string>
|
||||
<string name="download_blocked">The download was blocked by another app on your device</string>
|
||||
<string name="download_error_wrong_size">The server connection was lost before completing the download</string>
|
||||
<string name="download_error_blocked">The download was blocked by another app on your device.</string>
|
||||
<string name="download_canceled_autodownload_enabled_msg">Download canceled\nDisabled <i>Auto Download</i> for this item</string>
|
||||
<string name="download_report_title">Downloads completed with error(s)</string>
|
||||
<string name="auto_download_report_title">Auto-downloads completed</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user