Elements to display migration

This commit is contained in:
stom79 2017-12-17 08:56:09 +01:00
parent 5c8f10f806
commit 15fe273fb3
3 changed files with 18 additions and 0 deletions

View File

@ -1736,6 +1736,7 @@ public class API {
* @param resobj JSONObject
* @return Account
*/
@SuppressWarnings("InfiniteRecursion")
private static Account parseAccountResponse(Context context, JSONObject resobj){
Account account = new Account();
@ -1750,6 +1751,9 @@ public class API {
account.setFollowing_count(Integer.valueOf(resobj.get("following_count").toString()));
account.setStatuses_count(Integer.valueOf(resobj.get("statuses_count").toString()));
account.setNote(resobj.get("note").toString());
try{
account.setMoved_to_account(parseAccountResponse(context, resobj.getJSONObject("moved_to_account")));
}catch (Exception ignored){}
account.setUrl(resobj.get("url").toString());
account.setAvatar(resobj.get("avatar").toString());
account.setAvatar_static(resobj.get("avatar_static").toString());

View File

@ -50,6 +50,7 @@ public class Account implements Parcelable {
private boolean isFollowing;
private followAction followType = followAction.NOTHING;
private boolean isMakingAction = false;
private Account moved_to_account;
public followAction getFollowType() {
return followType;
@ -67,6 +68,14 @@ public class Account implements Parcelable {
isMakingAction = makingAction;
}
public Account getMoved_to_account() {
return moved_to_account;
}
public void setMoved_to_account(Account moved_to_account) {
this.moved_to_account = moved_to_account;
}
public enum followAction{
FOLLOW,
NOT_FOLLOW,
@ -83,6 +92,7 @@ public class Account implements Parcelable {
acct = in.readString();
display_name = in.readString();
locked = in.readByte() != 0;
moved_to_account = in.readParcelable(Account.class.getClassLoader());
followers_count = in.readInt();
following_count = in.readInt();
statuses_count = in.readInt();
@ -257,6 +267,7 @@ public class Account implements Parcelable {
dest.writeString(username);
dest.writeString(acct);
dest.writeString(display_name);
dest.writeParcelable(moved_to_account, flags);
dest.writeByte((byte) (locked ? 1 : 0));
dest.writeInt(followers_count);
dest.writeInt(following_count);

View File

@ -463,4 +463,7 @@
<string name="action_lists_title_placeholder">New list title</string>
<string name="action_lists_search_users">Search among people you follow</string>
<string name="action_lists_owner">Your lists</string>
<!-- Migration -->
<string name="account_moved_to">%1$s has moved to: %2$s</string>
</resources>