Adds reply_count in Status API

This commit is contained in:
stom79 2018-08-19 15:21:39 +02:00
parent 4462a1b2cd
commit 7df2c0b59e
3 changed files with 18 additions and 2 deletions

View File

@ -7,8 +7,8 @@ android {
applicationId "fr.gouv.etalab.mastodon"
minSdkVersion 15
targetSdkVersion 27
versionCode 126
versionName "1.10.2"
versionCode 127
versionName "1.10.3"
}
flavorDimensions "default"
buildTypes {

View File

@ -1893,6 +1893,11 @@ public class API {
status.setContent(resobj.get("content").toString());
status.setFavourites_count(Integer.valueOf(resobj.get("favourites_count").toString()));
status.setReblogs_count(Integer.valueOf(resobj.get("reblogs_count").toString()));
try{
status.setReplies_count(Integer.valueOf(resobj.get("replies_count").toString()));
}catch (Exception e){
status.setReplies_count(0);
}
try {
status.setReblogged(Boolean.valueOf(resobj.get("reblogged").toString()));
}catch (Exception e){

View File

@ -75,6 +75,7 @@ public class Status implements Parcelable{
private Date created_at;
private int reblogs_count;
private int favourites_count;
private int replies_count;
private boolean reblogged;
private boolean favourited;
private boolean muted;
@ -122,6 +123,7 @@ public class Status implements Parcelable{
contentTranslated = in.readString();
reblogs_count = in.readInt();
favourites_count = in.readInt();
replies_count = in.readInt();
reblogged = in.readByte() != 0;
favourited = in.readByte() != 0;
muted = in.readByte() != 0;
@ -354,6 +356,7 @@ public class Status implements Parcelable{
dest.writeString(contentTranslated);
dest.writeInt(reblogs_count);
dest.writeInt(favourites_count);
dest.writeInt(replies_count);
dest.writeByte((byte) (reblogged ? 1 : 0));
dest.writeByte((byte) (favourited ? 1 : 0));
dest.writeByte((byte) (muted ? 1 : 0));
@ -882,4 +885,12 @@ public class Status implements Parcelable{
public void setBookmarked(boolean bookmarked) {
this.bookmarked = bookmarked;
}
public int getReplies_count() {
return replies_count;
}
public void setReplies_count(int replies_count) {
this.replies_count = replies_count;
}
}