|
|
@ -47,6 +47,7 @@ import app.fedilab.android.client.entities.api.Notification;
|
|
|
|
import app.fedilab.android.client.entities.app.Timeline;
|
|
|
|
import app.fedilab.android.client.entities.app.Timeline;
|
|
|
|
import app.fedilab.android.databinding.DrawerFollowBinding;
|
|
|
|
import app.fedilab.android.databinding.DrawerFollowBinding;
|
|
|
|
import app.fedilab.android.databinding.DrawerStatusFilteredBinding;
|
|
|
|
import app.fedilab.android.databinding.DrawerStatusFilteredBinding;
|
|
|
|
|
|
|
|
import app.fedilab.android.databinding.DrawerStatusFilteredHideBinding;
|
|
|
|
import app.fedilab.android.databinding.DrawerStatusNotificationBinding;
|
|
|
|
import app.fedilab.android.databinding.DrawerStatusNotificationBinding;
|
|
|
|
import app.fedilab.android.databinding.NotificationsRelatedAccountsBinding;
|
|
|
|
import app.fedilab.android.databinding.NotificationsRelatedAccountsBinding;
|
|
|
|
import app.fedilab.android.helper.Helper;
|
|
|
|
import app.fedilab.android.helper.Helper;
|
|
|
@ -70,6 +71,7 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
|
|
|
private final int TYPE_FILERED = 10;
|
|
|
|
private final int TYPE_FILERED = 10;
|
|
|
|
private final int TYPE_ADMIN_SIGNUP = 11;
|
|
|
|
private final int TYPE_ADMIN_SIGNUP = 11;
|
|
|
|
private final int TYPE_ADMIN_REPORT = 12;
|
|
|
|
private final int TYPE_ADMIN_REPORT = 12;
|
|
|
|
|
|
|
|
private final int TYPE_HIDDEN = 13;
|
|
|
|
public FetchMoreCallBack fetchMoreCallBack;
|
|
|
|
public FetchMoreCallBack fetchMoreCallBack;
|
|
|
|
private Context context;
|
|
|
|
private Context context;
|
|
|
|
private RecyclerView mRecyclerView;
|
|
|
|
private RecyclerView mRecyclerView;
|
|
|
@ -144,17 +146,41 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
|
|
|
case "follow_request":
|
|
|
|
case "follow_request":
|
|
|
|
return TYPE_FOLLOW_REQUEST;
|
|
|
|
return TYPE_FOLLOW_REQUEST;
|
|
|
|
case "mention":
|
|
|
|
case "mention":
|
|
|
|
return TYPE_MENTION;
|
|
|
|
if (notificationList.get(position).status != null) {
|
|
|
|
|
|
|
|
return TYPE_MENTION;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return TYPE_HIDDEN;
|
|
|
|
|
|
|
|
}
|
|
|
|
case "reblog":
|
|
|
|
case "reblog":
|
|
|
|
return TYPE_REBLOG;
|
|
|
|
if (notificationList.get(position).status != null) {
|
|
|
|
|
|
|
|
return TYPE_REBLOG;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return TYPE_HIDDEN;
|
|
|
|
|
|
|
|
}
|
|
|
|
case "update":
|
|
|
|
case "update":
|
|
|
|
return TYPE_UPDATE;
|
|
|
|
if (notificationList.get(position).status != null) {
|
|
|
|
|
|
|
|
return TYPE_UPDATE;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return TYPE_HIDDEN;
|
|
|
|
|
|
|
|
}
|
|
|
|
case "favourite":
|
|
|
|
case "favourite":
|
|
|
|
return TYPE_FAVOURITE;
|
|
|
|
if (notificationList.get(position).status != null) {
|
|
|
|
|
|
|
|
return TYPE_FAVOURITE;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return TYPE_HIDDEN;
|
|
|
|
|
|
|
|
}
|
|
|
|
case "poll":
|
|
|
|
case "poll":
|
|
|
|
return TYPE_POLL;
|
|
|
|
if (notificationList.get(position).status != null) {
|
|
|
|
|
|
|
|
return TYPE_POLL;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return TYPE_HIDDEN;
|
|
|
|
|
|
|
|
}
|
|
|
|
case "status":
|
|
|
|
case "status":
|
|
|
|
return TYPE_STATUS;
|
|
|
|
if (notificationList.get(position).status != null) {
|
|
|
|
|
|
|
|
return TYPE_STATUS;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return TYPE_HIDDEN;
|
|
|
|
|
|
|
|
}
|
|
|
|
case "admin.sign_up":
|
|
|
|
case "admin.sign_up":
|
|
|
|
return TYPE_ADMIN_SIGNUP;
|
|
|
|
return TYPE_ADMIN_SIGNUP;
|
|
|
|
case "admin.report":
|
|
|
|
case "admin.report":
|
|
|
@ -167,7 +193,7 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onAttachedToRecyclerView(RecyclerView recyclerView) {
|
|
|
|
public void onAttachedToRecyclerView(@NonNull RecyclerView recyclerView) {
|
|
|
|
super.onAttachedToRecyclerView(recyclerView);
|
|
|
|
super.onAttachedToRecyclerView(recyclerView);
|
|
|
|
|
|
|
|
|
|
|
|
mRecyclerView = recyclerView;
|
|
|
|
mRecyclerView = recyclerView;
|
|
|
@ -183,6 +209,9 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
|
|
|
} else if (viewType == TYPE_FILERED) {
|
|
|
|
} else if (viewType == TYPE_FILERED) {
|
|
|
|
DrawerStatusFilteredBinding itemBinding = DrawerStatusFilteredBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
|
|
|
DrawerStatusFilteredBinding itemBinding = DrawerStatusFilteredBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
|
|
|
return new StatusAdapter.StatusViewHolder(itemBinding);
|
|
|
|
return new StatusAdapter.StatusViewHolder(itemBinding);
|
|
|
|
|
|
|
|
} else if (viewType == TYPE_HIDDEN) {
|
|
|
|
|
|
|
|
DrawerStatusFilteredHideBinding itemBinding = DrawerStatusFilteredHideBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
|
|
|
|
|
|
|
return new StatusAdapter.StatusViewHolder(itemBinding);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
DrawerStatusNotificationBinding itemBinding = DrawerStatusNotificationBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
|
|
|
DrawerStatusNotificationBinding itemBinding = DrawerStatusNotificationBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
|
|
|
return new StatusAdapter.StatusViewHolder(itemBinding);
|
|
|
|
return new StatusAdapter.StatusViewHolder(itemBinding);
|
|
|
@ -284,6 +313,8 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
|
|
|
notification.filteredByApp = null;
|
|
|
|
notification.filteredByApp = null;
|
|
|
|
notifyItemChanged(position);
|
|
|
|
notifyItemChanged(position);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
} else if (getItemViewType(position) == TYPE_HIDDEN) {
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
StatusAdapter.StatusViewHolder holderStatus = (StatusAdapter.StatusViewHolder) viewHolder;
|
|
|
|
StatusAdapter.StatusViewHolder holderStatus = (StatusAdapter.StatusViewHolder) viewHolder;
|
|
|
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|