{"action":"created","comment":{"url":"https://api.github.com/repos/dmcinnis/Draw/pulls/comments/79902572","id":79902572,"diff_hunk":"@@ -9,138 +9,104 @@\n import android.view.ViewGroup;\n import android.widget.ImageButton;\n \n+import java.util.List;\n+\n+import butterknife.BindView;\n+import butterknife.BindViews;\n+import butterknife.ButterKnife;\n+import butterknife.OnClick;\n+import butterknife.Unbinder;\n+\n \n public class DrawFragment extends Fragment {\n \n-    private DrawView drawView;\n-    private ImageButton undoButton;\n-    private ImageButton colorPickButton;\n-    private ImageButton brushPickButton;\n-    private ImageButton colorOption1;\n-    private ImageButton colorOption2;\n-    private ImageButton colorOption3;\n-    private ImageButton brushOption1;\n-    private ImageButton brushOption2;\n-    private ImageButton brushOption3;\n+    @BindView(R.id.drawview)\n+    DrawView drawView;\n+\n+    @BindViews({ R.id.undo_button, R.id.pickcolor_button, R.id.pickbrush_button })\n+    List<ImageButton> optionButtons;\n+\n+    @BindViews({ R.id.color_option_button_1, R.id.color_option_button_2, R.id.color_option_button_3 })\n+    List<ImageButton> colorOptionButtons;\n+\n+    @BindViews({ R.id.brush_option_button_1, R.id.brush_option_button_2, R.id.brush_option_button_3 })\n+    List<ImageButton> brushOptionButtons;\n+\n+    private Unbinder unbinder;\n \n \n     public DrawFragment() {\n     }\n \n-\n     @Override\n-    public View onCreateView(LayoutInflater inflater, ViewGroup container,\n+    public View onCreateView(LayoutInflater inflater,\n+                             ViewGroup container,\n                              Bundle savedInstanceState) {\n         View rootView = inflater.inflate(R.layout.fragment_main, container, false);\n-\n-        //butterknife!, probably bind outside\n-        drawView = (DrawView) rootView.findViewById(R.id.drawview);\n-        undoButton = (ImageButton) rootView.findViewById(R.id.undo_button);\n-\n-        colorPickButton = (ImageButton) rootView.findViewById(R.id.pickcolor_button);\n-        colorOption1 = (ImageButton) rootView.findViewById(R.id.color_option_button_1);\n-        colorOption2 = (ImageButton) rootView.findViewById(R.id.color_option_button_2);\n-        colorOption3 = (ImageButton) rootView.findViewById(R.id.color_option_button_3);\n-        brushPickButton = (ImageButton) rootView.findViewById(R.id.pickbrush_button);\n-        brushOption1 = (ImageButton) rootView.findViewById(R.id.brush_option_button_1);\n-        brushOption2 = (ImageButton) rootView.findViewById(R.id.brush_option_button_2);\n-        brushOption3 = (ImageButton) rootView.findViewById(R.id.brush_option_button_3);\n-\n-        colorPickButton.setOnClickListener(new View.OnClickListener() {\n-            @Override\n-            public void onClick(View v) {\n-                toggleVisibility(v);\n-            }\n-        });\n-        brushPickButton.setOnClickListener(new View.OnClickListener() {\n-            @Override\n-            public void onClick(View v) {\n-                toggleVisibility(v);\n-            }\n-        });\n-        colorOption1.setOnClickListener(new View.OnClickListener() {\n-            @Override\n-            public void onClick(View v) {\n-                drawView.setPaintColor(Color.RED);\n-                toggleVisibility(v);\n-            }\n-        });\n-        colorOption2.setOnClickListener(new View.OnClickListener() {\n-            @Override\n-            public void onClick(View v) {\n-                drawView.setPaintColor(Color.BLUE);\n-                toggleVisibility(v);\n-            }\n-        });\n-        colorOption3.setOnClickListener(new View.OnClickListener() {\n-            @Override\n-            public void onClick(View v) {\n-                drawView.setPaintColor(Color.GREEN);\n-                toggleVisibility(v);\n-            }\n-        });\n-        brushOption1.setOnClickListener(new View.OnClickListener() {\n-            @Override\n-            public void onClick(View v) {\n-                drawView.setBrushWidth(50);\n-                toggleVisibility(v);\n-            }\n-        });\n-        brushOption2.setOnClickListener(new View.OnClickListener() {\n-            @Override\n-            public void onClick(View v) {\n-                drawView.setBrushWidth(90);\n-                toggleVisibility(v);\n-            }\n-        });\n-        brushOption3.setOnClickListener(new View.OnClickListener() {\n-            @Override\n-            public void onClick(View v) {\n-                drawView.setBrushWidth(130);\n-                toggleVisibility(v);\n-            }\n-        });\n-        undoButton.setOnClickListener(new View.OnClickListener() {\n-            @Override\n-            public void onClick(View v) {\n-                drawView.undoStroke();\n-            }\n-        });\n+        unbinder = ButterKnife.bind(this, rootView);\n         return rootView;\n     }\n \n-    public void toggleVisibility(View v) {\n-        if (v == colorPickButton ||\n-                v == colorOption1 ||\n-                v == colorOption2 ||\n-                v == colorOption3) {\n-            if (colorOption1.getVisibility() == View.GONE ||\n-                    colorOption2.getVisibility() == View.GONE ||\n-                    colorOption3.getVisibility() == View.GONE) {\n-                colorOption1.setVisibility(View.VISIBLE);\n-                colorOption2.setVisibility(View.VISIBLE);\n-                colorOption3.setVisibility(View.VISIBLE);\n-            } else {\n-                colorOption1.setVisibility(View.GONE);\n-                colorOption2.setVisibility(View.GONE);\n-                colorOption3.setVisibility(View.GONE);\n-            }\n-        } else if (v == brushPickButton ||\n-                    v == brushOption1 ||\n-                    v == brushOption2 ||\n-                    v == brushOption3) {\n-            if (brushOption1.getVisibility() == View.GONE ||\n-                    brushOption2.getVisibility() == View.GONE ||\n-                    brushOption3.getVisibility() == View.GONE) {\n-                brushOption1.setVisibility(View.VISIBLE);\n-                brushOption2.setVisibility(View.VISIBLE);\n-                brushOption3.setVisibility(View.VISIBLE);\n-            } else {\n-                brushOption1.setVisibility(View.GONE);\n-                brushOption2.setVisibility(View.GONE);\n-                brushOption3.setVisibility(View.GONE);\n+    @Override\n+    public void onDestroyView() {\n+        super.onDestroyView();\n+        unbinder.unbind();\n+    }\n+\n+    static final ButterKnife.Action<View> TOGGLEVISIBILITY = new ButterKnife.Action<View>() {","path":"app/src/main/java/me/drewm/draw/DrawFragment.java","position":164,"original_position":164,"commit_id":"0c2a53cb7654b8b413cab922968003b56ae51224","original_commit_id":"0c2a53cb7654b8b413cab922968003b56ae51224","user":{"login":"prfarlow1","id":6036075,"avatar_url":"https://avatars.githubusercontent.com/u/6036075?v=3","gravatar_id":"","url":"https://api.github.com/users/prfarlow1","html_url":"https://github.com/prfarlow1","followers_url":"https://api.github.com/users/prfarlow1/followers","following_url":"https://api.github.com/users/prfarlow1/following{/other_user}","gists_url":"https://api.github.com/users/prfarlow1/gists{/gist_id}","starred_url":"https://api.github.com/users/prfarlow1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prfarlow1/subscriptions","organizations_url":"https://api.github.com/users/prfarlow1/orgs","repos_url":"https://api.github.com/users/prfarlow1/repos","events_url":"https://api.github.com/users/prfarlow1/events{/privacy}","received_events_url":"https://api.github.com/users/prfarlow1/received_events","type":"User","site_admin":false},"body":"This is awesome! Really great use of the DRY principle","created_at":"2016-09-21T18:36:18Z","updated_at":"2016-09-21T18:41:29Z","html_url":"https://github.com/dmcinnis/Draw/pull/1#discussion_r79902572","pull_request_url":"https://api.github.com/repos/dmcinnis/Draw/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/dmcinnis/Draw/pulls/comments/79902572"},"html":{"href":"https://github.com/dmcinnis/Draw/pull/1#discussion_r79902572"},"pull_request":{"href":"https://api.github.com/repos/dmcinnis/Draw/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/dmcinnis/Draw/pulls/1","id":86193976,"html_url":"https://github.com/dmcinnis/Draw/pull/1","diff_url":"https://github.com/dmcinnis/Draw/pull/1.diff","patch_url":"https://github.com/dmcinnis/Draw/pull/1.patch","issue_url":"https://api.github.com/repos/dmcinnis/Draw/issues/1","number":1,"state":"open","locked":false,"title":"Butterknife","user":{"login":"dmcinnis","id":4066874,"avatar_url":"https://avatars.githubusercontent.com/u/4066874?v=3","gravatar_id":"","url":"https://api.github.com/users/dmcinnis","html_url":"https://github.com/dmcinnis","followers_url":"https://api.github.com/users/dmcinnis/followers","following_url":"https://api.github.com/users/dmcinnis/following{/other_user}","gists_url":"https://api.github.com/users/dmcinnis/gists{/gist_id}","starred_url":"https://api.github.com/users/dmcinnis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmcinnis/subscriptions","organizations_url":"https://api.github.com/users/dmcinnis/orgs","repos_url":"https://api.github.com/users/dmcinnis/repos","events_url":"https://api.github.com/users/dmcinnis/events{/privacy}","received_events_url":"https://api.github.com/users/dmcinnis/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-09-21T16:09:49Z","updated_at":"2016-09-21T18:41:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b6ead3f97160df5299ea19c58fc9716ff3d3a867","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/dmcinnis/Draw/pulls/1/commits","review_comments_url":"https://api.github.com/repos/dmcinnis/Draw/pulls/1/comments","review_comment_url":"https://api.github.com/repos/dmcinnis/Draw/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dmcinnis/Draw/issues/1/comments","statuses_url":"https://api.github.com/repos/dmcinnis/Draw/statuses/0c2a53cb7654b8b413cab922968003b56ae51224","head":{"label":"dmcinnis:butterknife","ref":"butterknife","sha":"0c2a53cb7654b8b413cab922968003b56ae51224","user":{"login":"dmcinnis","id":4066874,"avatar_url":"https://avatars.githubusercontent.com/u/4066874?v=3","gravatar_id":"","url":"https://api.github.com/users/dmcinnis","html_url":"https://github.com/dmcinnis","followers_url":"https://api.github.com/users/dmcinnis/followers","following_url":"https://api.github.com/users/dmcinnis/following{/other_user}","gists_url":"https://api.github.com/users/dmcinnis/gists{/gist_id}","starred_url":"https://api.github.com/users/dmcinnis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmcinnis/subscriptions","organizations_url":"https://api.github.com/users/dmcinnis/orgs","repos_url":"https://api.github.com/users/dmcinnis/repos","events_url":"https://api.github.com/users/dmcinnis/events{/privacy}","received_events_url":"https://api.github.com/users/dmcinnis/received_events","type":"User","site_admin":false},"repo":{"id":68623469,"name":"Draw","full_name":"dmcinnis/Draw","owner":{"login":"dmcinnis","id":4066874,"avatar_url":"https://avatars.githubusercontent.com/u/4066874?v=3","gravatar_id":"","url":"https://api.github.com/users/dmcinnis","html_url":"https://github.com/dmcinnis","followers_url":"https://api.github.com/users/dmcinnis/followers","following_url":"https://api.github.com/users/dmcinnis/following{/other_user}","gists_url":"https://api.github.com/users/dmcinnis/gists{/gist_id}","starred_url":"https://api.github.com/users/dmcinnis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmcinnis/subscriptions","organizations_url":"https://api.github.com/users/dmcinnis/orgs","repos_url":"https://api.github.com/users/dmcinnis/repos","events_url":"https://api.github.com/users/dmcinnis/events{/privacy}","received_events_url":"https://api.github.com/users/dmcinnis/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dmcinnis/Draw","description":null,"fork":false,"url":"https://api.github.com/repos/dmcinnis/Draw","forks_url":"https://api.github.com/repos/dmcinnis/Draw/forks","keys_url":"https://api.github.com/repos/dmcinnis/Draw/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dmcinnis/Draw/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dmcinnis/Draw/teams","hooks_url":"https://api.github.com/repos/dmcinnis/Draw/hooks","issue_events_url":"https://api.github.com/repos/dmcinnis/Draw/issues/events{/number}","events_url":"https://api.github.com/repos/dmcinnis/Draw/events","assignees_url":"https://api.github.com/repos/dmcinnis/Draw/assignees{/user}","branches_url":"https://api.github.com/repos/dmcinnis/Draw/branches{/branch}","tags_url":"https://api.github.com/repos/dmcinnis/Draw/tags","blobs_url":"https://api.github.com/repos/dmcinnis/Draw/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dmcinnis/Draw/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dmcinnis/Draw/git/refs{/sha}","trees_url":"https://api.github.com/repos/dmcinnis/Draw/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dmcinnis/Draw/statuses/{sha}","languages_url":"https://api.github.com/repos/dmcinnis/Draw/languages","stargazers_url":"https://api.github.com/repos/dmcinnis/Draw/stargazers","contributors_url":"https://api.github.com/repos/dmcinnis/Draw/contributors","subscribers_url":"https://api.github.com/repos/dmcinnis/Draw/subscribers","subscription_url":"https://api.github.com/repos/dmcinnis/Draw/subscription","commits_url":"https://api.github.com/repos/dmcinnis/Draw/commits{/sha}","git_commits_url":"https://api.github.com/repos/dmcinnis/Draw/git/commits{/sha}","comments_url":"https://api.github.com/repos/dmcinnis/Draw/comments{/number}","issue_comment_url":"https://api.github.com/repos/dmcinnis/Draw/issues/comments{/number}","contents_url":"https://api.github.com/repos/dmcinnis/Draw/contents/{+path}","compare_url":"https://api.github.com/repos/dmcinnis/Draw/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dmcinnis/Draw/merges","archive_url":"https://api.github.com/repos/dmcinnis/Draw/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dmcinnis/Draw/downloads","issues_url":"https://api.github.com/repos/dmcinnis/Draw/issues{/number}","pulls_url":"https://api.github.com/repos/dmcinnis/Draw/pulls{/number}","milestones_url":"https://api.github.com/repos/dmcinnis/Draw/milestones{/number}","notifications_url":"https://api.github.com/repos/dmcinnis/Draw/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dmcinnis/Draw/labels{/name}","releases_url":"https://api.github.com/repos/dmcinnis/Draw/releases{/id}","deployments_url":"https://api.github.com/repos/dmcinnis/Draw/deployments","created_at":"2016-09-19T16:19:17Z","updated_at":"2016-09-19T16:19:24Z","pushed_at":"2016-09-21T16:09:50Z","git_url":"git://github.com/dmcinnis/Draw.git","ssh_url":"git@github.com:dmcinnis/Draw.git","clone_url":"https://github.com/dmcinnis/Draw.git","svn_url":"https://github.com/dmcinnis/Draw","homepage":null,"size":101,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"dmcinnis:master","ref":"master","sha":"b0992e354c3255869035a7c062fa32a095143930","user":{"login":"dmcinnis","id":4066874,"avatar_url":"https://avatars.githubusercontent.com/u/4066874?v=3","gravatar_id":"","url":"https://api.github.com/users/dmcinnis","html_url":"https://github.com/dmcinnis","followers_url":"https://api.github.com/users/dmcinnis/followers","following_url":"https://api.github.com/users/dmcinnis/following{/other_user}","gists_url":"https://api.github.com/users/dmcinnis/gists{/gist_id}","starred_url":"https://api.github.com/users/dmcinnis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmcinnis/subscriptions","organizations_url":"https://api.github.com/users/dmcinnis/orgs","repos_url":"https://api.github.com/users/dmcinnis/repos","events_url":"https://api.github.com/users/dmcinnis/events{/privacy}","received_events_url":"https://api.github.com/users/dmcinnis/received_events","type":"User","site_admin":false},"repo":{"id":68623469,"name":"Draw","full_name":"dmcinnis/Draw","owner":{"login":"dmcinnis","id":4066874,"avatar_url":"https://avatars.githubusercontent.com/u/4066874?v=3","gravatar_id":"","url":"https://api.github.com/users/dmcinnis","html_url":"https://github.com/dmcinnis","followers_url":"https://api.github.com/users/dmcinnis/followers","following_url":"https://api.github.com/users/dmcinnis/following{/other_user}","gists_url":"https://api.github.com/users/dmcinnis/gists{/gist_id}","starred_url":"https://api.github.com/users/dmcinnis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmcinnis/subscriptions","organizations_url":"https://api.github.com/users/dmcinnis/orgs","repos_url":"https://api.github.com/users/dmcinnis/repos","events_url":"https://api.github.com/users/dmcinnis/events{/privacy}","received_events_url":"https://api.github.com/users/dmcinnis/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dmcinnis/Draw","description":null,"fork":false,"url":"https://api.github.com/repos/dmcinnis/Draw","forks_url":"https://api.github.com/repos/dmcinnis/Draw/forks","keys_url":"https://api.github.com/repos/dmcinnis/Draw/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dmcinnis/Draw/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dmcinnis/Draw/teams","hooks_url":"https://api.github.com/repos/dmcinnis/Draw/hooks","issue_events_url":"https://api.github.com/repos/dmcinnis/Draw/issues/events{/number}","events_url":"https://api.github.com/repos/dmcinnis/Draw/events","assignees_url":"https://api.github.com/repos/dmcinnis/Draw/assignees{/user}","branches_url":"https://api.github.com/repos/dmcinnis/Draw/branches{/branch}","tags_url":"https://api.github.com/repos/dmcinnis/Draw/tags","blobs_url":"https://api.github.com/repos/dmcinnis/Draw/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dmcinnis/Draw/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dmcinnis/Draw/git/refs{/sha}","trees_url":"https://api.github.com/repos/dmcinnis/Draw/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dmcinnis/Draw/statuses/{sha}","languages_url":"https://api.github.com/repos/dmcinnis/Draw/languages","stargazers_url":"https://api.github.com/repos/dmcinnis/Draw/stargazers","contributors_url":"https://api.github.com/repos/dmcinnis/Draw/contributors","subscribers_url":"https://api.github.com/repos/dmcinnis/Draw/subscribers","subscription_url":"https://api.github.com/repos/dmcinnis/Draw/subscription","commits_url":"https://api.github.com/repos/dmcinnis/Draw/commits{/sha}","git_commits_url":"https://api.github.com/repos/dmcinnis/Draw/git/commits{/sha}","comments_url":"https://api.github.com/repos/dmcinnis/Draw/comments{/number}","issue_comment_url":"https://api.github.com/repos/dmcinnis/Draw/issues/comments{/number}","contents_url":"https://api.github.com/repos/dmcinnis/Draw/contents/{+path}","compare_url":"https://api.github.com/repos/dmcinnis/Draw/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dmcinnis/Draw/merges","archive_url":"https://api.github.com/repos/dmcinnis/Draw/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dmcinnis/Draw/downloads","issues_url":"https://api.github.com/repos/dmcinnis/Draw/issues{/number}","pulls_url":"https://api.github.com/repos/dmcinnis/Draw/pulls{/number}","milestones_url":"https://api.github.com/repos/dmcinnis/Draw/milestones{/number}","notifications_url":"https://api.github.com/repos/dmcinnis/Draw/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dmcinnis/Draw/labels{/name}","releases_url":"https://api.github.com/repos/dmcinnis/Draw/releases{/id}","deployments_url":"https://api.github.com/repos/dmcinnis/Draw/deployments","created_at":"2016-09-19T16:19:17Z","updated_at":"2016-09-19T16:19:24Z","pushed_at":"2016-09-21T16:09:50Z","git_url":"git://github.com/dmcinnis/Draw.git","ssh_url":"git@github.com:dmcinnis/Draw.git","clone_url":"https://github.com/dmcinnis/Draw.git","svn_url":"https://github.com/dmcinnis/Draw","homepage":null,"size":101,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dmcinnis/Draw/pulls/1"},"html":{"href":"https://github.com/dmcinnis/Draw/pull/1"},"issue":{"href":"https://api.github.com/repos/dmcinnis/Draw/issues/1"},"comments":{"href":"https://api.github.com/repos/dmcinnis/Draw/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/dmcinnis/Draw/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/dmcinnis/Draw/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dmcinnis/Draw/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/dmcinnis/Draw/statuses/0c2a53cb7654b8b413cab922968003b56ae51224"}}}}
{"actor":{"display_login":"prfarlow1"}}