Fixes issue #207 - New fixes

This commit is contained in:
stom79 2017-12-28 14:03:08 +01:00
parent 452fdc2a58
commit a98d9d9453
2 changed files with 5 additions and 4 deletions

View File

@ -889,9 +889,9 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
notificationsListAdapter.notifyDataSetChanged();
Toast.makeText(context,R.string.delete_notification,Toast.LENGTH_LONG).show();
}else{
int size = notifications.size();
notifications.clear();
notifications = new ArrayList<>();
notificationsListAdapter.notifyDataSetChanged();
notificationsListAdapter.notifyItemRangeRemoved(0, size);
Toast.makeText(context,R.string.delete_notification_all,Toast.LENGTH_LONG).show();
}

View File

@ -183,6 +183,7 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
swiped = false;
return;
}
int previousPosition = notifications.size();
max_id = apiResponse.getMax_id();
List<Notification> notifications = apiResponse.getNotifications();
@ -272,8 +273,7 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
return;
if( notification != null){
//Makes sure the notifications is not already displayed
if( notification.getId() != null && notifications != null && notifications.size() > 0 && notifications.get(0)!= null
&& Long.parseLong(notification.getId()) > Long.parseLong(notifications.get(0).getId())) {
if( lastReadNotifications == null || Long.parseLong(notification.getId()) > Long.parseLong(lastReadNotifications)) {
//Update the id of the last notification retrieved
MainActivity.lastNotificationId = notification.getId();
notifications.add(0, notification);
@ -293,6 +293,7 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
@Override
public void onRetrieveMissingNotifications(List<Notification> notifications) {
if( notifications != null && notifications.size() > 0) {
for (int i = notifications.size()-1 ; i >= 0 ; i--) {
if (this.notifications.size() == 0 ||