aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/org/bienvenidoainternet/baiparser/structure
diff options
context:
space:
mode:
authorLibravatar Renard 2016-04-05 01:52:13 -0300
committerLibravatar Renard 2016-04-05 01:52:13 -0300
commit90ca8b34d823eed19d26f6611716ca231d60424c (patch)
tree65d389b05acb542f14a8faba8abeaa7b36ae227e /app/src/main/java/org/bienvenidoainternet/baiparser/structure
downloadBaiApp-90ca8b34d823eed19d26f6611716ca231d60424c.tar.gz
BaiApp-90ca8b34d823eed19d26f6611716ca231d60424c.tar.xz
BaiApp-90ca8b34d823eed19d26f6611716ca231d60424c.zip
Initial commit
Diffstat (limited to 'app/src/main/java/org/bienvenidoainternet/baiparser/structure')
-rw-r--r--app/src/main/java/org/bienvenidoainternet/baiparser/structure/Board.java60
-rw-r--r--app/src/main/java/org/bienvenidoainternet/baiparser/structure/BoardItem.java310
-rw-r--r--app/src/main/java/org/bienvenidoainternet/baiparser/structure/JsonType.java10
-rw-r--r--app/src/main/java/org/bienvenidoainternet/baiparser/structure/ReplyID.java48
4 files changed, 428 insertions, 0 deletions
diff --git a/app/src/main/java/org/bienvenidoainternet/baiparser/structure/Board.java b/app/src/main/java/org/bienvenidoainternet/baiparser/structure/Board.java
new file mode 100644
index 0000000..209804e
--- /dev/null
+++ b/app/src/main/java/org/bienvenidoainternet/baiparser/structure/Board.java
@@ -0,0 +1,60 @@
+package org.bienvenidoainternet.baiparser.structure;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * Created by Renard on 17-03-2016.
+ */
+
+public class Board implements Parcelable{
+ private String boardName, boardDir;
+ private int boardType;
+ public Board(String boardName,String boardDir,int boardType){
+ this.boardName = boardName;
+ this.boardDir = boardDir;
+ this.boardType = boardType;
+ }
+
+ public Board(Parcel in){
+ this.boardName = in.readString();
+ this.boardDir = in.readString();
+ this.boardType = in.readInt();
+ }
+
+ public String getBoardDir() {
+ return boardDir;
+ }
+
+ public String getBoardName() {
+ return boardName;
+ }
+
+ public int getBoardType() {
+ return boardType;
+ }
+
+ public static final Creator<Board> CREATOR = new Creator<Board>() {
+ @Override
+ public Board createFromParcel(Parcel in) {
+ return new Board(in);
+ }
+
+ @Override
+ public Board[] newArray(int size) {
+ return new Board[size];
+ }
+ };
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeString(boardName);
+ dest.writeString(boardDir);
+ dest.writeInt(boardType);
+ }
+}
diff --git a/app/src/main/java/org/bienvenidoainternet/baiparser/structure/BoardItem.java b/app/src/main/java/org/bienvenidoainternet/baiparser/structure/BoardItem.java
new file mode 100644
index 0000000..c43384a
--- /dev/null
+++ b/app/src/main/java/org/bienvenidoainternet/baiparser/structure/BoardItem.java
@@ -0,0 +1,310 @@
+package org.bienvenidoainternet.baiparser.structure;
+
+import android.graphics.Bitmap;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * Created by Renard on 17-03-2016.
+ */
+public class BoardItem implements Parcelable {
+ private String name = "";
+ private String timestamp_formatted = "";
+ private String thumb = "";
+ private String tripcode = "";
+ private String email = "";
+ private String file = "";
+ private String message = "";
+ private String subject = "";
+ private String posterId = "";
+ private int parentid, id, idcolor, totalreplies = 0, totalfiles, thumb_height, thumb_weight, filesize, deleted_code, bbs_id = 1, parentPostCount;
+ private long timestamp = 0;
+
+ private Bitmap thumbBitmap = null;
+ public boolean downloadingThumb = false;
+ public boolean isReply = false;
+ private Board parentBoard = null;
+
+ protected BoardItem(Parcel in) {
+ name = in.readString();
+ timestamp_formatted = in.readString();
+ thumb = in.readString();
+ tripcode = in.readString();
+ email = in.readString();
+ file = in.readString();
+ message = in.readString();
+ subject = in.readString();
+ posterId = in.readString();
+ parentid = in.readInt();
+ id = in.readInt();
+ idcolor = in.readInt();
+ totalreplies = in.readInt();
+ totalfiles = in.readInt();
+ thumb_height = in.readInt();
+ thumb_weight = in.readInt();
+ filesize = in.readInt();
+ deleted_code = in.readInt();
+ bbs_id = in.readInt();
+ parentPostCount = in.readInt();
+ timestamp = in.readLong();
+ thumbBitmap = in.readParcelable(Bitmap.class.getClassLoader());
+ downloadingThumb = in.readByte() != 0;
+ isReply = in.readByte() != 0;
+ parentBoard = in.readParcelable(Board.class.getClassLoader());
+ }
+
+ public static final Creator<BoardItem> CREATOR = new Creator<BoardItem>() {
+ @Override
+ public BoardItem createFromParcel(Parcel in) {
+ return new BoardItem(in);
+ }
+
+ @Override
+ public BoardItem[] newArray(int size) {
+ return new BoardItem[size];
+ }
+ };
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public String getFile() {
+ return file;
+ }
+
+ public void setFile(String file) {
+ this.file = file;
+ }
+
+ public int getFileSize() {
+ return filesize;
+ }
+
+ public void setFilesize(int filesize) {
+ this.filesize = filesize;
+ }
+
+ public int getIdColor() {
+ return idcolor;
+ }
+
+ public void setIdColor(int idcolor) {
+ this.idcolor = idcolor;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ // TODO: Dar formato a los mensajes de otra forma
+ this.message = message.replace("<span class=\"unkfunc\">", "<font color=#85c749><i>");
+ this.message = this.message.replace("</span>", "</i></font>");
+ if (this.message.contains("<hr")){
+ this.message = this.message.replace("<hr />", "<br><br><small><font color=#FF8800><i>") + "</i></small></font>";
+ }
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Board getParentBoard() {
+ return parentBoard;
+ }
+
+ public void setParentBoard(Board parentBoard) {
+ this.parentBoard = parentBoard;
+ }
+
+ public int getParentId() {
+ return parentid;
+ }
+
+ public void setParentId(int parentid) {
+ this.parentid = parentid;
+ }
+
+ public int getParentPostCount() {
+ return parentPostCount;
+ }
+
+ public void setParentPostCount(int parentPostCount) {
+ this.parentPostCount = parentPostCount;
+ }
+
+ public String getPosterId() {
+ return posterId;
+ }
+
+ public void setPosterId(String posterId) {
+ this.posterId = posterId;
+ }
+
+ public String getSubject() {
+ return subject;
+ }
+
+ public void setSubject(String subject) {
+ this.subject = subject;
+ }
+
+ public String getThumb() {
+ return thumb;
+ }
+
+ public void setThumb(String thumb) {
+ this.thumb = thumb;
+ }
+
+ public int getThumbHeight() {
+ return thumb_height;
+ }
+
+ public void setThumbHeight(int thumb_height) {
+ this.thumb_height = thumb_height;
+ }
+
+ public int getThumbWidth() {
+ return thumb_weight;
+ }
+
+ public void setThumbWidth(int thumb_weight) {
+ this.thumb_weight = thumb_weight;
+ }
+
+ public Bitmap getThumbBitmap() {
+ return thumbBitmap;
+ }
+
+ public void setThumbBitmap(Bitmap thumbBitmap) {
+ this.thumbBitmap = thumbBitmap;
+ }
+
+ public long getTimeStamp() {
+ return timestamp;
+ }
+
+ public void setTimeStamp(long timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ public String getTimeStampFormatted() {
+ return timestamp_formatted;
+ }
+
+ public void setTimeStampFormatted(String timestamp_formatted) {
+ this.timestamp_formatted = timestamp_formatted;
+ }
+
+ public int getTotalFiles() {
+ return totalfiles;
+ }
+
+ public void setTotalFiles(int totalfiles) {
+ this.totalfiles = totalfiles;
+ }
+
+ public int getTotalReplies() {
+ return totalreplies;
+ }
+
+ public void setTotalReplies(int totalreplies) {
+ this.totalreplies = totalreplies;
+ }
+
+ public String getTripcode() {
+ return tripcode;
+ }
+
+ public void setTripcode(String tripcode) {
+ this.tripcode = tripcode;
+ }
+
+ public int getDeletedCode() {
+ return deleted_code;
+ }
+
+ public void setDeletedCode(int deleted_code) {
+ this.deleted_code = deleted_code;
+ if (deleted_code == 1){
+ this.message = "Eliminado por el usuario.";
+ }else if (deleted_code == 2){
+ this.message = "Eliminado por el Staff.";
+ }
+ }
+
+ public int getBbsId() {
+ return bbs_id;
+ }
+
+ public void setBbsId(int bbs_id) {
+ this.bbs_id = bbs_id;
+ }
+
+ public int realParentId(){
+ if (parentid == 0){
+ return id;
+ }
+ return parentid;
+ }
+
+ public BoardItem() {
+
+ }
+
+ public boolean isSage(){
+ return this.email.equals("sage");
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeString(name);
+ dest.writeString(timestamp_formatted);
+ dest.writeString(thumb);
+ dest.writeString(tripcode);
+ dest.writeString(email);
+ dest.writeString(file);
+ dest.writeString(message);
+ dest.writeString(subject);
+ dest.writeString(posterId);
+ dest.writeInt(parentid);
+ dest.writeInt(id);
+ dest.writeInt(idcolor);
+ dest.writeInt(totalreplies);
+ dest.writeInt(totalfiles);
+ dest.writeInt(thumb_height);
+ dest.writeInt(thumb_weight);
+ dest.writeInt(filesize);
+ dest.writeInt(deleted_code);
+ dest.writeInt(bbs_id);
+ dest.writeInt(parentPostCount);
+ dest.writeLong(timestamp);
+ dest.writeParcelable(thumbBitmap, flags);
+ dest.writeByte((byte) (downloadingThumb ? 1 : 0));
+ dest.writeByte((byte) (isReply ? 1 : 0));
+ dest.writeParcelable(parentBoard, flags);
+ }
+}
diff --git a/app/src/main/java/org/bienvenidoainternet/baiparser/structure/JsonType.java b/app/src/main/java/org/bienvenidoainternet/baiparser/structure/JsonType.java
new file mode 100644
index 0000000..8db5c11
--- /dev/null
+++ b/app/src/main/java/org/bienvenidoainternet/baiparser/structure/JsonType.java
@@ -0,0 +1,10 @@
+package org.bienvenidoainternet.baiparser.structure;
+
+/**
+ * Created by Renard on 17-03-2016.
+ */
+public enum JsonType {
+ BOARD_THREAD_LIST,
+ THREAD_REPLY_LIST,
+ BOARD_LIST;
+}
diff --git a/app/src/main/java/org/bienvenidoainternet/baiparser/structure/ReplyID.java b/app/src/main/java/org/bienvenidoainternet/baiparser/structure/ReplyID.java
new file mode 100644
index 0000000..b6758fb
--- /dev/null
+++ b/app/src/main/java/org/bienvenidoainternet/baiparser/structure/ReplyID.java
@@ -0,0 +1,48 @@
+package org.bienvenidoainternet.baiparser.structure;
+
+import android.graphics.Color;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.util.Random;
+
+/**
+ * Created by Renard on 18-03-2016.
+ */
+public class ReplyID implements Parcelable{
+ public String id;
+ public int color;
+ public ReplyID(String id){
+ this.id = id;
+ Random r = new Random();
+ this.color = Color.rgb(r.nextInt(125) + 127, r.nextInt(127) + 127, r.nextInt(127) + 127);
+ }
+
+ protected ReplyID(Parcel in) {
+ id = in.readString();
+ color = in.readInt();
+ }
+
+ public static final Creator<ReplyID> CREATOR = new Creator<ReplyID>() {
+ @Override
+ public ReplyID createFromParcel(Parcel in) {
+ return new ReplyID(in);
+ }
+
+ @Override
+ public ReplyID[] newArray(int size) {
+ return new ReplyID[size];
+ }
+ };
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeString(id);
+ dest.writeInt(color);
+ }
+}