{"action":"created","comment":{"url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/pulls/comments/31599327","id":31599327,"diff_hunk":"@@ -1,18 +1,117 @@\n package com.byteshaft.wrecspycam;\n \n-import android.app.Activity;\n+import android.content.res.Resources;\n+import android.graphics.Color;\n+import android.graphics.drawable.ColorDrawable;\n+import android.graphics.drawable.Drawable;\n import android.os.Bundle;\n+import android.support.v4.app.Fragment;\n+import android.support.v4.app.FragmentManager;\n+import android.support.v4.app.FragmentStatePagerAdapter;\n+import android.support.v4.view.ViewPager;\n+import android.support.v7.app.ActionBarActivity;\n \n-public class MainActivity extends Activity {\n+import it.neokree.materialtabs.MaterialTab;\n+import it.neokree.materialtabs.MaterialTabHost;\n+import it.neokree.materialtabs.MaterialTabListener;\n+\n+public class MainActivity extends ActionBarActivity implements MaterialTabListener {\n+    private ViewPager pager;\n+    private MaterialTabHost tabHost;\n+    private Resources res;\n \n     @Override\n     protected void onCreate(Bundle savedInstanceState) {\n         super.onCreate(savedInstanceState);\n+        android.support.v7.app.ActionBar actionBar = getSupportActionBar();\n+        actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor(\"#1E90FF\")));\n         setContentView(R.layout.activity_main);\n+        res = this.getResources();\n+        tabHost = (MaterialTabHost) this.findViewById(R.id.tabHost);\n+        pager = (ViewPager) this.findViewById(R.id.pager);\n+        ViewPagerAdapter pagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());\n+        pager.setAdapter(pagerAdapter);\n+        pager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {\n+            @Override\n+            public void onPageSelected(int position) {\n+                // swipe to change tab\n+                tabHost.setSelectedNavigationItem(position);\n+            }\n+        });\n+\n+        for (int i = 0; i < pagerAdapter.getCount(); i++) {\n+            tabHost.addTab(\n+                    tabHost.newTab()\n+                            .setIcon(getIcon(i))\n+                            .setTabListener(this)\n+            );\n+        }\n+    }\n+\n+    @Override\n+    public void onTabSelected(MaterialTab tab) {\n+        pager.setCurrentItem(tab.getPosition());\n     }\n \n     @Override\n-    protected void onResume() {\n-        super.onResume();\n+    public void onTabReselected(MaterialTab tab) {\n+    }\n+\n+    @Override\n+    public void onTabUnselected(MaterialTab tab) {\n+    }\n+\n+\n+    private class ViewPagerAdapter extends FragmentStatePagerAdapter {\n+        public ViewPagerAdapter(FragmentManager fm) {\n+            super(fm);\n+        }\n+\n+        public Fragment getItem(int num) {\n+            Fragment result = new Fragment();\n+            switch (num) {\n+                case 0:\n+                    result = new VideoPlayerFragment();\n+                    break;\n+                case 1:\n+                    result = new SoundRecorderFragment();\n+                    break;\n+                case 2:\n+                    result = new ImagesFragment();\n+            }\n+            return result;\n+        }\n+\n+        @Override\n+        public int getCount() {\n+            return 3;\n+        }\n+\n+        @Override\n+        public CharSequence getPageTitle(int position) {\n+            switch (position) {\n+                case 0:\n+                    return \"tab 1\";\n+                case 1:\n+                    return \"tab 2\";\n+                case 2:\n+                    return \"tab 3\";\n+                default:\n+                    return null;\n+            }\n+        }\n+    }\n+\n+\n+    private Drawable getIcon(int position) {\n+        switch (position) {\n+            case 0:\n+                return res.getDrawable(R.drawable.video_recorder);\n+            case 1:\n+                return res.getDrawable(R.drawable.sound_recorder);\n+            case 2:\n+                return res.getDrawable(R.drawable.images);\n+        }\n+        return null;","path":"app/src/main/java/com/byteshaft/wrecspycam/MainActivity.java","position":119,"original_position":119,"commit_id":"951f16e2869ad9b45977ff5774b33c8e1901f484","original_commit_id":"951f16e2869ad9b45977ff5774b33c8e1901f484","user":{"login":"om26er","id":6350837,"avatar_url":"https://avatars.githubusercontent.com/u/6350837?v=3","gravatar_id":"","url":"https://api.github.com/users/om26er","html_url":"https://github.com/om26er","followers_url":"https://api.github.com/users/om26er/followers","following_url":"https://api.github.com/users/om26er/following{/other_user}","gists_url":"https://api.github.com/users/om26er/gists{/gist_id}","starred_url":"https://api.github.com/users/om26er/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/om26er/subscriptions","organizations_url":"https://api.github.com/users/om26er/orgs","repos_url":"https://api.github.com/users/om26er/repos","events_url":"https://api.github.com/users/om26er/events{/privacy}","received_events_url":"https://api.github.com/users/om26er/received_events","type":"User","site_admin":false},"body":"instead of this return statement you should add a 'default' case to the switch statement to return null.","created_at":"2015-06-03T07:27:56Z","updated_at":"2015-06-03T07:27:56Z","html_url":"https://github.com/byteShaft/wrec-spy-cam/pull/4#discussion_r31599327","pull_request_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/byteShaft/wrec-spy-cam/pulls/comments/31599327"},"html":{"href":"https://github.com/byteShaft/wrec-spy-cam/pull/4#discussion_r31599327"},"pull_request":{"href":"https://api.github.com/repos/byteShaft/wrec-spy-cam/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/pulls/4","id":35206688,"html_url":"https://github.com/byteShaft/wrec-spy-cam/pull/4","diff_url":"https://github.com/byteShaft/wrec-spy-cam/pull/4.diff","patch_url":"https://github.com/byteShaft/wrec-spy-cam/pull/4.patch","issue_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/issues/4","number":4,"state":"open","locked":false,"title":"add audio recording , minor condition handling","user":{"login":"s9iper1","id":10771824,"avatar_url":"https://avatars.githubusercontent.com/u/10771824?v=3","gravatar_id":"","url":"https://api.github.com/users/s9iper1","html_url":"https://github.com/s9iper1","followers_url":"https://api.github.com/users/s9iper1/followers","following_url":"https://api.github.com/users/s9iper1/following{/other_user}","gists_url":"https://api.github.com/users/s9iper1/gists{/gist_id}","starred_url":"https://api.github.com/users/s9iper1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s9iper1/subscriptions","organizations_url":"https://api.github.com/users/s9iper1/orgs","repos_url":"https://api.github.com/users/s9iper1/repos","events_url":"https://api.github.com/users/s9iper1/events{/privacy}","received_events_url":"https://api.github.com/users/s9iper1/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-05-12T09:13:32Z","updated_at":"2015-06-03T07:27:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fca09f749d68a31f7248c470274447e4cf64253f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/pulls/4/commits","review_comments_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/pulls/4/comments","review_comment_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/pulls/comments{/number}","comments_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/issues/4/comments","statuses_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/statuses/951f16e2869ad9b45977ff5774b33c8e1901f484","head":{"label":"s9iper1:master","ref":"master","sha":"951f16e2869ad9b45977ff5774b33c8e1901f484","user":{"login":"s9iper1","id":10771824,"avatar_url":"https://avatars.githubusercontent.com/u/10771824?v=3","gravatar_id":"","url":"https://api.github.com/users/s9iper1","html_url":"https://github.com/s9iper1","followers_url":"https://api.github.com/users/s9iper1/followers","following_url":"https://api.github.com/users/s9iper1/following{/other_user}","gists_url":"https://api.github.com/users/s9iper1/gists{/gist_id}","starred_url":"https://api.github.com/users/s9iper1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s9iper1/subscriptions","organizations_url":"https://api.github.com/users/s9iper1/orgs","repos_url":"https://api.github.com/users/s9iper1/repos","events_url":"https://api.github.com/users/s9iper1/events{/privacy}","received_events_url":"https://api.github.com/users/s9iper1/received_events","type":"User","site_admin":false},"repo":{"id":35211624,"name":"wrec-spy-cam","full_name":"s9iper1/wrec-spy-cam","owner":{"login":"s9iper1","id":10771824,"avatar_url":"https://avatars.githubusercontent.com/u/10771824?v=3","gravatar_id":"","url":"https://api.github.com/users/s9iper1","html_url":"https://github.com/s9iper1","followers_url":"https://api.github.com/users/s9iper1/followers","following_url":"https://api.github.com/users/s9iper1/following{/other_user}","gists_url":"https://api.github.com/users/s9iper1/gists{/gist_id}","starred_url":"https://api.github.com/users/s9iper1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s9iper1/subscriptions","organizations_url":"https://api.github.com/users/s9iper1/orgs","repos_url":"https://api.github.com/users/s9iper1/repos","events_url":"https://api.github.com/users/s9iper1/events{/privacy}","received_events_url":"https://api.github.com/users/s9iper1/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/s9iper1/wrec-spy-cam","description":"Take pictures, record videos & audio while the screen is turned off. Without any visible camera preview on screen.","fork":true,"url":"https://api.github.com/repos/s9iper1/wrec-spy-cam","forks_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/forks","keys_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/keys{/key_id}","collaborators_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/teams","hooks_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/hooks","issue_events_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/issues/events{/number}","events_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/events","assignees_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/assignees{/user}","branches_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/branches{/branch}","tags_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/tags","blobs_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/git/refs{/sha}","trees_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/git/trees{/sha}","statuses_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/statuses/{sha}","languages_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/languages","stargazers_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/stargazers","contributors_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/contributors","subscribers_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/subscribers","subscription_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/subscription","commits_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/commits{/sha}","git_commits_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/git/commits{/sha}","comments_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/comments{/number}","issue_comment_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/issues/comments{/number}","contents_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/contents/{+path}","compare_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/compare/{base}...{head}","merges_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/merges","archive_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/downloads","issues_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/issues{/number}","pulls_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/pulls{/number}","milestones_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/milestones{/number}","notifications_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/labels{/name}","releases_url":"https://api.github.com/repos/s9iper1/wrec-spy-cam/releases{/id}","created_at":"2015-05-07T09:38:32Z","updated_at":"2015-06-01T12:41:48Z","pushed_at":"2015-06-03T07:04:22Z","git_url":"git://github.com/s9iper1/wrec-spy-cam.git","ssh_url":"git@github.com:s9iper1/wrec-spy-cam.git","clone_url":"https://github.com/s9iper1/wrec-spy-cam.git","svn_url":"https://github.com/s9iper1/wrec-spy-cam","homepage":"","size":346,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"byteShaft:master","ref":"master","sha":"d3645721dcfbd667386a2cc7fd7509a881205308","user":{"login":"byteShaft","id":10777599,"avatar_url":"https://avatars.githubusercontent.com/u/10777599?v=3","gravatar_id":"","url":"https://api.github.com/users/byteShaft","html_url":"https://github.com/byteShaft","followers_url":"https://api.github.com/users/byteShaft/followers","following_url":"https://api.github.com/users/byteShaft/following{/other_user}","gists_url":"https://api.github.com/users/byteShaft/gists{/gist_id}","starred_url":"https://api.github.com/users/byteShaft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/byteShaft/subscriptions","organizations_url":"https://api.github.com/users/byteShaft/orgs","repos_url":"https://api.github.com/users/byteShaft/repos","events_url":"https://api.github.com/users/byteShaft/events{/privacy}","received_events_url":"https://api.github.com/users/byteShaft/received_events","type":"Organization","site_admin":false},"repo":{"id":33403344,"name":"wrec-spy-cam","full_name":"byteShaft/wrec-spy-cam","owner":{"login":"byteShaft","id":10777599,"avatar_url":"https://avatars.githubusercontent.com/u/10777599?v=3","gravatar_id":"","url":"https://api.github.com/users/byteShaft","html_url":"https://github.com/byteShaft","followers_url":"https://api.github.com/users/byteShaft/followers","following_url":"https://api.github.com/users/byteShaft/following{/other_user}","gists_url":"https://api.github.com/users/byteShaft/gists{/gist_id}","starred_url":"https://api.github.com/users/byteShaft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/byteShaft/subscriptions","organizations_url":"https://api.github.com/users/byteShaft/orgs","repos_url":"https://api.github.com/users/byteShaft/repos","events_url":"https://api.github.com/users/byteShaft/events{/privacy}","received_events_url":"https://api.github.com/users/byteShaft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/byteShaft/wrec-spy-cam","description":"Take pictures, record videos while the screen is turned off. Without any visible camera preview on screen.","fork":false,"url":"https://api.github.com/repos/byteShaft/wrec-spy-cam","forks_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/forks","keys_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/keys{/key_id}","collaborators_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/teams","hooks_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/hooks","issue_events_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/issues/events{/number}","events_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/events","assignees_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/assignees{/user}","branches_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/branches{/branch}","tags_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/tags","blobs_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/git/refs{/sha}","trees_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/git/trees{/sha}","statuses_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/statuses/{sha}","languages_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/languages","stargazers_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/stargazers","contributors_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/contributors","subscribers_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/subscribers","subscription_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/subscription","commits_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/commits{/sha}","git_commits_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/git/commits{/sha}","comments_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/comments{/number}","issue_comment_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/issues/comments{/number}","contents_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/contents/{+path}","compare_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/compare/{base}...{head}","merges_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/merges","archive_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/downloads","issues_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/issues{/number}","pulls_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/pulls{/number}","milestones_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/milestones{/number}","notifications_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/labels{/name}","releases_url":"https://api.github.com/repos/byteShaft/wrec-spy-cam/releases{/id}","created_at":"2015-04-04T11:29:46Z","updated_at":"2015-05-08T17:39:31Z","pushed_at":"2015-06-03T07:04:22Z","git_url":"git://github.com/byteShaft/wrec-spy-cam.git","ssh_url":"git@github.com:byteShaft/wrec-spy-cam.git","clone_url":"https://github.com/byteShaft/wrec-spy-cam.git","svn_url":"https://github.com/byteShaft/wrec-spy-cam","homepage":null,"size":517,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/byteShaft/wrec-spy-cam/pulls/4"},"html":{"href":"https://github.com/byteShaft/wrec-spy-cam/pull/4"},"issue":{"href":"https://api.github.com/repos/byteShaft/wrec-spy-cam/issues/4"},"comments":{"href":"https://api.github.com/repos/byteShaft/wrec-spy-cam/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/byteShaft/wrec-spy-cam/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/byteShaft/wrec-spy-cam/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/byteShaft/wrec-spy-cam/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/byteShaft/wrec-spy-cam/statuses/951f16e2869ad9b45977ff5774b33c8e1901f484"}}}}