Prevent multiple registrations to eventHub on same TimelineFragment (#879)
This commit is contained in:
parent
25c3defd33
commit
1556a88d05
1 changed files with 40 additions and 36 deletions
|
@ -119,6 +119,7 @@ public class TimelineFragment extends SFragment implements
|
|||
public TimelineCases timelineCases;
|
||||
@Inject
|
||||
public EventHub eventHub;
|
||||
private boolean eventRegistered = false;
|
||||
|
||||
private SwipeRefreshLayout swipeRefreshLayout;
|
||||
private RecyclerView recyclerView;
|
||||
|
@ -378,6 +379,7 @@ public class TimelineFragment extends SFragment implements
|
|||
}
|
||||
recyclerView.addOnScrollListener(scrollListener);
|
||||
|
||||
if (!eventRegistered) {
|
||||
eventHub.getEvents()
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.as(autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)))
|
||||
|
@ -413,6 +415,8 @@ public class TimelineFragment extends SFragment implements
|
|||
handleStatusComposeEvent(status);
|
||||
}
|
||||
});
|
||||
eventRegistered = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue