{"action":"created","issue":{"url":"https://api.github.com/repos/mikepenz/FastAdapter/issues/94","repository_url":"https://api.github.com/repos/mikepenz/FastAdapter","labels_url":"https://api.github.com/repos/mikepenz/FastAdapter/issues/94/labels{/name}","comments_url":"https://api.github.com/repos/mikepenz/FastAdapter/issues/94/comments","events_url":"https://api.github.com/repos/mikepenz/FastAdapter/issues/94/events","html_url":"https://github.com/mikepenz/FastAdapter/issues/94","id":143288653,"number":94,"title":"Do not remain in actionmode","user":{"login":"readbeard","id":6012118,"avatar_url":"https://avatars.githubusercontent.com/u/6012118?v=3","gravatar_id":"","url":"https://api.github.com/users/readbeard","html_url":"https://github.com/readbeard","followers_url":"https://api.github.com/users/readbeard/followers","following_url":"https://api.github.com/users/readbeard/following{/other_user}","gists_url":"https://api.github.com/users/readbeard/gists{/gist_id}","starred_url":"https://api.github.com/users/readbeard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/readbeard/subscriptions","organizations_url":"https://api.github.com/users/readbeard/orgs","repos_url":"https://api.github.com/users/readbeard/repos","events_url":"https://api.github.com/users/readbeard/events{/privacy}","received_events_url":"https://api.github.com/users/readbeard/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mikepenz/FastAdapter/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":{"login":"mikepenz","id":1476232,"avatar_url":"https://avatars.githubusercontent.com/u/1476232?v=3","gravatar_id":"","url":"https://api.github.com/users/mikepenz","html_url":"https://github.com/mikepenz","followers_url":"https://api.github.com/users/mikepenz/followers","following_url":"https://api.github.com/users/mikepenz/following{/other_user}","gists_url":"https://api.github.com/users/mikepenz/gists{/gist_id}","starred_url":"https://api.github.com/users/mikepenz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikepenz/subscriptions","organizations_url":"https://api.github.com/users/mikepenz/orgs","repos_url":"https://api.github.com/users/mikepenz/repos","events_url":"https://api.github.com/users/mikepenz/events{/privacy}","received_events_url":"https://api.github.com/users/mikepenz/received_events","type":"User","site_admin":false},"milestone":null,"comments":3,"created_at":"2016-03-24T16:08:18Z","updated_at":"2016-03-24T20:59:05Z","closed_at":"2016-03-24T18:34:40Z","body":"Hi,\r\nthanks for this great library! \r\nI was wondering why the multichoice mode is not implemented as the one in gmail app. It think it would be better if the actionmode is closed as soon as an action is selected (for example, as soon as an item is deleted). Is it possible to do that? \r\nThanks in advance."},"comment":{"url":"https://api.github.com/repos/mikepenz/FastAdapter/issues/comments/201018237","html_url":"https://github.com/mikepenz/FastAdapter/issues/94#issuecomment-201018237","issue_url":"https://api.github.com/repos/mikepenz/FastAdapter/issues/94","id":201018237,"user":{"login":"readbeard","id":6012118,"avatar_url":"https://avatars.githubusercontent.com/u/6012118?v=3","gravatar_id":"","url":"https://api.github.com/users/readbeard","html_url":"https://github.com/readbeard","followers_url":"https://api.github.com/users/readbeard/followers","following_url":"https://api.github.com/users/readbeard/following{/other_user}","gists_url":"https://api.github.com/users/readbeard/gists{/gist_id}","starred_url":"https://api.github.com/users/readbeard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/readbeard/subscriptions","organizations_url":"https://api.github.com/users/readbeard/orgs","repos_url":"https://api.github.com/users/readbeard/repos","events_url":"https://api.github.com/users/readbeard/events{/privacy}","received_events_url":"https://api.github.com/users/readbeard/received_events","type":"User","site_admin":false},"created_at":"2016-03-24T20:59:05Z","updated_at":"2016-03-24T20:59:05Z","body":"Here is my solution to the improvement. Let me know if you like it and if it is a correct behaviour for you. \r\nYou just need to edit the `UndoHelper.java` file, in particoular this 2 methods (lines with `//<---` comment are the interesting ones):\r\n\r\n```java\r\npublic Snackbar remove(View view, String text, String actionText, @Snackbar.Duration int duration, Set<Integer> positions,  ActionMode actionMode) { //<---\r\n. . . \r\nprivate void doChange(ActionMode actionMode) {\r\n        if (mHistory != null) {\r\n            if (mHistory.action == ACTION_REMOVE) {\r\n                Integer[] positions = new Integer[mHistory.positions.size()];\r\n                mHistory.positions.toArray(positions);\r\n                for (int i = positions.length - 1; i >= 0; i--) {\r\n                    FastAdapter.RelativeInfo<Item> relativeInfo = mHistory.items.get(i);\r\n                    if (relativeInfo.adapter instanceof IItemAdapter) {\r\n                        ((IItemAdapter) relativeInfo.adapter).remove(positions[i]);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n        actionMode.finish(); // <---\r\n    }\r\n\r\n    private void undoChange() {\r\n        if (mHistory != null) {\r\n            if (mHistory.action == ACTION_REMOVE) {\r\n                int count = 0;\r\n                for (Integer position : mHistory.positions) {\r\n                    FastAdapter.RelativeInfo<Item> relativeInfo = mHistory.items.get(count);\r\n                    if (relativeInfo.adapter instanceof IItemAdapter) {\r\n                        IItemAdapter<Item> adapter = (IItemAdapter<Item>) relativeInfo.adapter;\r\n                        adapter.add(position, relativeInfo.item);\r\n                        if (relativeInfo.item.isSelected()) {\r\n                            mAdapter.deselect(position); //<---\r\n                        }\r\n                    }\r\n                    count++;\r\n                }\r\n            }\r\n        }\r\n        mHistory = null;\r\n    }\r\n```"}}