Fix long press functions in the main list

This commit is contained in:
Aidan Follestad 2018-11-30 22:58:53 -08:00
commit b36b41ca9d

View file

@ -172,15 +172,22 @@ class MainActivity : AppCompatActivity() {
title(R.string.options) title(R.string.options)
listItems(R.array.site_long_options) { _, i, _ -> listItems(R.array.site_long_options) { _, i, _ ->
when (i) { when (i) {
0 -> checkStatusManager.scheduleCheck(site = model, cancelPrevious = true) 0 -> {
1 -> maybeRemoveSite(model) { checkStatusManager.scheduleCheck(
adapter.remove(i) site = model,
rightNow = true,
cancelPrevious = true
)
}
1 -> {
maybeRemoveSite(model) {
adapter.remove(model)
emptyText.showOrHide(adapter.itemCount == 0) emptyText.showOrHide(adapter.itemCount == 0)
} }
}
else -> throw IllegalStateException("Unexpected index: $i") else -> throw IllegalStateException("Unexpected index: $i")
} }
} }
negativeButton(android.R.string.cancel)
} }
return return
} }