551 lines
14 KiB
Java
551 lines
14 KiB
Java
package app.fedilab.fedilabtube.client.entities;
|
|
/* Copyright 2020 Thomas Schneider
|
|
*
|
|
* This file is a part of TubeLab
|
|
*
|
|
* 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.
|
|
*
|
|
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
|
* Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
|
* see <http://www.gnu.org/licenses>. */
|
|
|
|
import android.os.Parcel;
|
|
import android.os.Parcelable;
|
|
import android.text.SpannableString;
|
|
import android.text.TextUtils;
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
@SuppressWarnings("unused")
|
|
public class Account implements Parcelable {
|
|
|
|
public static final Creator<Account> CREATOR = new Creator<Account>() {
|
|
@Override
|
|
public Account createFromParcel(Parcel source) {
|
|
return new Account(source);
|
|
}
|
|
|
|
@Override
|
|
public Account[] newArray(int size) {
|
|
return new Account[size];
|
|
}
|
|
};
|
|
private String id;
|
|
private String uuid;
|
|
private String username;
|
|
private String acct;
|
|
private String display_name;
|
|
private boolean locked;
|
|
private Date created_at;
|
|
private Date updated_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;
|
|
private String note;
|
|
private SpannableString noteSpan;
|
|
private String url;
|
|
private String avatar;
|
|
private String avatar_static;
|
|
private String header;
|
|
private String header_static;
|
|
private String token;
|
|
private String instance;
|
|
private boolean isFollowing;
|
|
private followAction followType = followAction.NOTHING;
|
|
private boolean isMakingAction = false;
|
|
private Account channelOwner;
|
|
private boolean muting_notifications;
|
|
private String host;
|
|
private boolean isBot;
|
|
private String social;
|
|
private String client_id;
|
|
private String client_secret;
|
|
private String refresh_token;
|
|
private boolean isModerator = false;
|
|
private boolean isAdmin = false;
|
|
private String privacy = "public";
|
|
private boolean sensitive = false;
|
|
private String locale;
|
|
private String invite_request;
|
|
private String created_by_application_id;
|
|
private String invited_by_account_id;
|
|
private boolean isSelected;
|
|
|
|
public Account() {
|
|
}
|
|
|
|
protected Account(Parcel in) {
|
|
this.id = in.readString();
|
|
this.uuid = in.readString();
|
|
this.username = in.readString();
|
|
this.acct = in.readString();
|
|
this.display_name = in.readString();
|
|
this.locked = in.readByte() != 0;
|
|
long tmpCreated_at = in.readLong();
|
|
this.created_at = tmpCreated_at == -1 ? null : new Date(tmpCreated_at);
|
|
long tmpUpdated_at = in.readLong();
|
|
this.updated_at = tmpUpdated_at == -1 ? null : new Date(tmpUpdated_at);
|
|
this.followers_count = in.readInt();
|
|
this.following_count = in.readInt();
|
|
this.statuses_count = in.readInt();
|
|
this.followers_count_str = in.readString();
|
|
this.following_count_str = in.readString();
|
|
this.statuses_count_str = in.readString();
|
|
this.note = in.readString();
|
|
this.noteSpan = (SpannableString) TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
|
|
this.url = in.readString();
|
|
this.avatar = in.readString();
|
|
this.avatar_static = in.readString();
|
|
this.header = in.readString();
|
|
this.header_static = in.readString();
|
|
this.token = in.readString();
|
|
this.instance = in.readString();
|
|
this.isFollowing = in.readByte() != 0;
|
|
int tmpFollowType = in.readInt();
|
|
this.followType = tmpFollowType == -1 ? null : followAction.values()[tmpFollowType];
|
|
this.isMakingAction = in.readByte() != 0;
|
|
this.channelOwner = in.readParcelable(Account.class.getClassLoader());
|
|
this.muting_notifications = in.readByte() != 0;
|
|
this.host = in.readString();
|
|
this.isBot = in.readByte() != 0;
|
|
this.social = in.readString();
|
|
this.client_id = in.readString();
|
|
this.client_secret = in.readString();
|
|
this.refresh_token = in.readString();
|
|
this.isModerator = in.readByte() != 0;
|
|
this.isAdmin = in.readByte() != 0;
|
|
this.privacy = in.readString();
|
|
this.sensitive = in.readByte() != 0;
|
|
this.locale = in.readString();
|
|
this.invite_request = in.readString();
|
|
this.created_by_application_id = in.readString();
|
|
this.invited_by_account_id = in.readString();
|
|
}
|
|
|
|
|
|
@Override
|
|
public int describeContents() {
|
|
return 0;
|
|
}
|
|
|
|
@Override
|
|
public void writeToParcel(Parcel dest, int flags) {
|
|
dest.writeString(this.id);
|
|
dest.writeString(this.uuid);
|
|
dest.writeString(this.username);
|
|
dest.writeString(this.acct);
|
|
dest.writeString(this.display_name);
|
|
dest.writeByte(this.locked ? (byte) 1 : (byte) 0);
|
|
dest.writeLong(this.created_at != null ? this.created_at.getTime() : -1);
|
|
dest.writeLong(this.updated_at != null ? this.updated_at.getTime() : -1);
|
|
dest.writeInt(this.followers_count);
|
|
dest.writeInt(this.following_count);
|
|
dest.writeInt(this.statuses_count);
|
|
dest.writeString(this.followers_count_str);
|
|
dest.writeString(this.following_count_str);
|
|
dest.writeString(this.statuses_count_str);
|
|
dest.writeString(this.note);
|
|
TextUtils.writeToParcel(this.noteSpan, dest, flags);
|
|
dest.writeString(this.url);
|
|
dest.writeString(this.avatar);
|
|
dest.writeString(this.avatar_static);
|
|
dest.writeString(this.header);
|
|
dest.writeString(this.header_static);
|
|
dest.writeString(this.token);
|
|
dest.writeString(this.instance);
|
|
dest.writeByte(this.isFollowing ? (byte) 1 : (byte) 0);
|
|
dest.writeInt(this.followType == null ? -1 : this.followType.ordinal());
|
|
dest.writeByte(this.isMakingAction ? (byte) 1 : (byte) 0);
|
|
dest.writeParcelable(this.channelOwner, flags);
|
|
dest.writeByte(this.muting_notifications ? (byte) 1 : (byte) 0);
|
|
dest.writeString(this.host);
|
|
dest.writeByte(this.isBot ? (byte) 1 : (byte) 0);
|
|
dest.writeString(this.social);
|
|
dest.writeString(this.client_id);
|
|
dest.writeString(this.client_secret);
|
|
dest.writeString(this.refresh_token);
|
|
dest.writeByte(this.isModerator ? (byte) 1 : (byte) 0);
|
|
dest.writeByte(this.isAdmin ? (byte) 1 : (byte) 0);
|
|
dest.writeString(this.privacy);
|
|
dest.writeByte(this.sensitive ? (byte) 1 : (byte) 0);
|
|
dest.writeString(this.locale);
|
|
dest.writeString(this.invite_request);
|
|
dest.writeString(this.created_by_application_id);
|
|
dest.writeString(this.invited_by_account_id);
|
|
}
|
|
|
|
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 Account getchannelOwner() {
|
|
return channelOwner;
|
|
}
|
|
|
|
public void setchannelOwner(Account moved_to_account) {
|
|
this.channelOwner = moved_to_account;
|
|
}
|
|
|
|
public boolean isMuting_notifications() {
|
|
return muting_notifications;
|
|
}
|
|
|
|
public void setMuting_notifications(boolean muting_notifications) {
|
|
this.muting_notifications = muting_notifications;
|
|
}
|
|
|
|
public boolean isSelected() {
|
|
return isSelected;
|
|
}
|
|
|
|
public void setSelected(boolean selected) {
|
|
isSelected = selected;
|
|
}
|
|
|
|
|
|
public String getHost() {
|
|
return host;
|
|
}
|
|
|
|
public void setHost(String host) {
|
|
this.host = host;
|
|
}
|
|
|
|
public boolean isBot() {
|
|
return isBot;
|
|
}
|
|
|
|
public void setBot(boolean bot) {
|
|
isBot = bot;
|
|
}
|
|
|
|
public String getSocial() {
|
|
return social;
|
|
}
|
|
|
|
public void setSocial(String social) {
|
|
this.social = social;
|
|
}
|
|
|
|
public String getUuid() {
|
|
return uuid;
|
|
}
|
|
|
|
public void setUuid(String uuid) {
|
|
this.uuid = uuid;
|
|
}
|
|
|
|
public String getClient_id() {
|
|
return client_id;
|
|
}
|
|
|
|
public void setClient_id(String client_id) {
|
|
this.client_id = client_id;
|
|
}
|
|
|
|
public String getClient_secret() {
|
|
return client_secret;
|
|
}
|
|
|
|
public void setClient_secret(String client_secret) {
|
|
this.client_secret = client_secret;
|
|
}
|
|
|
|
public String getRefresh_token() {
|
|
return refresh_token;
|
|
}
|
|
|
|
public void setRefresh_token(String refresh_token) {
|
|
this.refresh_token = refresh_token;
|
|
}
|
|
|
|
public boolean isModerator() {
|
|
return isModerator;
|
|
}
|
|
|
|
public void setModerator(boolean moderator) {
|
|
isModerator = moderator;
|
|
}
|
|
|
|
public boolean isAdmin() {
|
|
return isAdmin;
|
|
}
|
|
|
|
public void setAdmin(boolean admin) {
|
|
isAdmin = admin;
|
|
}
|
|
|
|
public Date getUpdated_at() {
|
|
return updated_at;
|
|
}
|
|
|
|
public void setUpdated_at(Date updated_at) {
|
|
this.updated_at = updated_at;
|
|
}
|
|
|
|
public String getPrivacy() {
|
|
return privacy;
|
|
}
|
|
|
|
public void setPrivacy(String privacy) {
|
|
this.privacy = privacy;
|
|
}
|
|
|
|
public boolean isSensitive() {
|
|
return sensitive;
|
|
}
|
|
|
|
public void setSensitive(boolean sensitive) {
|
|
this.sensitive = sensitive;
|
|
}
|
|
|
|
public String getLocale() {
|
|
return locale;
|
|
}
|
|
|
|
public void setLocale(String locale) {
|
|
this.locale = locale;
|
|
}
|
|
|
|
public String getInvite_request() {
|
|
return invite_request;
|
|
}
|
|
|
|
public void setInvite_request(String invite_request) {
|
|
this.invite_request = invite_request;
|
|
}
|
|
|
|
public String getCreated_by_application_id() {
|
|
return created_by_application_id;
|
|
}
|
|
|
|
public void setCreated_by_application_id(String created_by_application_id) {
|
|
this.created_by_application_id = created_by_application_id;
|
|
}
|
|
|
|
public String getInvited_by_account_id() {
|
|
return invited_by_account_id;
|
|
}
|
|
|
|
public void setInvited_by_account_id(String invited_by_account_id) {
|
|
this.invited_by_account_id = invited_by_account_id;
|
|
}
|
|
|
|
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 SpannableString getNoteSpan() {
|
|
return noteSpan;
|
|
}
|
|
|
|
public void setNoteSpan(SpannableString noteSpan) {
|
|
this.noteSpan = noteSpan;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
|
|
@NotNull
|
|
public String toString() {
|
|
return this.getAcct() + " - " + this.getUrl();
|
|
}
|
|
|
|
public enum followAction {
|
|
FOLLOW,
|
|
NOT_FOLLOW,
|
|
BLOCK,
|
|
MUTE,
|
|
REQUEST_SENT,
|
|
NOTHING
|
|
}
|
|
|
|
|
|
}
|