Merge: develop changes

This commit is contained in:
Negue 2015-06-27 20:25:58 +02:00
commit 1ccdf9852e
3 changed files with 34 additions and 4 deletions

View file

@ -112,6 +112,9 @@
<string name="about.title">About</string>
<string name="about.changelog">Changelog</string>
<!-- Network Errors -->
<string name="network_error_title">Connection Error</string>
<string name="network_error_no_network_body">You are not connected to the internet.</string>
<string name="checklist.title.add">Add checklist</string>
<string name="checklist.title.edit">Edit checklist</string>

View file

@ -1,6 +1,9 @@
package com.habitrpg.android.habitica;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.View;
@ -204,15 +207,30 @@ public class APIHelper implements ErrorHandler, Profiler {
@Override
public Throwable handleError(RetrofitError cause) {
//String json = new String(((TypedByteArray)cause.getResponse().getBody()).getBytes());
//Log.v("failure", json.toString());
retrofit.client.Response res = cause.getResponse();
retrofit.mime.TypedInput body = res.getBody();
if (res != null) {
retrofit.mime.TypedInput body = res.getBody();
}
if (cause.isNetworkError()) {
final Activity activity = (Activity) this.mContext;
activity.runOnUiThread(new Runnable() {
public void run() {
new AlertDialog.Builder(activity)
.setTitle(R.string.network_error_title)
.setMessage(R.string.network_error_no_network_body)
.setNeutralButton(android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
}
})
.setIcon(android.R.drawable.ic_dialog_alert)
.show();
}
});
//JsonSyntaxException d = (JsonSyntaxException)cause;
}
return cause;
}

View file

@ -50,6 +50,15 @@ public class TagsAdapter extends TypeAdapter<Tags>{
case END_OBJECT:
in.endObject();
isClosed=true;
break;
case BEGIN_ARRAY:
in.beginArray();
break;
case END_ARRAY:
in.endArray();
isClosed = true;
break;
default:
}
} while(!isClosed);