mikepenz/FastAdapter

Items in multiselection keep their selected color after undoing their deletion

readbeard opened this issue · 3 comments

About this issue

While using multiselection extension, the operation of deleting an element and restoring it by clicking on the provided snackbar's undo button, is correctly putting it back in the recyclerview, but the item is still highlighted with the background color chosen for its selected state. This is seems counterintuitive to users, as most apps (e.g.: Gmail) perform the undo operation by showing the original unselected list along with the original toolbar, to the user, which in terms of APIs of this library is equivalent to finish the ActionMode and deselecting "the undoing" items.

Details

  • [5.3.2 ] Used library version

Fast workaround

As this behaviour is also present in the demo application on the play store, and I don't know if it will be targeted in future releases, I assume this is the expected one. However, since as a regular user I'm used to the one described above, I would suggest a super fast (and probably not so good) hardfix (starting from the same code as MultiselectSampleActivity class):

mUndoHelper.remove(findViewById(android.R.id.content), "Item removed", "Undo", Snackbar.LENGTH_LONG, selectExtension.selections)
	.addCallback(object: BaseTransientBottomBar.BaseCallback<Snackbar>() {

		override fun onShown(transientBottomBar: Snackbar?) {
			super.onShown(transientBottomBar)
		}

		override fun onDismissed(transientBottomBar: Snackbar?, event: Int) {
			super.onDismissed(transientBottomBar, event)
                        if (event != Snackbar.Callback.DISMISS_EVENT_TIMEOUT) {
				selectExtension.deselect()
			}
		}
})

@readbeard thank you very much for the report. I believe that adjusting this behaviour would closer match with scenarios like the Gmail app.

I fear though that adjusting this may result in non-anticipated behaviour for existing users.

Will have a look and see what the best adjustment would be

I think for the very moment it's best to include your workaround to the sample to bring more visibility to it.

Thank you very much for the report!

I think for the very moment it's best to include your workaround to the sample to bring more visibility to it.

Thank you very much for the report!

Great! I'm happy to contribute!