Statuses and notifications loaded/parsed via Retrofit/GSON
Notification checker uses since_id as the more exact check-for-updates
This commit is contained in:
parent
3120fbed4c
commit
750c1c80a0
21 changed files with 418 additions and 777 deletions
|
@ -0,0 +1,55 @@
|
|||
/* Copyright 2017 Andrew Dawson
|
||||
*
|
||||
* This file is part of Tusky.
|
||||
*
|
||||
* Tusky 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.
|
||||
*
|
||||
* Tusky 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 Tusky. If not, see
|
||||
* <http://www.gnu.org/licenses/>. */
|
||||
|
||||
package com.keylesspalace.tusky.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class Notification {
|
||||
public enum Type {
|
||||
@SerializedName("mention")
|
||||
MENTION,
|
||||
@SerializedName("reblog")
|
||||
REBLOG,
|
||||
@SerializedName("favourite")
|
||||
FAVOURITE,
|
||||
@SerializedName("follow")
|
||||
FOLLOW,
|
||||
}
|
||||
|
||||
public Type type;
|
||||
|
||||
public String id;
|
||||
|
||||
public Account account;
|
||||
|
||||
public Status status;
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return id.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (this.id == null) {
|
||||
return this == other;
|
||||
} else if (!(other instanceof Notification)) {
|
||||
return false;
|
||||
}
|
||||
Notification notification = (Notification) other;
|
||||
return notification.id.equals(this.id);
|
||||
}
|
||||
}
|
122
app/src/main/java/com/keylesspalace/tusky/entity/Status.java
Normal file
122
app/src/main/java/com/keylesspalace/tusky/entity/Status.java
Normal file
|
@ -0,0 +1,122 @@
|
|||
/* Copyright 2017 Andrew Dawson
|
||||
*
|
||||
* This file is part of Tusky.
|
||||
*
|
||||
* Tusky 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.
|
||||
*
|
||||
* Tusky 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 Tusky. If not, see
|
||||
* <http://www.gnu.org/licenses/>. */
|
||||
|
||||
package com.keylesspalace.tusky.entity;
|
||||
|
||||
import android.text.Spanned;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class Status {
|
||||
private Status actionableStatus;
|
||||
|
||||
public String getActionableId() {
|
||||
return reblog == null ? id : reblog.id;
|
||||
}
|
||||
|
||||
public Status getActionableStatus() {
|
||||
return reblog == null ? this : reblog;
|
||||
}
|
||||
|
||||
public enum Visibility {
|
||||
@SerializedName("public")
|
||||
PUBLIC,
|
||||
@SerializedName("unlisted")
|
||||
UNLISTED,
|
||||
@SerializedName("private")
|
||||
PRIVATE,
|
||||
}
|
||||
|
||||
public String id;
|
||||
|
||||
public Account account;
|
||||
|
||||
public Spanned content;
|
||||
|
||||
public Status reblog;
|
||||
|
||||
@SerializedName("created_at")
|
||||
public Date createdAt;
|
||||
|
||||
public boolean reblogged;
|
||||
|
||||
public boolean favourited;
|
||||
|
||||
public boolean sensitive;
|
||||
|
||||
@SerializedName("spoiler_text")
|
||||
public String spoilerText;
|
||||
|
||||
public Visibility visibility;
|
||||
|
||||
@SerializedName("media_attachments")
|
||||
public MediaAttachment[] attachments;
|
||||
|
||||
public Mention[] mentions;
|
||||
|
||||
public static final int MAX_MEDIA_ATTACHMENTS = 4;
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return id.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (this.id == null) {
|
||||
return this == other;
|
||||
} else if (!(other instanceof Status)) {
|
||||
return false;
|
||||
}
|
||||
Status status = (Status) other;
|
||||
return status.id.equals(this.id);
|
||||
}
|
||||
|
||||
public static class MediaAttachment {
|
||||
public enum Type {
|
||||
@SerializedName("image")
|
||||
IMAGE,
|
||||
@SerializedName("gifv")
|
||||
GIFV,
|
||||
@SerializedName("video")
|
||||
VIDEO,
|
||||
UNKNOWN,
|
||||
}
|
||||
|
||||
public String url;
|
||||
|
||||
@SerializedName("preview_url")
|
||||
public String previewUrl;
|
||||
|
||||
@SerializedName("text_url")
|
||||
public String textUrl;
|
||||
|
||||
@SerializedName("remote_url")
|
||||
public String remoteUrl;
|
||||
|
||||
public Type type;
|
||||
}
|
||||
|
||||
public static class Mention {
|
||||
public String id;
|
||||
|
||||
public String url;
|
||||
|
||||
@SerializedName("acct")
|
||||
public String username;
|
||||
}
|
||||
}
|
|
@ -1,7 +1,5 @@
|
|||
package com.keylesspalace.tusky.entity;
|
||||
|
||||
import com.keylesspalace.tusky.Status;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class StatusContext {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue