{"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-app-android/pulls/comments/32175156","id":32175156,"diff_hunk":"@@ -0,0 +1,152 @@\n+package org.edx.mobile.services;\n+\n+import android.content.res.Configuration;\n+import android.os.Build;\n+import android.os.Handler;\n+import android.os.Looper;\n+import android.view.View;\n+\n+import org.edx.mobile.base.MainApplication;\n+import org.edx.mobile.logger.Logger;\n+import org.edx.mobile.model.course.CourseComponent;\n+import org.edx.mobile.util.WeakList;\n+import org.edx.mobile.view.common.RunnableCourseComponent;\n+import org.edx.mobile.view.common.TaskCallback;\n+\n+import java.util.List;\n+\n+/**\n+ *  by default, ViewPager will populate UI for both current one-in-view and cached one-in-the-future.\n+ *  in order to improve performance, we wont download it in parallel.\n+ *  but it matters only for the initial load when user navigate from course outline page to detail page.\n+ *\n+ */\n+public class ViewPagerDownloadManager implements TaskCallback {\n+\n+    protected final Logger logger = new Logger(getClass().getName());\n+\n+    public static ViewPagerDownloadManager instance = new ViewPagerDownloadManager();\n+\n+    private WeakList<RunnableCourseComponent> weakList;","path":"VideoLocker/src/main/java/org/edx/mobile/services/ViewPagerDownloadManager.java","position":30,"original_position":30,"commit_id":"d0a7c117b24ae5b1dab1a4adf14e9adfd0ad3f00","original_commit_id":"d0a7c117b24ae5b1dab1a4adf14e9adfd0ad3f00","user":{"login":"aleffert","id":114396,"avatar_url":"https://avatars.githubusercontent.com/u/114396?v=3","gravatar_id":"","url":"https://api.github.com/users/aleffert","html_url":"https://github.com/aleffert","followers_url":"https://api.github.com/users/aleffert/followers","following_url":"https://api.github.com/users/aleffert/following{/other_user}","gists_url":"https://api.github.com/users/aleffert/gists{/gist_id}","starred_url":"https://api.github.com/users/aleffert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aleffert/subscriptions","organizations_url":"https://api.github.com/users/aleffert/orgs","repos_url":"https://api.github.com/users/aleffert/repos","events_url":"https://api.github.com/users/aleffert/events{/privacy}","received_events_url":"https://api.github.com/users/aleffert/received_events","type":"User","site_admin":false},"body":"Maybe we should call this ``courseComponentList`` or something like that? ``weakList`` doesn't really tell me anything about what it does.","created_at":"2015-06-10T22:52:23Z","updated_at":"2015-06-10T22:52:23Z","html_url":"https://github.com/edx/edx-app-android/pull/258#discussion_r32175156","pull_request_url":"https://api.github.com/repos/edx/edx-app-android/pulls/258","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-app-android/pulls/comments/32175156"},"html":{"href":"https://github.com/edx/edx-app-android/pull/258#discussion_r32175156"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-app-android/pulls/258"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-app-android/pulls/258","id":37402350,"html_url":"https://github.com/edx/edx-app-android/pull/258","diff_url":"https://github.com/edx/edx-app-android/pull/258.diff","patch_url":"https://github.com/edx/edx-app-android/pull/258.patch","issue_url":"https://api.github.com/repos/edx/edx-app-android/issues/258","number":258,"state":"open","locked":false,"title":"Hanning/assessment webview performance","user":{"login":"hanningni","id":11091163,"avatar_url":"https://avatars.githubusercontent.com/u/11091163?v=3","gravatar_id":"","url":"https://api.github.com/users/hanningni","html_url":"https://github.com/hanningni","followers_url":"https://api.github.com/users/hanningni/followers","following_url":"https://api.github.com/users/hanningni/following{/other_user}","gists_url":"https://api.github.com/users/hanningni/gists{/gist_id}","starred_url":"https://api.github.com/users/hanningni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanningni/subscriptions","organizations_url":"https://api.github.com/users/hanningni/orgs","repos_url":"https://api.github.com/users/hanningni/repos","events_url":"https://api.github.com/users/hanningni/events{/privacy}","received_events_url":"https://api.github.com/users/hanningni/received_events","type":"User","site_admin":false},"body":"@aleffert  please review \r\n\r\ntry to make the initial loading faster.  [on viewpager]\r\n\r\n\r\nby default viewpager will load three fragments [left, current, right]  in parallel. it may delay the loading of the current webpage at the first time.\r\n1.we will load the current view first,  \r\n2. after the current view is done with loading, then we will load Right view -> Left View.   \r\n3. [in RTL case, we will load Left View -> Right View]\r\n4. this logic will only apply to the inital loading of viewpager. afterwards, we will use the default loading strategy from viewpager. \r\n[as viewpager is the built-in ui component, we need to respect viewpager's behavior for managing component's lifecycle.  ]","created_at":"2015-06-10T20:44:33Z","updated_at":"2015-06-10T22:52:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8bb3fa880b4d461caef43e28592029a55bdcf396","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-app-android/pulls/258/commits","review_comments_url":"https://api.github.com/repos/edx/edx-app-android/pulls/258/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/258/comments","statuses_url":"https://api.github.com/repos/edx/edx-app-android/statuses/d0a7c117b24ae5b1dab1a4adf14e9adfd0ad3f00","head":{"label":"edx:hanning/assessment-webview-performance","ref":"hanning/assessment-webview-performance","sha":"d0a7c117b24ae5b1dab1a4adf14e9adfd0ad3f00","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-06-07T09:03:37Z","pushed_at":"2015-06-10T20:44:34Z","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":37608,"stargazers_count":25,"watchers_count":25,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":28,"mirror_url":null,"open_issues_count":6,"forks":28,"open_issues":6,"watchers":25,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"b2b7e9324152040b4ff5e2621f6debb5ab111f5b","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-06-07T09:03:37Z","pushed_at":"2015-06-10T20:44:34Z","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":37608,"stargazers_count":25,"watchers_count":25,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":28,"mirror_url":null,"open_issues_count":6,"forks":28,"open_issues":6,"watchers":25,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-app-android/pulls/258"},"html":{"href":"https://github.com/edx/edx-app-android/pull/258"},"issue":{"href":"https://api.github.com/repos/edx/edx-app-android/issues/258"},"comments":{"href":"https://api.github.com/repos/edx/edx-app-android/issues/258/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-app-android/pulls/258/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/258/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-app-android/statuses/d0a7c117b24ae5b1dab1a4adf14e9adfd0ad3f00"}}}}