From 78df47e5ea05910eb6454567b64c97129e479fdc Mon Sep 17 00:00:00 2001 From: Sujit Kumar <60378235+therealsujitk@users.noreply.github.com> Date: Mon, 13 Nov 2023 13:52:19 +0530 Subject: [PATCH] Fix BadParcelableException while loading assignment view --- .../tk/therealsuji/vtopchennai/models/Assignment.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/main/java/tk/therealsuji/vtopchennai/models/Assignment.java b/app/src/main/java/tk/therealsuji/vtopchennai/models/Assignment.java index da2370a..09fd332 100644 --- a/app/src/main/java/tk/therealsuji/vtopchennai/models/Assignment.java +++ b/app/src/main/java/tk/therealsuji/vtopchennai/models/Assignment.java @@ -52,6 +52,9 @@ protected Assignment(Parcel in) { dueDate = in.readLong(); cutoffDate = in.readLong(); + if (dueDate == 0) dueDate = null; + if (cutoffDate == 0) cutoffDate = null; + introAttachments = new ArrayList<>(); in.readList(introAttachments, Attachment.class.getClassLoader()); } @@ -67,8 +70,13 @@ public void writeToParcel(Parcel parcel, int i) { parcel.writeString(course); parcel.writeString(title); parcel.writeString(intro); + if (dueDate != null) parcel.writeLong(dueDate); + else parcel.writeLong(0); + if (cutoffDate != null) parcel.writeLong(cutoffDate); + else parcel.writeLong(0); + parcel.writeList(introAttachments); } }