mViews.isEmpty()
See original GitHub issueMethod not call =(
ActivityA MyViewA PresenterA
ActivityB MyViewB PresenterB
- In ActivityA user click btn “Create new task”
- Open ActivityB, user do something and click btn “Save”
- PresenterB send event to PresenterA - new task was created
- PresenterA receive event and call getViewState().newTaskWasCreate()
Method not call =( because
if (mViews == null || mViews.isEmpty()) { return; }
mViews.isEmpty() - true
But if I use handler with delay it is work fine
MyViewA
@StateStrategyType(SkipStrategy.class) void newTaskWasCreate(long taskId, long projectId, int fragmentPosition);
PreventerA
@Subscribe(sticky = true) public void onEvent(MyTasksEvent.NewTaskWasCreate event){ getViewState().newTaskWasCreate(event.getTaskId(), event.getProjectId(), event.getFragmentPosition()); }
Generate ` @Override public void newTaskWasCreate(long taskId, long projectId, int fragmentPosition) { NewTaskWasCreateCommand newTaskWasCreateCommand = new NewTaskWasCreateCommand(taskId, projectId, fragmentPosition); mViewCommands.beforeApply(newTaskWasCreateCommand);
if (mViews == null || mViews.isEmpty()) {
return;
}
for(MyTaskFragmentView view : mViews) {
getCurrentState(view).add(newTaskWasCreateCommand);
view.newTaskWasCreate(taskId, projectId, fragmentPosition);
}
mViewCommands.afterApply(newTaskWasCreateCommand);
}
`
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top GitHub Comments
OneExecutionStateStrategy.class
Thanks for your answer! I do not know about this strategy.