Some fixes in API
This commit is contained in:
parent
0f821c8f78
commit
7ddf7f7e1e
|
@ -1785,7 +1785,9 @@ public class GNUAPI {
|
|||
status.setSpoiler_text(null);
|
||||
status.setVisibility("public");
|
||||
status.setLanguage(resobj.isNull("geo")?null:resobj.getString("geo"));
|
||||
if( resobj.has("external_url"))
|
||||
status.setUrl(resobj.get("external_url").toString());
|
||||
|
||||
//Retrieves attachments
|
||||
|
||||
try {
|
||||
|
@ -1798,9 +1800,10 @@ public class GNUAPI {
|
|||
|
||||
//Retrieves mentions
|
||||
List<Mention> mentions = new ArrayList<>();
|
||||
if( resobj.has("attentions")) {
|
||||
JSONArray arrayMention = resobj.getJSONArray("attentions");
|
||||
if( arrayMention != null){
|
||||
for(int j = 0 ; j < arrayMention.length() ; j++){
|
||||
if (arrayMention != null) {
|
||||
for (int j = 0; j < arrayMention.length(); j++) {
|
||||
JSONObject menObj = arrayMention.getJSONObject(j);
|
||||
Mention mention = new Mention();
|
||||
mention.setId(menObj.get("id").toString());
|
||||
|
@ -1811,6 +1814,9 @@ public class GNUAPI {
|
|||
}
|
||||
}
|
||||
status.setMentions(mentions);
|
||||
}else{
|
||||
status.setMentions(new ArrayList<>());
|
||||
}
|
||||
//Retrieves tags
|
||||
status.setTags(null);
|
||||
//Retrieves emjis
|
||||
|
@ -1825,11 +1831,18 @@ public class GNUAPI {
|
|||
}catch (Exception e){
|
||||
application = new Application();
|
||||
}
|
||||
Log.v(Helper.TAG,resobj.toString());
|
||||
status.setApplication(application);
|
||||
status.setAccount(parseAccountResponse(context, resobj.getJSONObject("user")));
|
||||
status.setContent(resobj.get("statusnet_html").toString());
|
||||
if(resobj.has("fave_num"))
|
||||
status.setFavourites_count(Integer.valueOf(resobj.get("fave_num").toString()));
|
||||
else
|
||||
status.setFavourites_count(0);
|
||||
if(resobj.has("repeat_num"))
|
||||
status.setReblogs_count(Integer.valueOf(resobj.get("repeat_num").toString()));
|
||||
else
|
||||
status.setReblogs_count(0);
|
||||
status.setReplies_count(0);
|
||||
try {
|
||||
status.setReblogged(Boolean.valueOf(resobj.get("repeated").toString()));
|
||||
|
@ -2042,6 +2055,7 @@ public class GNUAPI {
|
|||
|
||||
Attachment attachment = new Attachment();
|
||||
try {
|
||||
if(resobj.has("id") )
|
||||
attachment.setId(resobj.get("id").toString());
|
||||
attachment.setType(resobj.get("mimetype").toString());
|
||||
attachment.setUrl(resobj.get("url").toString());
|
||||
|
|
Loading…
Reference in New Issue