Commit b7b8b12d authored by Varun Patil's avatar Varun Patil

Animate updates to notifications (and other) lists

parent 7a5c9e12
......@@ -38,6 +38,7 @@ public abstract class CardAdapter<T extends CardInterface> extends RecyclerView.
public CardAdapter(List<T> tList, Fragment fragment) {
this.tList = tList;
mFragment = fragment;
this.setHasStableIds(true);
}
@Override
......@@ -114,6 +115,11 @@ public abstract class CardAdapter<T extends CardInterface> extends RecyclerView.
else return 2;
}
@Override
public long getItemId(int position) {
return tList.get(position).getId();
}
@Override
public int getItemCount() {
return tList.size();
......
......@@ -184,6 +184,10 @@ public class Body implements CardInterface {
this.bodyRoles = bodyRoles;
}
public long getId() {
return getBodyID().hashCode();
}
public String getTitle() {
return getBodyName();
}
......
......@@ -243,6 +243,10 @@ public class Event implements CardInterface {
return Objects.hash(eventID);
}
public long getId() {
return hashCode();
}
public String getTitle() {
return getEventName();
}
......
......@@ -79,6 +79,10 @@ public class Notification implements CardInterface {
this.notificationActor = notificationActor;
}
public long getId() {
return getNotificationId().hashCode();
}
public String getTitle() {
if (isEvent()) {
return getEvent().getEventName();
......
......@@ -121,6 +121,10 @@ public class Role implements CardInterface {
this.roleUsersDetail = roleUsersDetail;
}
public long getId() {
return getRoleID().hashCode();
}
public String getTitle() {
return getRoleBodyDetails().getBodyName();
}
......
......@@ -238,6 +238,10 @@ public class User implements CardInterface {
return new Gson().toJson(this);
}
public long getId() {
return getUserID().hashCode();
}
public String getTitle() {
return getUserName();
}
......
package app.insti.interfaces;
public interface CardInterface {
long getId();
String getTitle();
String getSubtitle();
String getAvatarUrl();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment