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;
|
public TimelineCases timelineCases;
|
||||||
@Inject
|
@Inject
|
||||||
public EventHub eventHub;
|
public EventHub eventHub;
|
||||||
|
private boolean eventRegistered = false;
|
||||||
|
|
||||||
private SwipeRefreshLayout swipeRefreshLayout;
|
private SwipeRefreshLayout swipeRefreshLayout;
|
||||||
private RecyclerView recyclerView;
|
private RecyclerView recyclerView;
|
||||||
|
@ -378,6 +379,7 @@ public class TimelineFragment extends SFragment implements
|
||||||
}
|
}
|
||||||
recyclerView.addOnScrollListener(scrollListener);
|
recyclerView.addOnScrollListener(scrollListener);
|
||||||
|
|
||||||
|
if (!eventRegistered) {
|
||||||
eventHub.getEvents()
|
eventHub.getEvents()
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.as(autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)))
|
.as(autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)))
|
||||||
|
@ -413,6 +415,8 @@ public class TimelineFragment extends SFragment implements
|
||||||
handleStatusComposeEvent(status);
|
handleStatusComposeEvent(status);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
eventRegistered = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue