Notifications
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
package org.joinmastodon.android.model;
|
||||
|
||||
/**
|
||||
* A model object from which {@link org.joinmastodon.android.ui.displayitems.StatusDisplayItem}s can be generated.
|
||||
*/
|
||||
public interface DisplayItemsParent{
|
||||
String getID();
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package org.joinmastodon.android.model;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import org.joinmastodon.android.api.ObjectValidationException;
|
||||
import org.joinmastodon.android.api.RequiredField;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
public class Notification extends BaseModel implements DisplayItemsParent{
|
||||
@RequiredField
|
||||
public String id;
|
||||
@RequiredField
|
||||
public Type type;
|
||||
@RequiredField
|
||||
public Instant createdAt;
|
||||
@RequiredField
|
||||
public Account account;
|
||||
|
||||
public Status status;
|
||||
|
||||
@Override
|
||||
public void postprocess() throws ObjectValidationException{
|
||||
super.postprocess();
|
||||
account.postprocess();
|
||||
if(status!=null)
|
||||
status.postprocess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getID(){
|
||||
return id;
|
||||
}
|
||||
|
||||
public enum Type{
|
||||
@SerializedName("follow")
|
||||
FOLLOW,
|
||||
@SerializedName("follow_request")
|
||||
FOLLOW_REQUEST,
|
||||
@SerializedName("mention")
|
||||
MENTION,
|
||||
@SerializedName("reblog")
|
||||
REBLOG,
|
||||
@SerializedName("favourite")
|
||||
FAVORITE,
|
||||
@SerializedName("poll")
|
||||
POLL,
|
||||
@SerializedName("status")
|
||||
STATUS
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,12 @@
|
||||
package org.joinmastodon.android.model;
|
||||
|
||||
import android.text.Html;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import org.joinmastodon.android.api.ObjectValidationException;
|
||||
import org.joinmastodon.android.api.RequiredField;
|
||||
import org.joinmastodon.android.ui.text.HtmlParser;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
|
||||
public class Status extends BaseModel{
|
||||
public class Status extends BaseModel implements DisplayItemsParent{
|
||||
@RequiredField
|
||||
public String id;
|
||||
@RequiredField
|
||||
@@ -111,4 +106,9 @@ public class Status extends BaseModel{
|
||||
", pinned="+pinned+
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getID(){
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user