fedilab-Android-App/app/src/main/java/fr/gouv/etalab/mastodon/client/Entities/Account.java

306 lines
7.2 KiB
Java
Raw Normal View History

2017-05-05 16:36:04 +02:00
/* Copyright 2017 Thomas Schneider
*
2017-07-10 10:33:24 +02:00
* This file is a part of Mastalab
2017-05-05 16:36:04 +02:00
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
2017-07-10 10:33:24 +02:00
* Mastalab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
2017-05-05 16:36:04 +02:00
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
2017-08-04 11:11:27 +02:00
* You should have received a copy of the GNU General Public License along with Mastalab; if not,
2017-05-05 16:36:04 +02:00
* see <http://www.gnu.org/licenses>. */
package fr.gouv.etalab.mastodon.client.Entities;
2017-05-26 17:20:36 +02:00
import android.os.Parcel;
import android.os.Parcelable;
2017-12-10 18:05:51 +01:00
import java.io.Serializable;
2017-05-05 16:36:04 +02:00
import java.util.Date;
/**
* Created by Thomas on 23/04/2017.
2017-05-26 17:20:36 +02:00
* Manage accounts
2017-05-05 16:36:04 +02:00
*/
2017-12-15 18:03:06 +01:00
public class Account implements Parcelable {
2017-05-05 16:36:04 +02:00
private String id;
private String username;
private String acct;
private String display_name;
private boolean locked;
private Date created_at;
private int followers_count;
private int following_count;
private int statuses_count;
private String followers_count_str;
private String following_count_str;
private String statuses_count_str;
2017-05-05 16:36:04 +02:00
private String note;
private String url;
private String avatar;
private String avatar_static;
private String header;
private String header_static;
private String token;
private String instance;
2017-09-03 10:36:27 +02:00
private boolean isFollowing;
2017-09-17 11:28:50 +02:00
private followAction followType = followAction.NOTHING;
private boolean isMakingAction = false;
public followAction getFollowType() {
return followType;
}
public void setFollowType(followAction followType) {
this.followType = followType;
}
public boolean isMakingAction() {
return isMakingAction;
}
public void setMakingAction(boolean makingAction) {
isMakingAction = makingAction;
}
public enum followAction{
FOLLOW,
NOT_FOLLOW,
BLOCK,
MUTE,
REQUEST_SENT,
NOTHING
}
2017-05-05 16:36:04 +02:00
2017-05-26 17:20:36 +02:00
protected Account(Parcel in) {
id = in.readString();
username = in.readString();
acct = in.readString();
display_name = in.readString();
locked = in.readByte() != 0;
followers_count = in.readInt();
following_count = in.readInt();
statuses_count = in.readInt();
note = in.readString();
url = in.readString();
avatar = in.readString();
avatar_static = in.readString();
header = in.readString();
header_static = in.readString();
token = in.readString();
instance = in.readString();
}
public Account(){}
public static final Creator<Account> CREATOR = new Creator<Account>() {
@Override
public Account createFromParcel(Parcel in) {
return new Account(in);
}
@Override
public Account[] newArray(int size) {
return new Account[size];
}
};
2017-05-05 16:36:04 +02:00
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getAcct() {
return acct;
}
public void setAcct(String acct) {
this.acct = acct;
}
public String getDisplay_name() {
return display_name;
}
public void setDisplay_name(String display_name) {
this.display_name = display_name;
}
public boolean isLocked() {
return locked;
}
public void setLocked(boolean locked) {
this.locked = locked;
}
public Date getCreated_at() {
return created_at;
}
public void setCreated_at(Date created_at) {
this.created_at = created_at;
}
public int getFollowers_count() {
return followers_count;
}
public void setFollowers_count(int followers_count) {
this.followers_count = followers_count;
}
public int getFollowing_count() {
return following_count;
}
public void setFollowing_count(int following_count) {
this.following_count = following_count;
}
public int getStatuses_count() {
return statuses_count;
}
public void setStatuses_count(int statuses_count) {
this.statuses_count = statuses_count;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public String getAvatar_static() {
return avatar_static;
}
public void setAvatar_static(String avatar_static) {
this.avatar_static = avatar_static;
}
public String getHeader() {
return header;
}
public void setHeader(String header) {
this.header = header;
}
public String getHeader_static() {
return header_static;
}
public void setHeader_static(String header_static) {
this.header_static = header_static;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public String getInstance() {
return instance;
}
public void setInstance(String instance) {
this.instance = instance;
}
2017-05-26 17:20:36 +02:00
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(id);
dest.writeString(username);
dest.writeString(acct);
dest.writeString(display_name);
dest.writeByte((byte) (locked ? 1 : 0));
dest.writeInt(followers_count);
dest.writeInt(following_count);
dest.writeInt(statuses_count);
dest.writeString(note);
dest.writeString(url);
dest.writeString(avatar);
dest.writeString(avatar_static);
dest.writeString(header);
dest.writeString(header_static);
dest.writeString(token);
dest.writeString(instance);
}
2017-09-03 10:36:27 +02:00
public boolean isFollowing() {
return isFollowing;
}
public void setFollowing(boolean following) {
isFollowing = following;
}
public String getFollowers_count_str() {
return followers_count_str;
}
public void setFollowers_count_str(String followers_count_str) {
this.followers_count_str = followers_count_str;
}
public String getFollowing_count_str() {
return following_count_str;
}
public void setFollowing_count_str(String following_count_str) {
this.following_count_str = following_count_str;
}
public String getStatuses_count_str() {
return statuses_count_str;
}
public void setStatuses_count_str(String statuses_count_str) {
this.statuses_count_str = statuses_count_str;
}
2017-05-05 16:36:04 +02:00
}