Skip to content

Commit

Permalink
Improve updating the banner
Browse files Browse the repository at this point in the history
  • Loading branch information
grzesiek2010 committed Sep 15, 2023
1 parent 86adad6 commit e52bf13
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,6 @@ protected void onSaveInstanceState(Bundle outState) {

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
readyToSendViewModel.update();

if (resultCode == RESULT_CANCELED) {
multiSelectViewModel.unselectAll();
return;
Expand Down Expand Up @@ -479,6 +477,7 @@ public void onLoadFinished(@NonNull Loader<Cursor> loader, Cursor cursor) {
} else {
findViewById(R.id.buttonholder).setVisibility(View.VISIBLE);
}
readyToSendViewModel.update();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ class ReadyToSendViewModel(
private val _data = MutableLiveData<Data>()
val data: LiveData<Data> = _data

init {
update()
}

fun update() {
scheduler.immediate(
background = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ class ReadyToSendViewModelTest {
}
private val scheduler = FakeScheduler()

private val viewModel = ReadyToSendViewModel(instancesRepository, scheduler) { TimeInMs.ONE_SECOND * 10 }
private val viewModel = ReadyToSendViewModel(instancesRepository, scheduler) { TimeInMs.ONE_SECOND * 10 }.apply {
update()
}

@Test
fun `numberOfSentInstances should represent the real number of instances with STATUS_SUBMITTED in the database`() {
Expand Down

0 comments on commit e52bf13

Please sign in to comment.