Fixes a bug when coming from notifications and the toot is displayed twice.

This commit is contained in:
tom79 2017-09-07 19:01:28 +02:00
parent 1cc9df1de1
commit 55cdb41780
2 changed files with 16 additions and 3 deletions

View File

@ -253,9 +253,16 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
lv_notifications.setAdapter(notificationsListAdapter);
swiped = false;
}
ArrayList<String> added = new ArrayList<>();
for(Notification notification : this.notifications){
added.add(notification.getId());
}
if( notifications != null && notifications.size() > 0) {
for(Notification tmpNotification: notifications){
this.notifications.add(tmpNotification);
if( !added.contains(tmpNotification.getId())) {
this.notifications.add(tmpNotification);
added.add(tmpNotification.getId());
}
}
notificationsListAdapter.notifyDataSetChanged();
}

View File

@ -25,7 +25,6 @@ import android.support.v4.app.Fragment;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -331,9 +330,16 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
lv_status.setAdapter(statusListAdapter);
swiped = false;
}
ArrayList<String> added = new ArrayList<>();
for(Status status : this.statuses){
added.add(status.getId());
}
if( statuses != null && statuses.size() > 0) {
for(Status tmpStatus: statuses){
this.statuses.add(tmpStatus);
if( !added.contains(tmpStatus.getId())) {
this.statuses.add(tmpStatus);
added.add(tmpStatus.getId());
}
}
statusListAdapter.notifyDataSetChanged();
}