{"action":"created","comment":{"url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/pulls/comments/32503019","id":32503019,"diff_hunk":"@@ -5,45 +5,51 @@\n import android.util.AttributeSet;\n import android.view.MotionEvent;\n \n+import org.wordpress.android.util.AppLog;\n+import org.wordpress.android.util.AppLog.T;\n+\n+/**\n+ * Custom ViewPager which resolves the \"pointer index out of range\" bug in the compatibility library\n+ * https://code.google.com/p/android/issues/detail?id=16836\n+ * https://code.google.com/p/android/issues/detail?id=18990\n+ * https://github.com/chrisbanes/PhotoView/issues/31\n+ */\n public class WPViewPager extends ViewPager {\n-    private boolean enabled;\n-    private int mPreviousPage;\n+    private boolean mPagingEnabled = true;\n+\n+    public WPViewPager(Context context) {\n+        super(context);\n+    }\n \n     public WPViewPager(Context context, AttributeSet attrs) {\n         super(context, attrs);\n-        this.enabled = false;\n-        mPreviousPage = 0;\n     }\n \n     @Override\n-    public boolean onTouchEvent(MotionEvent event) {\n-        if (this.enabled) {\n-            return super.onTouchEvent(event);\n+    public boolean onInterceptTouchEvent(MotionEvent ev) {\n+        if (mPagingEnabled) {\n+            try {\n+                return super.onInterceptTouchEvent(ev);\n+            } catch (IllegalArgumentException e) {\n+                AppLog.e(T.UTILS, e);\n+            }\n         }\n-\n         return false;\n     }\n \n     @Override\n-    public boolean onInterceptTouchEvent(MotionEvent event) {\n-        if (this.enabled) {\n-            return super.onInterceptTouchEvent(event);\n+    public boolean onTouchEvent(MotionEvent ev) {\n+        if (mPagingEnabled) {\n+            try {\n+                return super.onTouchEvent(ev);\n+            } catch (IllegalArgumentException e) {\n+                AppLog.e(AppLog.T.UTILS, e);\n+            }\n         }\n-\n         return false;\n     }\n \n-    public void setPagingEnabled(boolean enabled) {\n-        this.enabled = enabled;\n-    }\n-\n-    @Override\n-    public void setCurrentItem(int currentItem) {\n-        mPreviousPage = getCurrentItem();\n-        super.setCurrentItem(currentItem);\n-    }\n-\n-    public int getPreviousPage() {\n-        return mPreviousPage;\n+    public void setPagingEnabled(boolean pagingEnabled) {\n+        mPagingEnabled = pagingEnabled;","path":"WordPress/src/main/java/org/wordpress/android/widgets/WPViewPager.java","position":73,"original_position":73,"commit_id":"7d3d7553e52c11cabfb4a49e110f75e01a2b12af","original_commit_id":"7d3d7553e52c11cabfb4a49e110f75e01a2b12af","user":{"login":"nbradbury","id":3903757,"avatar_url":"https://avatars.githubusercontent.com/u/3903757?v=3","gravatar_id":"","url":"https://api.github.com/users/nbradbury","html_url":"https://github.com/nbradbury","followers_url":"https://api.github.com/users/nbradbury/followers","following_url":"https://api.github.com/users/nbradbury/following{/other_user}","gists_url":"https://api.github.com/users/nbradbury/gists{/gist_id}","starred_url":"https://api.github.com/users/nbradbury/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbradbury/subscriptions","organizations_url":"https://api.github.com/users/nbradbury/orgs","repos_url":"https://api.github.com/users/nbradbury/repos","events_url":"https://api.github.com/users/nbradbury/events{/privacy}","received_events_url":"https://api.github.com/users/nbradbury/received_events","type":"User","site_admin":false},"body":"This would previously disable the ViewPager (so the user couldn't change pages), but it's not doing anything here.","created_at":"2015-06-16T09:09:56Z","updated_at":"2015-06-16T09:09:56Z","html_url":"https://github.com/wordpress-mobile/WordPress-Android/pull/2863#discussion_r32503019","pull_request_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/pulls/2863","_links":{"self":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/pulls/comments/32503019"},"html":{"href":"https://github.com/wordpress-mobile/WordPress-Android/pull/2863#discussion_r32503019"},"pull_request":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/pulls/2863"}}},"pull_request":{"url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/pulls/2863","id":37772709,"html_url":"https://github.com/wordpress-mobile/WordPress-Android/pull/2863","diff_url":"https://github.com/wordpress-mobile/WordPress-Android/pull/2863.diff","patch_url":"https://github.com/wordpress-mobile/WordPress-Android/pull/2863.patch","issue_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/issues/2863","number":2863,"state":"open","locked":false,"title":"fix #2848 by using WPViewPager including a workaround","user":{"login":"maxme","id":40213,"avatar_url":"https://avatars.githubusercontent.com/u/40213?v=3","gravatar_id":"","url":"https://api.github.com/users/maxme","html_url":"https://github.com/maxme","followers_url":"https://api.github.com/users/maxme/followers","following_url":"https://api.github.com/users/maxme/following{/other_user}","gists_url":"https://api.github.com/users/maxme/gists{/gist_id}","starred_url":"https://api.github.com/users/maxme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxme/subscriptions","organizations_url":"https://api.github.com/users/maxme/orgs","repos_url":"https://api.github.com/users/maxme/repos","events_url":"https://api.github.com/users/maxme/events{/privacy}","received_events_url":"https://api.github.com/users/maxme/received_events","type":"User","site_admin":false},"body":"fix #2848 by using WPViewPager including a workaround.\r\n\r\nMerge WPViewPager and WPMainViewPager, remove dead code, and use WPViewPager everywhere we were using the standard ViewPager.","created_at":"2015-06-16T08:57:22Z","updated_at":"2015-06-16T09:09:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d5396362e960ce6fdf3bf942716756385f6ab056","assignee":{"login":"nbradbury","id":3903757,"avatar_url":"https://avatars.githubusercontent.com/u/3903757?v=3","gravatar_id":"","url":"https://api.github.com/users/nbradbury","html_url":"https://github.com/nbradbury","followers_url":"https://api.github.com/users/nbradbury/followers","following_url":"https://api.github.com/users/nbradbury/following{/other_user}","gists_url":"https://api.github.com/users/nbradbury/gists{/gist_id}","starred_url":"https://api.github.com/users/nbradbury/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbradbury/subscriptions","organizations_url":"https://api.github.com/users/nbradbury/orgs","repos_url":"https://api.github.com/users/nbradbury/repos","events_url":"https://api.github.com/users/nbradbury/events{/privacy}","received_events_url":"https://api.github.com/users/nbradbury/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/milestones/42","html_url":"https://github.com/wordpress-mobile/WordPress-Android/milestones/4.1.1","labels_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/milestones/42/labels","id":1164805,"number":42,"title":"4.1.1","description":null,"creator":{"login":"daniloercoli","id":518232,"avatar_url":"https://avatars.githubusercontent.com/u/518232?v=3","gravatar_id":"","url":"https://api.github.com/users/daniloercoli","html_url":"https://github.com/daniloercoli","followers_url":"https://api.github.com/users/daniloercoli/followers","following_url":"https://api.github.com/users/daniloercoli/following{/other_user}","gists_url":"https://api.github.com/users/daniloercoli/gists{/gist_id}","starred_url":"https://api.github.com/users/daniloercoli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daniloercoli/subscriptions","organizations_url":"https://api.github.com/users/daniloercoli/orgs","repos_url":"https://api.github.com/users/daniloercoli/repos","events_url":"https://api.github.com/users/daniloercoli/events{/privacy}","received_events_url":"https://api.github.com/users/daniloercoli/received_events","type":"User","site_admin":false},"open_issues":8,"closed_issues":9,"state":"open","created_at":"2015-06-15T12:45:51Z","updated_at":"2015-06-16T09:08:27Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/pulls/2863/commits","review_comments_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/pulls/2863/comments","review_comment_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/issues/2863/comments","statuses_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/statuses/7d3d7553e52c11cabfb4a49e110f75e01a2b12af","head":{"label":"wordpress-mobile:issue/2848-viewpager-merge","ref":"issue/2848-viewpager-merge","sha":"7d3d7553e52c11cabfb4a49e110f75e01a2b12af","user":{"login":"wordpress-mobile","id":1306301,"avatar_url":"https://avatars.githubusercontent.com/u/1306301?v=3","gravatar_id":"","url":"https://api.github.com/users/wordpress-mobile","html_url":"https://github.com/wordpress-mobile","followers_url":"https://api.github.com/users/wordpress-mobile/followers","following_url":"https://api.github.com/users/wordpress-mobile/following{/other_user}","gists_url":"https://api.github.com/users/wordpress-mobile/gists{/gist_id}","starred_url":"https://api.github.com/users/wordpress-mobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wordpress-mobile/subscriptions","organizations_url":"https://api.github.com/users/wordpress-mobile/orgs","repos_url":"https://api.github.com/users/wordpress-mobile/repos","events_url":"https://api.github.com/users/wordpress-mobile/events{/privacy}","received_events_url":"https://api.github.com/users/wordpress-mobile/received_events","type":"Organization","site_admin":false},"repo":{"id":9306568,"name":"WordPress-Android","full_name":"wordpress-mobile/WordPress-Android","owner":{"login":"wordpress-mobile","id":1306301,"avatar_url":"https://avatars.githubusercontent.com/u/1306301?v=3","gravatar_id":"","url":"https://api.github.com/users/wordpress-mobile","html_url":"https://github.com/wordpress-mobile","followers_url":"https://api.github.com/users/wordpress-mobile/followers","following_url":"https://api.github.com/users/wordpress-mobile/following{/other_user}","gists_url":"https://api.github.com/users/wordpress-mobile/gists{/gist_id}","starred_url":"https://api.github.com/users/wordpress-mobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wordpress-mobile/subscriptions","organizations_url":"https://api.github.com/users/wordpress-mobile/orgs","repos_url":"https://api.github.com/users/wordpress-mobile/repos","events_url":"https://api.github.com/users/wordpress-mobile/events{/privacy}","received_events_url":"https://api.github.com/users/wordpress-mobile/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wordpress-mobile/WordPress-Android","description":"WordPress for Android","fork":false,"url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android","forks_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/forks","keys_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/teams","hooks_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/hooks","issue_events_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/issues/events{/number}","events_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/events","assignees_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/assignees{/user}","branches_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/branches{/branch}","tags_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/tags","blobs_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/git/refs{/sha}","trees_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/statuses/{sha}","languages_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/languages","stargazers_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/stargazers","contributors_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/contributors","subscribers_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/subscribers","subscription_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/subscription","commits_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/commits{/sha}","git_commits_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/git/commits{/sha}","comments_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/comments{/number}","issue_comment_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/issues/comments{/number}","contents_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/contents/{+path}","compare_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/merges","archive_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/downloads","issues_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/issues{/number}","pulls_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/pulls{/number}","milestones_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/milestones{/number}","notifications_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/labels{/name}","releases_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/releases{/id}","created_at":"2013-04-08T20:52:40Z","updated_at":"2015-06-15T02:25:18Z","pushed_at":"2015-06-16T09:09:28Z","git_url":"git://github.com/wordpress-mobile/WordPress-Android.git","ssh_url":"git@github.com:wordpress-mobile/WordPress-Android.git","clone_url":"https://github.com/wordpress-mobile/WordPress-Android.git","svn_url":"https://github.com/wordpress-mobile/WordPress-Android","homepage":"http://android.wordpress.org","size":226972,"stargazers_count":754,"watchers_count":754,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":492,"mirror_url":null,"open_issues_count":120,"forks":492,"open_issues":120,"watchers":754,"default_branch":"develop"}},"base":{"label":"wordpress-mobile:hotfix/4.1.1","ref":"hotfix/4.1.1","sha":"012672a05ce5d4df69cba1e451b9e96c552fa01f","user":{"login":"wordpress-mobile","id":1306301,"avatar_url":"https://avatars.githubusercontent.com/u/1306301?v=3","gravatar_id":"","url":"https://api.github.com/users/wordpress-mobile","html_url":"https://github.com/wordpress-mobile","followers_url":"https://api.github.com/users/wordpress-mobile/followers","following_url":"https://api.github.com/users/wordpress-mobile/following{/other_user}","gists_url":"https://api.github.com/users/wordpress-mobile/gists{/gist_id}","starred_url":"https://api.github.com/users/wordpress-mobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wordpress-mobile/subscriptions","organizations_url":"https://api.github.com/users/wordpress-mobile/orgs","repos_url":"https://api.github.com/users/wordpress-mobile/repos","events_url":"https://api.github.com/users/wordpress-mobile/events{/privacy}","received_events_url":"https://api.github.com/users/wordpress-mobile/received_events","type":"Organization","site_admin":false},"repo":{"id":9306568,"name":"WordPress-Android","full_name":"wordpress-mobile/WordPress-Android","owner":{"login":"wordpress-mobile","id":1306301,"avatar_url":"https://avatars.githubusercontent.com/u/1306301?v=3","gravatar_id":"","url":"https://api.github.com/users/wordpress-mobile","html_url":"https://github.com/wordpress-mobile","followers_url":"https://api.github.com/users/wordpress-mobile/followers","following_url":"https://api.github.com/users/wordpress-mobile/following{/other_user}","gists_url":"https://api.github.com/users/wordpress-mobile/gists{/gist_id}","starred_url":"https://api.github.com/users/wordpress-mobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wordpress-mobile/subscriptions","organizations_url":"https://api.github.com/users/wordpress-mobile/orgs","repos_url":"https://api.github.com/users/wordpress-mobile/repos","events_url":"https://api.github.com/users/wordpress-mobile/events{/privacy}","received_events_url":"https://api.github.com/users/wordpress-mobile/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wordpress-mobile/WordPress-Android","description":"WordPress for Android","fork":false,"url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android","forks_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/forks","keys_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/teams","hooks_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/hooks","issue_events_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/issues/events{/number}","events_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/events","assignees_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/assignees{/user}","branches_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/branches{/branch}","tags_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/tags","blobs_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/git/refs{/sha}","trees_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/statuses/{sha}","languages_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/languages","stargazers_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/stargazers","contributors_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/contributors","subscribers_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/subscribers","subscription_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/subscription","commits_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/commits{/sha}","git_commits_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/git/commits{/sha}","comments_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/comments{/number}","issue_comment_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/issues/comments{/number}","contents_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/contents/{+path}","compare_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/merges","archive_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/downloads","issues_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/issues{/number}","pulls_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/pulls{/number}","milestones_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/milestones{/number}","notifications_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/labels{/name}","releases_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/releases{/id}","created_at":"2013-04-08T20:52:40Z","updated_at":"2015-06-15T02:25:18Z","pushed_at":"2015-06-16T09:09:28Z","git_url":"git://github.com/wordpress-mobile/WordPress-Android.git","ssh_url":"git@github.com:wordpress-mobile/WordPress-Android.git","clone_url":"https://github.com/wordpress-mobile/WordPress-Android.git","svn_url":"https://github.com/wordpress-mobile/WordPress-Android","homepage":"http://android.wordpress.org","size":226972,"stargazers_count":754,"watchers_count":754,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":492,"mirror_url":null,"open_issues_count":120,"forks":492,"open_issues":120,"watchers":754,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/pulls/2863"},"html":{"href":"https://github.com/wordpress-mobile/WordPress-Android/pull/2863"},"issue":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/issues/2863"},"comments":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/issues/2863/comments"},"review_comments":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/pulls/2863/comments"},"review_comment":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/pulls/2863/commits"},"statuses":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-Android/statuses/7d3d7553e52c11cabfb4a49e110f75e01a2b12af"}}}}