Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d2b18178 authored by Fs00's avatar Fs00
Browse files

Improve and fix HTTP error message when PDF download fails

parent a8402092
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -63,13 +63,13 @@ public class DownloadPDFFile extends AsyncTask<String, Void, Object> {
        if (activity != null) {
            // Manage error
            if (result == null) {
                Toast.makeText(activity.getApplicationContext(), R.string.toast_io_exception, Toast.LENGTH_SHORT).show();
                Toast.makeText(activity, R.string.toast_io_exception, Toast.LENGTH_SHORT).show();
            } else if (result instanceof Integer) {
                Toast.makeText(activity.getApplicationContext(), R.string.toast_http_code_error + String.valueOf(result), Toast.LENGTH_SHORT).show();
                Toast.makeText(activity, R.string.toast_http_code_error, Toast.LENGTH_SHORT).show();
            } else if (result instanceof SSLException) {
                Toast.makeText(activity.getApplicationContext(), R.string.toast_ssl_error, Toast.LENGTH_SHORT).show();
                Toast.makeText(activity, R.string.toast_ssl_error, Toast.LENGTH_SHORT).show();
            } else if (result instanceof IOException) {
                Toast.makeText(activity.getApplicationContext(), R.string.toast_io_exception, Toast.LENGTH_SHORT).show();
                Toast.makeText(activity, R.string.toast_io_exception, Toast.LENGTH_SHORT).show();
            } else if (result instanceof File) {
                activity.saveFileAndDisplay((File) result);
            }
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@
    <string name="app_name" translatable="false">Pdf Viewer Plus</string>
    <string name="pick_file">Pick File</string>
    <string name="toast_pick_file_error">Unable to pick file. Check status of file manager.</string>
    <string name="toast_http_code_error">Problem loading page, http error code : </string>
    <string name="toast_http_code_error">Remote server responded with an error.</string>
    <string name="toast_io_exception">We can\'t load this page for some reason.</string>
    <string name="toast_ssl_error">Secure connection failed.</string>
    <string name="action_about">About</string>