mirror of
https://github.com/accelforce/Yuito
synced 2025-01-19 18:58:22 +01:00
Prevent multiple registrations to eventHub on same TimelineFragment (#879)
This commit is contained in:
parent
25c3defd33
commit
1556a88d05
@ -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;
|
||||
@ -304,7 +305,7 @@ public class TimelineFragment extends SFragment implements
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(statuses.size() == 0) {
|
||||
if (statuses.size() == 0) {
|
||||
nothingMessageView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
@ -583,7 +587,7 @@ public class TimelineFragment extends SFragment implements
|
||||
"Expected StatusViewData.Concrete, got %s instead at position: %d of %d",
|
||||
status == null ? "<null>" : status.getClass().getSimpleName(),
|
||||
position,
|
||||
statuses.size() -1
|
||||
statuses.size() - 1
|
||||
));
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user