{"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-app-android/pulls/comments/42347634","id":42347634,"diff_hunk":"@@ -22,32 +27,50 @@\n \n     private ProgressBar progressBar;\n \n-    private WeakReference<TaskProcessCallback> taskProcessCallback;\n+    @Nullable\n+    private WeakReference<TaskProgressCallback> progressCallback;\n+    @Nullable\n+    private WeakReference<TaskMessageCallback> messageCallback;\n \n     protected final Handler handler = new Handler();\n     protected final Logger logger = new Logger(getClass().getName());\n \n     @Inject\n     protected IEdxEnvironment environment;\n-    \n+\n     public Task(Context context) {\n         super(context);\n \n-        if ( context instanceof TaskProcessCallback ){\n+        if (context instanceof TaskProcessCallback) {\n             setTaskProcessCallback((TaskProcessCallback) context);\n         }\n     }\n-    \n+\n     public void setProgressDialog(ProgressBar progressBar) {\n         this.progressBar = progressBar;\n     }\n \n-    public void setTaskProcessCallback(TaskProcessCallback callback){\n-        this.taskProcessCallback = new WeakReference<TaskProcessCallback>(callback);\n+    public void setTaskProcessCallback(@Nullable TaskProcessCallback callback) {\n+        setProgressCallback(callback);\n+        setMessageCallback(callback);\n+    }\n+\n+    public void setProgressCallback(@Nullable TaskProgressCallback callback) {\n+        progressCallback = callback == null ? null : new WeakReference<>(callback);\n+    }\n+\n+    public void setMessageCallback(@Nullable TaskMessageCallback callback) {\n+        messageCallback = callback == null ? null : new WeakReference<>(callback);\n+    }\n+\n+    @Nullable\n+    private TaskProgressCallback getProgressCallback() {\n+        return this.progressCallback == null ? null : this.progressCallback.get();","path":"VideoLocker/src/main/java/org/edx/mobile/task/Task.java","position":70,"original_position":70,"commit_id":"61746bd0aa4ad2bca4467cc97ee91fc7de8be81c","original_commit_id":"61746bd0aa4ad2bca4467cc97ee91fc7de8be81c","user":{"login":"1zaman","id":4244109,"avatar_url":"https://avatars.githubusercontent.com/u/4244109?v=3","gravatar_id":"","url":"https://api.github.com/users/1zaman","html_url":"https://github.com/1zaman","followers_url":"https://api.github.com/users/1zaman/followers","following_url":"https://api.github.com/users/1zaman/following{/other_user}","gists_url":"https://api.github.com/users/1zaman/gists{/gist_id}","starred_url":"https://api.github.com/users/1zaman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/1zaman/subscriptions","organizations_url":"https://api.github.com/users/1zaman/orgs","repos_url":"https://api.github.com/users/1zaman/repos","events_url":"https://api.github.com/users/1zaman/events{/privacy}","received_events_url":"https://api.github.com/users/1zaman/received_events","type":"User","site_admin":false},"body":"I guess we can remove the unnecessary `this.` accessor from these getters as well.","created_at":"2015-10-19T08:44:49Z","updated_at":"2015-10-19T08:44:49Z","html_url":"https://github.com/edx/edx-app-android/pull/396#discussion_r42347634","pull_request_url":"https://api.github.com/repos/edx/edx-app-android/pulls/396","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-app-android/pulls/comments/42347634"},"html":{"href":"https://github.com/edx/edx-app-android/pull/396#discussion_r42347634"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-app-android/pulls/396"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-app-android/pulls/396","id":47950920,"html_url":"https://github.com/edx/edx-app-android/pull/396","diff_url":"https://github.com/edx/edx-app-android/pull/396.diff","patch_url":"https://github.com/edx/edx-app-android/pull/396.patch","issue_url":"https://api.github.com/repos/edx/edx-app-android/issues/396","number":396,"state":"open","locked":false,"title":"Externalize and improve Task error messages","user":{"login":"bguertin","id":1685613,"avatar_url":"https://avatars.githubusercontent.com/u/1685613?v=3","gravatar_id":"","url":"https://api.github.com/users/bguertin","html_url":"https://github.com/bguertin","followers_url":"https://api.github.com/users/bguertin/followers","following_url":"https://api.github.com/users/bguertin/following{/other_user}","gists_url":"https://api.github.com/users/bguertin/gists{/gist_id}","starred_url":"https://api.github.com/users/bguertin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bguertin/subscriptions","organizations_url":"https://api.github.com/users/bguertin/orgs","repos_url":"https://api.github.com/users/bguertin/repos","events_url":"https://api.github.com/users/bguertin/events{/privacy}","received_events_url":"https://api.github.com/users/bguertin/received_events","type":"User","site_admin":false},"body":"- Error messages now come from `strings.xml`\r\n- I added the ability to configure error callback and message callback separately.\r\n\r\nFixes https://openedx.atlassian.net/browse/MA-1482","created_at":"2015-10-16T19:34:35Z","updated_at":"2015-10-19T08:44:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2146f23d6c702759481a3c8520de730e0863484b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-app-android/pulls/396/commits","review_comments_url":"https://api.github.com/repos/edx/edx-app-android/pulls/396/comments","review_comment_url":"https://api.github.com/repos/edx/edx-app-android/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edx/edx-app-android/issues/396/comments","statuses_url":"https://api.github.com/repos/edx/edx-app-android/statuses/61746bd0aa4ad2bca4467cc97ee91fc7de8be81c","head":{"label":"edx:bguertin/error_cleanup","ref":"bguertin/error_cleanup","sha":"61746bd0aa4ad2bca4467cc97ee91fc7de8be81c","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":29251742,"name":"edx-app-android","full_name":"edx/edx-app-android","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-app-android","description":"","fork":false,"url":"https://api.github.com/repos/edx/edx-app-android","forks_url":"https://api.github.com/repos/edx/edx-app-android/forks","keys_url":"https://api.github.com/repos/edx/edx-app-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-app-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-app-android/teams","hooks_url":"https://api.github.com/repos/edx/edx-app-android/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-app-android/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-app-android/events","assignees_url":"https://api.github.com/repos/edx/edx-app-android/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-app-android/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-app-android/tags","blobs_url":"https://api.github.com/repos/edx/edx-app-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-app-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-app-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-app-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-app-android/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-app-android/languages","stargazers_url":"https://api.github.com/repos/edx/edx-app-android/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-app-android/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-app-android/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-app-android/subscription","commits_url":"https://api.github.com/repos/edx/edx-app-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-app-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-app-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-app-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/edx-app-android/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-app-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-app-android/merges","archive_url":"https://api.github.com/repos/edx/edx-app-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-app-android/downloads","issues_url":"https://api.github.com/repos/edx/edx-app-android/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-app-android/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-app-android/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-app-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-app-android/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-app-android/releases{/id}","created_at":"2015-01-14T15:49:47Z","updated_at":"2015-10-14T11:38:41Z","pushed_at":"2015-10-18T10:32:48Z","git_url":"git://github.com/edx/edx-app-android.git","ssh_url":"git@github.com:edx/edx-app-android.git","clone_url":"https://github.com/edx/edx-app-android.git","svn_url":"https://github.com/edx/edx-app-android","homepage":null,"size":36859,"stargazers_count":40,"watchers_count":40,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":52,"mirror_url":null,"open_issues_count":8,"forks":52,"open_issues":8,"watchers":40,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"c55ae9a71fa232deb5faddcf44fb811e03b6ba87","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":29251742,"name":"edx-app-android","full_name":"edx/edx-app-android","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-app-android","description":"","fork":false,"url":"https://api.github.com/repos/edx/edx-app-android","forks_url":"https://api.github.com/repos/edx/edx-app-android/forks","keys_url":"https://api.github.com/repos/edx/edx-app-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-app-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-app-android/teams","hooks_url":"https://api.github.com/repos/edx/edx-app-android/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-app-android/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-app-android/events","assignees_url":"https://api.github.com/repos/edx/edx-app-android/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-app-android/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-app-android/tags","blobs_url":"https://api.github.com/repos/edx/edx-app-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-app-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-app-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-app-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-app-android/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-app-android/languages","stargazers_url":"https://api.github.com/repos/edx/edx-app-android/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-app-android/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-app-android/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-app-android/subscription","commits_url":"https://api.github.com/repos/edx/edx-app-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-app-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-app-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-app-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/edx-app-android/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-app-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-app-android/merges","archive_url":"https://api.github.com/repos/edx/edx-app-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-app-android/downloads","issues_url":"https://api.github.com/repos/edx/edx-app-android/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-app-android/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-app-android/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-app-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-app-android/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-app-android/releases{/id}","created_at":"2015-01-14T15:49:47Z","updated_at":"2015-10-14T11:38:41Z","pushed_at":"2015-10-18T10:32:48Z","git_url":"git://github.com/edx/edx-app-android.git","ssh_url":"git@github.com:edx/edx-app-android.git","clone_url":"https://github.com/edx/edx-app-android.git","svn_url":"https://github.com/edx/edx-app-android","homepage":null,"size":36859,"stargazers_count":40,"watchers_count":40,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":52,"mirror_url":null,"open_issues_count":8,"forks":52,"open_issues":8,"watchers":40,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-app-android/pulls/396"},"html":{"href":"https://github.com/edx/edx-app-android/pull/396"},"issue":{"href":"https://api.github.com/repos/edx/edx-app-android/issues/396"},"comments":{"href":"https://api.github.com/repos/edx/edx-app-android/issues/396/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-app-android/pulls/396/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/edx-app-android/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edx/edx-app-android/pulls/396/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-app-android/statuses/61746bd0aa4ad2bca4467cc97ee91fc7de8be81c"}}}}