{"action":"created","comment":{"url":"https://api.github.com/repos/Karumi/Dexter/pulls/comments/48473395","id":48473395,"diff_hunk":"@@ -0,0 +1,34 @@\n+/*\n+ * Copyright (C) 2015 Karumi.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package com.karumi.dexter.listener.threaddecorator;\n+\n+/**\n+ * A thread specification to execute passed runnable objects in the main thread\n+ */\n+class MainThreadSpec implements ThreadSpec {","path":"dexter/src/main/java/com/karumi/dexter/listener/threaddecorator/MainThreadSpec.java","position":22,"original_position":22,"commit_id":"806cc528cebc3d8845c23db80704abd76a61d723","original_commit_id":"806cc528cebc3d8845c23db80704abd76a61d723","user":{"login":"pedrovgs","id":4030704,"avatar_url":"https://avatars.githubusercontent.com/u/4030704?v=3","gravatar_id":"","url":"https://api.github.com/users/pedrovgs","html_url":"https://github.com/pedrovgs","followers_url":"https://api.github.com/users/pedrovgs/followers","following_url":"https://api.github.com/users/pedrovgs/following{/other_user}","gists_url":"https://api.github.com/users/pedrovgs/gists{/gist_id}","starred_url":"https://api.github.com/users/pedrovgs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedrovgs/subscriptions","organizations_url":"https://api.github.com/users/pedrovgs/orgs","repos_url":"https://api.github.com/users/pedrovgs/repos","events_url":"https://api.github.com/users/pedrovgs/events{/privacy}","received_events_url":"https://api.github.com/users/pedrovgs/received_events","type":"User","site_admin":false},"body":"As @Serchinastico says, if you want to force the execution over the main thread you should create a handler using the main looper.","created_at":"2015-12-28T10:50:32Z","updated_at":"2015-12-28T10:50:32Z","html_url":"https://github.com/Karumi/Dexter/pull/39#discussion_r48473395","pull_request_url":"https://api.github.com/repos/Karumi/Dexter/pulls/39","_links":{"self":{"href":"https://api.github.com/repos/Karumi/Dexter/pulls/comments/48473395"},"html":{"href":"https://github.com/Karumi/Dexter/pull/39#discussion_r48473395"},"pull_request":{"href":"https://api.github.com/repos/Karumi/Dexter/pulls/39"}}},"pull_request":{"url":"https://api.github.com/repos/Karumi/Dexter/pulls/39","id":54601623,"html_url":"https://github.com/Karumi/Dexter/pull/39","diff_url":"https://github.com/Karumi/Dexter/pull/39.diff","patch_url":"https://github.com/Karumi/Dexter/pull/39.patch","issue_url":"https://api.github.com/repos/Karumi/Dexter/issues/39","number":39,"state":"open","locked":false,"title":"Keep execution context on permission requested ","user":{"login":"cmc00022","id":3494156,"avatar_url":"https://avatars.githubusercontent.com/u/3494156?v=3","gravatar_id":"","url":"https://api.github.com/users/cmc00022","html_url":"https://github.com/cmc00022","followers_url":"https://api.github.com/users/cmc00022/followers","following_url":"https://api.github.com/users/cmc00022/following{/other_user}","gists_url":"https://api.github.com/users/cmc00022/gists{/gist_id}","starred_url":"https://api.github.com/users/cmc00022/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmc00022/subscriptions","organizations_url":"https://api.github.com/users/cmc00022/orgs","repos_url":"https://api.github.com/users/cmc00022/repos","events_url":"https://api.github.com/users/cmc00022/events{/privacy}","received_events_url":"https://api.github.com/users/cmc00022/received_events","type":"User","site_admin":false},"body":"@pedrovgs here is the PR to keep the execution context.\r\n\r\nAs you pointed out to add a public method to keep the execution context I did so. \r\n\r\nBut there is another possibility. We could use the old DexterInstance.checkPermission() method to just return the listener callbacks on the same thread that calls the method.\r\n\r\nIf you rather go for the 2 public methods option, then I'd rename the old DexterInstance.checkPermission() to DexterInstance.checkPermissionOnMainThread(), as the method to check permission on the same thread is called DexterInstance.checkPermissionOnSameThread(). I think this will make more evident the purpose of both methods.\r\n\r\nThanks.\r\n\r\nFix #31 ","created_at":"2015-12-26T12:32:50Z","updated_at":"2015-12-28T10:50:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c4931cb4949c718a8ea2a65f5da08a2fcff5c165","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Karumi/Dexter/pulls/39/commits","review_comments_url":"https://api.github.com/repos/Karumi/Dexter/pulls/39/comments","review_comment_url":"https://api.github.com/repos/Karumi/Dexter/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Karumi/Dexter/issues/39/comments","statuses_url":"https://api.github.com/repos/Karumi/Dexter/statuses/806cc528cebc3d8845c23db80704abd76a61d723","head":{"label":"cmc00022:master","ref":"master","sha":"806cc528cebc3d8845c23db80704abd76a61d723","user":{"login":"cmc00022","id":3494156,"avatar_url":"https://avatars.githubusercontent.com/u/3494156?v=3","gravatar_id":"","url":"https://api.github.com/users/cmc00022","html_url":"https://github.com/cmc00022","followers_url":"https://api.github.com/users/cmc00022/followers","following_url":"https://api.github.com/users/cmc00022/following{/other_user}","gists_url":"https://api.github.com/users/cmc00022/gists{/gist_id}","starred_url":"https://api.github.com/users/cmc00022/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmc00022/subscriptions","organizations_url":"https://api.github.com/users/cmc00022/orgs","repos_url":"https://api.github.com/users/cmc00022/repos","events_url":"https://api.github.com/users/cmc00022/events{/privacy}","received_events_url":"https://api.github.com/users/cmc00022/received_events","type":"User","site_admin":false},"repo":{"id":47974784,"name":"Dexter","full_name":"cmc00022/Dexter","owner":{"login":"cmc00022","id":3494156,"avatar_url":"https://avatars.githubusercontent.com/u/3494156?v=3","gravatar_id":"","url":"https://api.github.com/users/cmc00022","html_url":"https://github.com/cmc00022","followers_url":"https://api.github.com/users/cmc00022/followers","following_url":"https://api.github.com/users/cmc00022/following{/other_user}","gists_url":"https://api.github.com/users/cmc00022/gists{/gist_id}","starred_url":"https://api.github.com/users/cmc00022/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmc00022/subscriptions","organizations_url":"https://api.github.com/users/cmc00022/orgs","repos_url":"https://api.github.com/users/cmc00022/repos","events_url":"https://api.github.com/users/cmc00022/events{/privacy}","received_events_url":"https://api.github.com/users/cmc00022/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cmc00022/Dexter","description":"Android library that simplifies the process of requesting permissions at runtime.","fork":true,"url":"https://api.github.com/repos/cmc00022/Dexter","forks_url":"https://api.github.com/repos/cmc00022/Dexter/forks","keys_url":"https://api.github.com/repos/cmc00022/Dexter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cmc00022/Dexter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cmc00022/Dexter/teams","hooks_url":"https://api.github.com/repos/cmc00022/Dexter/hooks","issue_events_url":"https://api.github.com/repos/cmc00022/Dexter/issues/events{/number}","events_url":"https://api.github.com/repos/cmc00022/Dexter/events","assignees_url":"https://api.github.com/repos/cmc00022/Dexter/assignees{/user}","branches_url":"https://api.github.com/repos/cmc00022/Dexter/branches{/branch}","tags_url":"https://api.github.com/repos/cmc00022/Dexter/tags","blobs_url":"https://api.github.com/repos/cmc00022/Dexter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cmc00022/Dexter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cmc00022/Dexter/git/refs{/sha}","trees_url":"https://api.github.com/repos/cmc00022/Dexter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cmc00022/Dexter/statuses/{sha}","languages_url":"https://api.github.com/repos/cmc00022/Dexter/languages","stargazers_url":"https://api.github.com/repos/cmc00022/Dexter/stargazers","contributors_url":"https://api.github.com/repos/cmc00022/Dexter/contributors","subscribers_url":"https://api.github.com/repos/cmc00022/Dexter/subscribers","subscription_url":"https://api.github.com/repos/cmc00022/Dexter/subscription","commits_url":"https://api.github.com/repos/cmc00022/Dexter/commits{/sha}","git_commits_url":"https://api.github.com/repos/cmc00022/Dexter/git/commits{/sha}","comments_url":"https://api.github.com/repos/cmc00022/Dexter/comments{/number}","issue_comment_url":"https://api.github.com/repos/cmc00022/Dexter/issues/comments{/number}","contents_url":"https://api.github.com/repos/cmc00022/Dexter/contents/{+path}","compare_url":"https://api.github.com/repos/cmc00022/Dexter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cmc00022/Dexter/merges","archive_url":"https://api.github.com/repos/cmc00022/Dexter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cmc00022/Dexter/downloads","issues_url":"https://api.github.com/repos/cmc00022/Dexter/issues{/number}","pulls_url":"https://api.github.com/repos/cmc00022/Dexter/pulls{/number}","milestones_url":"https://api.github.com/repos/cmc00022/Dexter/milestones{/number}","notifications_url":"https://api.github.com/repos/cmc00022/Dexter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cmc00022/Dexter/labels{/name}","releases_url":"https://api.github.com/repos/cmc00022/Dexter/releases{/id}","created_at":"2015-12-14T12:50:02Z","updated_at":"2015-12-14T14:21:05Z","pushed_at":"2015-12-26T12:37:07Z","git_url":"git://github.com/cmc00022/Dexter.git","ssh_url":"git@github.com:cmc00022/Dexter.git","clone_url":"https://github.com/cmc00022/Dexter.git","svn_url":"https://github.com/cmc00022/Dexter","homepage":null,"size":2700,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Karumi:master","ref":"master","sha":"de60877990ba89eacbee7db83029ad93ef224541","user":{"login":"Karumi","id":6469715,"avatar_url":"https://avatars.githubusercontent.com/u/6469715?v=3","gravatar_id":"","url":"https://api.github.com/users/Karumi","html_url":"https://github.com/Karumi","followers_url":"https://api.github.com/users/Karumi/followers","following_url":"https://api.github.com/users/Karumi/following{/other_user}","gists_url":"https://api.github.com/users/Karumi/gists{/gist_id}","starred_url":"https://api.github.com/users/Karumi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Karumi/subscriptions","organizations_url":"https://api.github.com/users/Karumi/orgs","repos_url":"https://api.github.com/users/Karumi/repos","events_url":"https://api.github.com/users/Karumi/events{/privacy}","received_events_url":"https://api.github.com/users/Karumi/received_events","type":"Organization","site_admin":false},"repo":{"id":46348026,"name":"Dexter","full_name":"Karumi/Dexter","owner":{"login":"Karumi","id":6469715,"avatar_url":"https://avatars.githubusercontent.com/u/6469715?v=3","gravatar_id":"","url":"https://api.github.com/users/Karumi","html_url":"https://github.com/Karumi","followers_url":"https://api.github.com/users/Karumi/followers","following_url":"https://api.github.com/users/Karumi/following{/other_user}","gists_url":"https://api.github.com/users/Karumi/gists{/gist_id}","starred_url":"https://api.github.com/users/Karumi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Karumi/subscriptions","organizations_url":"https://api.github.com/users/Karumi/orgs","repos_url":"https://api.github.com/users/Karumi/repos","events_url":"https://api.github.com/users/Karumi/events{/privacy}","received_events_url":"https://api.github.com/users/Karumi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Karumi/Dexter","description":"Android library that simplifies the process of requesting permissions at runtime.","fork":false,"url":"https://api.github.com/repos/Karumi/Dexter","forks_url":"https://api.github.com/repos/Karumi/Dexter/forks","keys_url":"https://api.github.com/repos/Karumi/Dexter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Karumi/Dexter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Karumi/Dexter/teams","hooks_url":"https://api.github.com/repos/Karumi/Dexter/hooks","issue_events_url":"https://api.github.com/repos/Karumi/Dexter/issues/events{/number}","events_url":"https://api.github.com/repos/Karumi/Dexter/events","assignees_url":"https://api.github.com/repos/Karumi/Dexter/assignees{/user}","branches_url":"https://api.github.com/repos/Karumi/Dexter/branches{/branch}","tags_url":"https://api.github.com/repos/Karumi/Dexter/tags","blobs_url":"https://api.github.com/repos/Karumi/Dexter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Karumi/Dexter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Karumi/Dexter/git/refs{/sha}","trees_url":"https://api.github.com/repos/Karumi/Dexter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Karumi/Dexter/statuses/{sha}","languages_url":"https://api.github.com/repos/Karumi/Dexter/languages","stargazers_url":"https://api.github.com/repos/Karumi/Dexter/stargazers","contributors_url":"https://api.github.com/repos/Karumi/Dexter/contributors","subscribers_url":"https://api.github.com/repos/Karumi/Dexter/subscribers","subscription_url":"https://api.github.com/repos/Karumi/Dexter/subscription","commits_url":"https://api.github.com/repos/Karumi/Dexter/commits{/sha}","git_commits_url":"https://api.github.com/repos/Karumi/Dexter/git/commits{/sha}","comments_url":"https://api.github.com/repos/Karumi/Dexter/comments{/number}","issue_comment_url":"https://api.github.com/repos/Karumi/Dexter/issues/comments{/number}","contents_url":"https://api.github.com/repos/Karumi/Dexter/contents/{+path}","compare_url":"https://api.github.com/repos/Karumi/Dexter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Karumi/Dexter/merges","archive_url":"https://api.github.com/repos/Karumi/Dexter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Karumi/Dexter/downloads","issues_url":"https://api.github.com/repos/Karumi/Dexter/issues{/number}","pulls_url":"https://api.github.com/repos/Karumi/Dexter/pulls{/number}","milestones_url":"https://api.github.com/repos/Karumi/Dexter/milestones{/number}","notifications_url":"https://api.github.com/repos/Karumi/Dexter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Karumi/Dexter/labels{/name}","releases_url":"https://api.github.com/repos/Karumi/Dexter/releases{/id}","created_at":"2015-11-17T13:14:43Z","updated_at":"2015-12-28T10:05:29Z","pushed_at":"2015-12-26T13:36:29Z","git_url":"git://github.com/Karumi/Dexter.git","ssh_url":"git@github.com:Karumi/Dexter.git","clone_url":"https://github.com/Karumi/Dexter.git","svn_url":"https://github.com/Karumi/Dexter","homepage":"http://karumi.com","size":2758,"stargazers_count":985,"watchers_count":985,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":91,"mirror_url":null,"open_issues_count":4,"forks":91,"open_issues":4,"watchers":985,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Karumi/Dexter/pulls/39"},"html":{"href":"https://github.com/Karumi/Dexter/pull/39"},"issue":{"href":"https://api.github.com/repos/Karumi/Dexter/issues/39"},"comments":{"href":"https://api.github.com/repos/Karumi/Dexter/issues/39/comments"},"review_comments":{"href":"https://api.github.com/repos/Karumi/Dexter/pulls/39/comments"},"review_comment":{"href":"https://api.github.com/repos/Karumi/Dexter/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Karumi/Dexter/pulls/39/commits"},"statuses":{"href":"https://api.github.com/repos/Karumi/Dexter/statuses/806cc528cebc3d8845c23db80704abd76a61d723"}}}}