Open new tasks immediately

pull/820/head
Alex Baker 5 years ago
parent aac1401e42
commit ff53e7d08f

@ -366,23 +366,25 @@ public class MainActivity extends InjectingAppCompatActivity
clearUi();
disposables.add(
Single.fromCallable(() -> task.isNew() ? task : taskDao.fetch(task.getId()))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
t -> {
getSupportFragmentManager()
.beginTransaction()
.replace(
R.id.detail,
newTaskEditFragment(t),
TaskEditFragment.TAG_TASKEDIT_FRAGMENT)
.addToBackStack(TaskEditFragment.TAG_TASKEDIT_FRAGMENT)
.commit();
showDetailFragment();
}));
if (task.isNew()) {
openTask(task);
} else {
disposables.add(
Single.fromCallable(() -> taskDao.fetch(task.getId()))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::openTask));
}
}
private void openTask(Task task) {
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.detail, newTaskEditFragment(task), TaskEditFragment.TAG_TASKEDIT_FRAGMENT)
.addToBackStack(TaskEditFragment.TAG_TASKEDIT_FRAGMENT)
.commit();
showDetailFragment();
}
@Override

Loading…
Cancel
Save