mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 17:46:37 +03:00
Changes due to CR
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
d99fde53b1
commit
0ebbdbc92d
1 changed files with 9 additions and 8 deletions
|
@ -77,19 +77,19 @@ import butterknife.ButterKnife;
|
||||||
public class NotificationListAdapter extends RecyclerView.Adapter<NotificationListAdapter.NotificationViewHolder> {
|
public class NotificationListAdapter extends RecyclerView.Adapter<NotificationListAdapter.NotificationViewHolder> {
|
||||||
private static final String TAG = NotificationListAdapter.class.getSimpleName();
|
private static final String TAG = NotificationListAdapter.class.getSimpleName();
|
||||||
|
|
||||||
private List<Notification> notifications;
|
private List<Notification> notificationsList;
|
||||||
private OwnCloudClient client;
|
private OwnCloudClient client;
|
||||||
private NotificationsActivity notificationsActivity;
|
private NotificationsActivity notificationsActivity;
|
||||||
|
|
||||||
public NotificationListAdapter(OwnCloudClient client, NotificationsActivity notificationsActivity) {
|
public NotificationListAdapter(OwnCloudClient client, NotificationsActivity notificationsActivity) {
|
||||||
this.notifications = new ArrayList<>();
|
this.notificationsList = new ArrayList<>();
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.notificationsActivity = notificationsActivity;
|
this.notificationsActivity = notificationsActivity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNotificationItems(List<Notification> notificationItems) {
|
public void setNotificationItems(List<Notification> notificationItems) {
|
||||||
notifications.clear();
|
notificationsList.clear();
|
||||||
notifications.addAll(notificationItems);
|
notificationsList.addAll(notificationItems);
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,8 +102,9 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull NotificationViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull NotificationViewHolder holder, int position) {
|
||||||
Notification notification = notifications.get(position);
|
Notification notification = notificationsList.get(position);
|
||||||
holder.dateTime.setText(DisplayUtils.getRelativeTimestamp(notificationsActivity, notification.getDatetime().getTime()));
|
holder.dateTime.setText(DisplayUtils.getRelativeTimestamp(notificationsActivity,
|
||||||
|
notification.getDatetime().getTime()));
|
||||||
|
|
||||||
String subject = notification.getSubject();
|
String subject = notification.getSubject();
|
||||||
if (!TextUtils.isEmpty(notification.getLink())) {
|
if (!TextUtils.isEmpty(notification.getLink())) {
|
||||||
|
@ -186,7 +187,7 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
|
||||||
protected void onPostExecute(Boolean success) {
|
protected void onPostExecute(Boolean success) {
|
||||||
if (success) {
|
if (success) {
|
||||||
int position = holder.getAdapterPosition();
|
int position = holder.getAdapterPosition();
|
||||||
notifications.remove(position);
|
notificationsList.remove(position);
|
||||||
notifyItemRemoved(position);
|
notifyItemRemoved(position);
|
||||||
} else {
|
} else {
|
||||||
DisplayUtils.showSnackMessage(notificationsActivity, "Failed to execute action!");
|
DisplayUtils.showSnackMessage(notificationsActivity, "Failed to execute action!");
|
||||||
|
@ -222,7 +223,7 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return notifications.size();
|
return notificationsList.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
static class NotificationViewHolder extends RecyclerView.ViewHolder {
|
static class NotificationViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
Loading…
Reference in a new issue