diff --git a/app/src/main/java/org/openlp/android2/common/OpenLPDialog.java b/app/src/main/java/org/openlp/android2/common/OpenLPDialog.java index 58877c5..560a272 100644 --- a/app/src/main/java/org/openlp/android2/common/OpenLPDialog.java +++ b/app/src/main/java/org/openlp/android2/common/OpenLPDialog.java @@ -22,9 +22,11 @@ package org.openlp.android2.common; import android.app.DialogFragment; import android.content.Context; import android.util.Log; +import android.widget.Toast; import com.loopj.android.http.AsyncHttpClient; import com.loopj.android.http.TextHttpResponseHandler; import org.apache.http.Header; +import org.openlp.android2.R; import org.openlp.android2.api.Api; @@ -38,7 +40,7 @@ abstract public class OpenLPDialog extends DialogFragment { private static AsyncHttpClient client = new AsyncHttpClient(); protected void populateDisplay(String responseString) {} - protected void processUpdate(String responseString) {} + protected void processUpdate(String responseString) {} protected void errorDisplay(int statusCode, String responseString) {} protected void triggerTextRequest(String url) { @@ -54,6 +56,11 @@ abstract public class OpenLPDialog extends DialogFragment { @Override public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) { // called when response HTTP status is "4XX" (eg. 401, 403, 404) + if (statusCode == 401) { + Toast.makeText(context, R.string.httpreturn_unauthorised, Toast.LENGTH_LONG).show(); + } else { + Toast.makeText(context, R.string.unable, Toast.LENGTH_LONG).show(); + } errorDisplay(statusCode, responseString); } }); diff --git a/app/src/main/java/org/openlp/android2/dialogs/AlertDisplayDialog.java b/app/src/main/java/org/openlp/android2/dialogs/AlertDisplayDialog.java index 6698bd4..0933ddd 100644 --- a/app/src/main/java/org/openlp/android2/dialogs/AlertDisplayDialog.java +++ b/app/src/main/java/org/openlp/android2/dialogs/AlertDisplayDialog.java @@ -96,8 +96,8 @@ public class AlertDisplayDialog extends OpenLPDialog { } private void triggerRequest(String url) { - ExecuteHttpRequestTask task = new ExecuteHttpRequestTask(); - task.execute(new String[]{url}); + //ExecuteHttpRequestTask task = new ExecuteHttpRequestTask(); + //task.execute(new String[]{url}); } public void populateDisplay(OpenLPHttpReturn response) { diff --git a/app/src/main/java/org/openlp/android2/dialogs/BlankDisplayDialog.java b/app/src/main/java/org/openlp/android2/dialogs/BlankDisplayDialog.java index c3ae01e..6fe85ed 100644 --- a/app/src/main/java/org/openlp/android2/dialogs/BlankDisplayDialog.java +++ b/app/src/main/java/org/openlp/android2/dialogs/BlankDisplayDialog.java @@ -153,6 +153,5 @@ public class BlankDisplayDialog extends OpenLPDialog { theme.setEnabled(false); desktop.setEnabled(false); reset.setEnabled(false); - Toast.makeText(context, R.string.unable, Toast.LENGTH_LONG).show(); } }