Update error messages and remove the unknown error text
This commit is contained in:
parent
c7b8cc72fc
commit
629e65edba
|
@ -32,23 +32,35 @@ public class MastodonErrorResponse extends ErrorResponse{
|
||||||
this.messageResource=R.string.connection_timed_out;
|
this.messageResource=R.string.connection_timed_out;
|
||||||
}else if(exception instanceof JsonSyntaxException || exception instanceof JsonIOException || httpStatus>=500){
|
}else if(exception instanceof JsonSyntaxException || exception instanceof JsonIOException || httpStatus>=500){
|
||||||
this.messageResource=R.string.server_error;
|
this.messageResource=R.string.server_error;
|
||||||
}else if(httpStatus == 404){
|
}else if(httpStatus==404){
|
||||||
this.messageResource=R.string.not_found;
|
this.messageResource=R.string.not_found;
|
||||||
}else{
|
}else{
|
||||||
this.messageResource=R.string.unknown_error;
|
this.messageResource=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bindErrorView(View view){
|
public void bindErrorView(View view){
|
||||||
TextView text=view.findViewById(R.id.error_text);
|
TextView text=view.findViewById(R.id.error_text);
|
||||||
text.setText(view.getContext().getString(messageResource, error));
|
String message;
|
||||||
|
if(messageResource>0){
|
||||||
|
message=view.getContext().getString(messageResource, error);
|
||||||
|
}else{
|
||||||
|
message=error;
|
||||||
|
}
|
||||||
|
text.setText(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showToast(Context context){
|
public void showToast(Context context){
|
||||||
if(context==null)
|
if(context==null)
|
||||||
return;
|
return;
|
||||||
Toast.makeText(context, context.getString(messageResource, error), Toast.LENGTH_SHORT).show();
|
String message;
|
||||||
|
if(messageResource>0){
|
||||||
|
message=context.getString(messageResource, error);
|
||||||
|
}else{
|
||||||
|
message=error;
|
||||||
|
}
|
||||||
|
Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -755,9 +755,8 @@
|
||||||
<string name="view_favorites">View favorites</string>
|
<string name="view_favorites">View favorites</string>
|
||||||
<string name="undo_reblog">Undo boost</string>
|
<string name="undo_reblog">Undo boost</string>
|
||||||
<string name="undo_favorite">Undo favorite</string>
|
<string name="undo_favorite">Undo favorite</string>
|
||||||
<string name="could_not_reach_server">Could not reach the server. Make sure you\'re connected to the internet and try again.</string>
|
<string name="could_not_reach_server">Couldn’t reach the server. Check your connection and try again?</string>
|
||||||
<string name="connection_timed_out">Connection timed out. Make sure you\'re connected to the internet and try again.</string>
|
<string name="connection_timed_out">The request timed out. Check your connection and try again?</string>
|
||||||
<string name="server_error">There may be a problem with your instance or your internet. Make sure you have access to the internet and try again.</string>
|
<string name="server_error">Something went wrong talking with your server. It’s probably not your fault. Try again?</string>
|
||||||
<string name="not_found">Not found. It probably doesn\'t exist anymore.</string>
|
<string name="not_found">It could’ve been deleted, or maybe it never existed at all.</string>
|
||||||
<string name="unknown_error">Unknown error: %s</string>
|
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue