{"action":"created","comment":{"url":"https://api.github.com/repos/stripe/stripe-android/pulls/comments/102336312","pull_request_review_id":23089903,"id":102336312,"diff_hunk":"@@ -171,10 +186,78 @@ protected void onRestoreInstanceState(Parcelable state) {\n         }\n     }\n \n+    /**\n+     * Checks on the horizontal position of a touch event to see if\n+     * that event needs to be associated with one of the controls even\n+     * without having actually touched it. This essentially gives a larger\n+     * touch surface to the controls. We return {@code null} if the user touches\n+     * actually inside the widget because no interception is necessary - the touch will\n+     * naturally give focus to that control, and we don't want to interfere with what\n+     * Android will naturally do in response to that touch.\n+     *\n+     * @param touchX distance in pixels from the left side of this control\n+     * @return a {@link StripeEditText} that needs to request focus, or {@code null}\n+     * if no such request is necessary.\n+     */\n+    @VisibleForTesting\n+    @Nullable\n+    StripeEditText getFocusRequestOnTouch(int touchX) {\n+        int frameStart = mFrameLayout.getLeft();\n+\n+        if (mCardNumberIsViewed) {\n+            // Then our view is\n+            // |CARDVIEW||space||DATEVIEW|\n+\n+            if (touchX < frameStart + mPlacementParameters.cardWidth) {\n+                // Then the card edit view will already handle this touch.\n+                return null;\n+            } else if (touchX < mPlacementParameters.cardTouchBufferLimit){\n+                // Then we want to act like this was a touch on the card view\n+                return mCardNumberEditText;\n+            } else if (touchX < mPlacementParameters.dateStartPosition) {\n+                // Then we act like this was a touch on the date editor.\n+                return mExpiryDateEditText;\n+            } else {\n+                // Then the date editor will already handle this touch.\n+                return null;\n+            }\n+        } else {\n+            // Our view is\n+            // |PEEK||space||DATE||space||CVC|\n+            if (touchX < frameStart + mPlacementParameters.peekCardWidth) {\n+                // This was a touch on the card number editor, so we don't need to hanlde it.","path":"stripe/src/main/java/com/stripe/android/view/CardInputWidget.java","position":72,"original_position":72,"commit_id":"0cfa65710d44bdab4ab37e216f5774c6b81d9906","original_commit_id":"0cfa65710d44bdab4ab37e216f5774c6b81d9906","user":{"login":"brandur-stripe","id":23105990,"avatar_url":"https://avatars.githubusercontent.com/u/23105990?v=3","gravatar_id":"","url":"https://api.github.com/users/brandur-stripe","html_url":"https://github.com/brandur-stripe","followers_url":"https://api.github.com/users/brandur-stripe/followers","following_url":"https://api.github.com/users/brandur-stripe/following{/other_user}","gists_url":"https://api.github.com/users/brandur-stripe/gists{/gist_id}","starred_url":"https://api.github.com/users/brandur-stripe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brandur-stripe/subscriptions","organizations_url":"https://api.github.com/users/brandur-stripe/orgs","repos_url":"https://api.github.com/users/brandur-stripe/repos","events_url":"https://api.github.com/users/brandur-stripe/events{/privacy}","received_events_url":"https://api.github.com/users/brandur-stripe/received_events","type":"User","site_admin":false},"body":"*\"handle it\"","created_at":"2017-02-21T22:32:54Z","updated_at":"2017-02-21T22:39:03Z","html_url":"https://github.com/stripe/stripe-android/pull/148#discussion_r102336312","pull_request_url":"https://api.github.com/repos/stripe/stripe-android/pulls/148","_links":{"self":{"href":"https://api.github.com/repos/stripe/stripe-android/pulls/comments/102336312"},"html":{"href":"https://github.com/stripe/stripe-android/pull/148#discussion_r102336312"},"pull_request":{"href":"https://api.github.com/repos/stripe/stripe-android/pulls/148"}}},"pull_request":{"url":"https://api.github.com/repos/stripe/stripe-android/pulls/148","id":107238437,"html_url":"https://github.com/stripe/stripe-android/pull/148","diff_url":"https://github.com/stripe/stripe-android/pull/148.diff","patch_url":"https://github.com/stripe/stripe-android/pull/148.patch","issue_url":"https://api.github.com/repos/stripe/stripe-android/issues/148","number":148,"state":"open","locked":false,"title":"increasing the effective touch size of the controls after design feedback","user":{"login":"mrmcduff-stripe","id":23323692,"avatar_url":"https://avatars.githubusercontent.com/u/23323692?v=3","gravatar_id":"","url":"https://api.github.com/users/mrmcduff-stripe","html_url":"https://github.com/mrmcduff-stripe","followers_url":"https://api.github.com/users/mrmcduff-stripe/followers","following_url":"https://api.github.com/users/mrmcduff-stripe/following{/other_user}","gists_url":"https://api.github.com/users/mrmcduff-stripe/gists{/gist_id}","starred_url":"https://api.github.com/users/mrmcduff-stripe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrmcduff-stripe/subscriptions","organizations_url":"https://api.github.com/users/mrmcduff-stripe/orgs","repos_url":"https://api.github.com/users/mrmcduff-stripe/repos","events_url":"https://api.github.com/users/mrmcduff-stripe/events{/privacy}","received_events_url":"https://api.github.com/users/mrmcduff-stripe/received_events","type":"User","site_admin":false},"body":"r? @brandur-stripe \r\ncc @sjayaraman-stripe \r\n\r\nAdding a method to guess what the user is really trying to touch when poking around the control, as large screens can make the edit text size rather small compared to the actual screen surface of the controls.\r\n\r\nThe algorithm is as follows: if you actually touch a control, I do nothing. (Android handles that pretty well). If you miss the control, I have \"slop\" areas that are exactly 1/2 the width of the space between the two controls. So if you touch closer to the card widget than the date widget, I'll interpret that as an  attempt to touch the card widget. After poking around, this feels pretty intuitive, and is hopefully invisible to the user (who will think that she touched exactly what she meant to touch).\r\n","created_at":"2017-02-21T17:27:12Z","updated_at":"2017-02-21T22:39:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8aaf1575930e6f01b2d764c911750c1fe5cc6999","assignee":{"login":"brandur-stripe","id":23105990,"avatar_url":"https://avatars.githubusercontent.com/u/23105990?v=3","gravatar_id":"","url":"https://api.github.com/users/brandur-stripe","html_url":"https://github.com/brandur-stripe","followers_url":"https://api.github.com/users/brandur-stripe/followers","following_url":"https://api.github.com/users/brandur-stripe/following{/other_user}","gists_url":"https://api.github.com/users/brandur-stripe/gists{/gist_id}","starred_url":"https://api.github.com/users/brandur-stripe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brandur-stripe/subscriptions","organizations_url":"https://api.github.com/users/brandur-stripe/orgs","repos_url":"https://api.github.com/users/brandur-stripe/repos","events_url":"https://api.github.com/users/brandur-stripe/events{/privacy}","received_events_url":"https://api.github.com/users/brandur-stripe/received_events","type":"User","site_admin":false},"assignees":[{"login":"brandur-stripe","id":23105990,"avatar_url":"https://avatars.githubusercontent.com/u/23105990?v=3","gravatar_id":"","url":"https://api.github.com/users/brandur-stripe","html_url":"https://github.com/brandur-stripe","followers_url":"https://api.github.com/users/brandur-stripe/followers","following_url":"https://api.github.com/users/brandur-stripe/following{/other_user}","gists_url":"https://api.github.com/users/brandur-stripe/gists{/gist_id}","starred_url":"https://api.github.com/users/brandur-stripe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brandur-stripe/subscriptions","organizations_url":"https://api.github.com/users/brandur-stripe/orgs","repos_url":"https://api.github.com/users/brandur-stripe/repos","events_url":"https://api.github.com/users/brandur-stripe/events{/privacy}","received_events_url":"https://api.github.com/users/brandur-stripe/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/stripe/stripe-android/pulls/148/commits","review_comments_url":"https://api.github.com/repos/stripe/stripe-android/pulls/148/comments","review_comment_url":"https://api.github.com/repos/stripe/stripe-android/pulls/comments{/number}","comments_url":"https://api.github.com/repos/stripe/stripe-android/issues/148/comments","statuses_url":"https://api.github.com/repos/stripe/stripe-android/statuses/0cfa65710d44bdab4ab37e216f5774c6b81d9906","head":{"label":"stripe:touchdelegates","ref":"touchdelegates","sha":"0cfa65710d44bdab4ab37e216f5774c6b81d9906","user":{"login":"stripe","id":856813,"avatar_url":"https://avatars.githubusercontent.com/u/856813?v=3","gravatar_id":"","url":"https://api.github.com/users/stripe","html_url":"https://github.com/stripe","followers_url":"https://api.github.com/users/stripe/followers","following_url":"https://api.github.com/users/stripe/following{/other_user}","gists_url":"https://api.github.com/users/stripe/gists{/gist_id}","starred_url":"https://api.github.com/users/stripe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stripe/subscriptions","organizations_url":"https://api.github.com/users/stripe/orgs","repos_url":"https://api.github.com/users/stripe/repos","events_url":"https://api.github.com/users/stripe/events{/privacy}","received_events_url":"https://api.github.com/users/stripe/received_events","type":"Organization","site_admin":false},"repo":{"id":6926049,"name":"stripe-android","full_name":"stripe/stripe-android","owner":{"login":"stripe","id":856813,"avatar_url":"https://avatars.githubusercontent.com/u/856813?v=3","gravatar_id":"","url":"https://api.github.com/users/stripe","html_url":"https://github.com/stripe","followers_url":"https://api.github.com/users/stripe/followers","following_url":"https://api.github.com/users/stripe/following{/other_user}","gists_url":"https://api.github.com/users/stripe/gists{/gist_id}","starred_url":"https://api.github.com/users/stripe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stripe/subscriptions","organizations_url":"https://api.github.com/users/stripe/orgs","repos_url":"https://api.github.com/users/stripe/repos","events_url":"https://api.github.com/users/stripe/events{/privacy}","received_events_url":"https://api.github.com/users/stripe/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/stripe/stripe-android","description":"Stripe Android bindings","fork":false,"url":"https://api.github.com/repos/stripe/stripe-android","forks_url":"https://api.github.com/repos/stripe/stripe-android/forks","keys_url":"https://api.github.com/repos/stripe/stripe-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stripe/stripe-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stripe/stripe-android/teams","hooks_url":"https://api.github.com/repos/stripe/stripe-android/hooks","issue_events_url":"https://api.github.com/repos/stripe/stripe-android/issues/events{/number}","events_url":"https://api.github.com/repos/stripe/stripe-android/events","assignees_url":"https://api.github.com/repos/stripe/stripe-android/assignees{/user}","branches_url":"https://api.github.com/repos/stripe/stripe-android/branches{/branch}","tags_url":"https://api.github.com/repos/stripe/stripe-android/tags","blobs_url":"https://api.github.com/repos/stripe/stripe-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stripe/stripe-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stripe/stripe-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/stripe/stripe-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stripe/stripe-android/statuses/{sha}","languages_url":"https://api.github.com/repos/stripe/stripe-android/languages","stargazers_url":"https://api.github.com/repos/stripe/stripe-android/stargazers","contributors_url":"https://api.github.com/repos/stripe/stripe-android/contributors","subscribers_url":"https://api.github.com/repos/stripe/stripe-android/subscribers","subscription_url":"https://api.github.com/repos/stripe/stripe-android/subscription","commits_url":"https://api.github.com/repos/stripe/stripe-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/stripe/stripe-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/stripe/stripe-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/stripe/stripe-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/stripe/stripe-android/contents/{+path}","compare_url":"https://api.github.com/repos/stripe/stripe-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stripe/stripe-android/merges","archive_url":"https://api.github.com/repos/stripe/stripe-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stripe/stripe-android/downloads","issues_url":"https://api.github.com/repos/stripe/stripe-android/issues{/number}","pulls_url":"https://api.github.com/repos/stripe/stripe-android/pulls{/number}","milestones_url":"https://api.github.com/repos/stripe/stripe-android/milestones{/number}","notifications_url":"https://api.github.com/repos/stripe/stripe-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stripe/stripe-android/labels{/name}","releases_url":"https://api.github.com/repos/stripe/stripe-android/releases{/id}","deployments_url":"https://api.github.com/repos/stripe/stripe-android/deployments","created_at":"2012-11-29T18:11:30Z","updated_at":"2017-02-17T05:03:35Z","pushed_at":"2017-02-21T20:01:14Z","git_url":"git://github.com/stripe/stripe-android.git","ssh_url":"git@github.com:stripe/stripe-android.git","clone_url":"https://github.com/stripe/stripe-android.git","svn_url":"https://github.com/stripe/stripe-android","homepage":"https://stripe.com","size":8228,"stargazers_count":241,"watchers_count":241,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":169,"mirror_url":null,"open_issues_count":3,"forks":169,"open_issues":3,"watchers":241,"default_branch":"master"}},"base":{"label":"stripe:cardreader","ref":"cardreader","sha":"3d628b45feb885f0ab06c6431ec36c7428944d69","user":{"login":"stripe","id":856813,"avatar_url":"https://avatars.githubusercontent.com/u/856813?v=3","gravatar_id":"","url":"https://api.github.com/users/stripe","html_url":"https://github.com/stripe","followers_url":"https://api.github.com/users/stripe/followers","following_url":"https://api.github.com/users/stripe/following{/other_user}","gists_url":"https://api.github.com/users/stripe/gists{/gist_id}","starred_url":"https://api.github.com/users/stripe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stripe/subscriptions","organizations_url":"https://api.github.com/users/stripe/orgs","repos_url":"https://api.github.com/users/stripe/repos","events_url":"https://api.github.com/users/stripe/events{/privacy}","received_events_url":"https://api.github.com/users/stripe/received_events","type":"Organization","site_admin":false},"repo":{"id":6926049,"name":"stripe-android","full_name":"stripe/stripe-android","owner":{"login":"stripe","id":856813,"avatar_url":"https://avatars.githubusercontent.com/u/856813?v=3","gravatar_id":"","url":"https://api.github.com/users/stripe","html_url":"https://github.com/stripe","followers_url":"https://api.github.com/users/stripe/followers","following_url":"https://api.github.com/users/stripe/following{/other_user}","gists_url":"https://api.github.com/users/stripe/gists{/gist_id}","starred_url":"https://api.github.com/users/stripe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stripe/subscriptions","organizations_url":"https://api.github.com/users/stripe/orgs","repos_url":"https://api.github.com/users/stripe/repos","events_url":"https://api.github.com/users/stripe/events{/privacy}","received_events_url":"https://api.github.com/users/stripe/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/stripe/stripe-android","description":"Stripe Android bindings","fork":false,"url":"https://api.github.com/repos/stripe/stripe-android","forks_url":"https://api.github.com/repos/stripe/stripe-android/forks","keys_url":"https://api.github.com/repos/stripe/stripe-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stripe/stripe-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stripe/stripe-android/teams","hooks_url":"https://api.github.com/repos/stripe/stripe-android/hooks","issue_events_url":"https://api.github.com/repos/stripe/stripe-android/issues/events{/number}","events_url":"https://api.github.com/repos/stripe/stripe-android/events","assignees_url":"https://api.github.com/repos/stripe/stripe-android/assignees{/user}","branches_url":"https://api.github.com/repos/stripe/stripe-android/branches{/branch}","tags_url":"https://api.github.com/repos/stripe/stripe-android/tags","blobs_url":"https://api.github.com/repos/stripe/stripe-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stripe/stripe-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stripe/stripe-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/stripe/stripe-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stripe/stripe-android/statuses/{sha}","languages_url":"https://api.github.com/repos/stripe/stripe-android/languages","stargazers_url":"https://api.github.com/repos/stripe/stripe-android/stargazers","contributors_url":"https://api.github.com/repos/stripe/stripe-android/contributors","subscribers_url":"https://api.github.com/repos/stripe/stripe-android/subscribers","subscription_url":"https://api.github.com/repos/stripe/stripe-android/subscription","commits_url":"https://api.github.com/repos/stripe/stripe-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/stripe/stripe-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/stripe/stripe-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/stripe/stripe-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/stripe/stripe-android/contents/{+path}","compare_url":"https://api.github.com/repos/stripe/stripe-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stripe/stripe-android/merges","archive_url":"https://api.github.com/repos/stripe/stripe-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stripe/stripe-android/downloads","issues_url":"https://api.github.com/repos/stripe/stripe-android/issues{/number}","pulls_url":"https://api.github.com/repos/stripe/stripe-android/pulls{/number}","milestones_url":"https://api.github.com/repos/stripe/stripe-android/milestones{/number}","notifications_url":"https://api.github.com/repos/stripe/stripe-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stripe/stripe-android/labels{/name}","releases_url":"https://api.github.com/repos/stripe/stripe-android/releases{/id}","deployments_url":"https://api.github.com/repos/stripe/stripe-android/deployments","created_at":"2012-11-29T18:11:30Z","updated_at":"2017-02-17T05:03:35Z","pushed_at":"2017-02-21T20:01:14Z","git_url":"git://github.com/stripe/stripe-android.git","ssh_url":"git@github.com:stripe/stripe-android.git","clone_url":"https://github.com/stripe/stripe-android.git","svn_url":"https://github.com/stripe/stripe-android","homepage":"https://stripe.com","size":8228,"stargazers_count":241,"watchers_count":241,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":169,"mirror_url":null,"open_issues_count":3,"forks":169,"open_issues":3,"watchers":241,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/stripe/stripe-android/pulls/148"},"html":{"href":"https://github.com/stripe/stripe-android/pull/148"},"issue":{"href":"https://api.github.com/repos/stripe/stripe-android/issues/148"},"comments":{"href":"https://api.github.com/repos/stripe/stripe-android/issues/148/comments"},"review_comments":{"href":"https://api.github.com/repos/stripe/stripe-android/pulls/148/comments"},"review_comment":{"href":"https://api.github.com/repos/stripe/stripe-android/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/stripe/stripe-android/pulls/148/commits"},"statuses":{"href":"https://api.github.com/repos/stripe/stripe-android/statuses/0cfa65710d44bdab4ab37e216f5774c6b81d9906"}}}}
{"actor":{"display_login":"brandur-stripe"}}