{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/EnglishForKid_3/pulls/comments/93854247","pull_request_review_id":14387617,"id":93854247,"diff_hunk":"@@ -1,14 +1,120 @@\n package ui.activity;\n \n+import android.app.SearchManager;\n import android.os.Bundle;\n+import android.support.design.widget.TabLayout;\n+import android.support.v4.app.Fragment;\n+import android.support.v4.app.FragmentManager;\n+import android.support.v4.app.FragmentPagerAdapter;\n+import android.support.v4.view.MenuItemCompat;\n+import android.support.v4.view.ViewPager;\n import android.support.v7.app.AppCompatActivity;\n+import android.support.v7.widget.SearchView;\n+import android.support.v7.widget.Toolbar;\n+import android.view.Menu;\n+import android.view.MenuItem;\n \n import com.framgia.englishforkid_3.R;\n \n+import java.util.ArrayList;\n+import java.util.List;\n+\n+import butterknife.BindView;\n+import butterknife.ButterKnife;\n+import ui.fragment.BaseFragment;\n+import ui.fragment.ShortStoriesFragment;\n+import ui.fragment.SongsFragment;\n+\n public class MainActivity extends AppCompatActivity {\n+    private List<Fragment> mListFragment = new ArrayList<>();\n+    private ViewPagerAdapter mViewPagerAdapter;\n+    @BindView(R.id.tool_bar)\n+    Toolbar mToolbar;\n+    @BindView(R.id.tabs)\n+    TabLayout mTabLayout;\n+    @BindView(R.id.view_pager)\n+    ViewPager mViewPager;\n+\n     @Override\n     protected void onCreate(Bundle savedInstanceState) {\n         super.onCreate(savedInstanceState);\n         setContentView(R.layout.activity_main);\n+        ButterKnife.bind(this);\n+        initData();\n+    }\n+\n+    @Override\n+    public boolean onCreateOptionsMenu(Menu menu) {\n+        getMenuInflater().inflate(R.menu.main_activity, menu);\n+        SearchView mSearchView =\n+            (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.action_search));\n+        SearchManager searchManager = (SearchManager) getSystemService(SEARCH_SERVICE);\n+        mSearchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));\n+        mSearchView.setOnQueryTextListener(mSearchListener);\n+        return true;\n+    }\n+\n+    @Override\n+    public boolean onOptionsItemSelected(MenuItem item) {\n+        switch (item.getItemId()) {\n+            case R.id.action_search:\n+                return true;\n+            default:\n+                return super.onOptionsItemSelected(item);\n+        }\n+    }\n+\n+    private void initData() {\n+        setSupportActionBar(mToolbar);\n+        setTitle(R.string.title_main_activity);\n+        String[] titles = getResources().getStringArray(R.array.title_main_activity);\n+        SongsFragment fragment = new SongsFragment();\n+        mListFragment.add(fragment);\n+        mListFragment.add(new ShortStoriesFragment());\n+        mViewPagerAdapter =\n+            new ViewPagerAdapter(getSupportFragmentManager(), titles, mListFragment);\n+        mViewPager.setAdapter(mViewPagerAdapter);\n+        mTabLayout.setupWithViewPager(mViewPager);\n+    }\n+\n+    private SearchView.OnQueryTextListener mSearchListener = new SearchView.OnQueryTextListener() {\n+        @Override\n+        public boolean onQueryTextSubmit(String query) {\n+            return false;\n+        }\n+\n+        @Override\n+        public boolean onQueryTextChange(String newText) {\n+            BaseFragment fragment =\n+                (BaseFragment) mListFragment.get(mViewPager.getCurrentItem());\n+            fragment.filter(newText);\n+            return true;\n+        }\n+    };\n+\n+    private static class ViewPagerAdapter extends FragmentPagerAdapter {\n+        private String[] mTitles;\n+        private List<Fragment> mListFragment;\n+\n+        public ViewPagerAdapter(FragmentManager fm, String[] titles, List<Fragment> fragments) {\n+            super(fm);\n+            mTitles = titles;\n+            mListFragment = fragments;\n+        }\n+\n+        @Override\n+        public Fragment getItem(int position) {\n+            return mListFragment.get(position);\n+        }\n+\n+        @Override\n+        public int getCount() {\n+            return mListFragment.size();","path":"app/src/main/java/ui/activity/MainActivity.java","position":112,"original_position":112,"commit_id":"33bcd19be8c6f2144e4661370517c960986ff200","original_commit_id":"fc722cf16285989098b3d166729a685b6163f215","user":{"login":"DoanVanToan","id":21195010,"avatar_url":"https://avatars.githubusercontent.com/u/21195010?v=3","gravatar_id":"","url":"https://api.github.com/users/DoanVanToan","html_url":"https://github.com/DoanVanToan","followers_url":"https://api.github.com/users/DoanVanToan/followers","following_url":"https://api.github.com/users/DoanVanToan/following{/other_user}","gists_url":"https://api.github.com/users/DoanVanToan/gists{/gist_id}","starred_url":"https://api.github.com/users/DoanVanToan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DoanVanToan/subscriptions","organizations_url":"https://api.github.com/users/DoanVanToan/orgs","repos_url":"https://api.github.com/users/DoanVanToan/repos","events_url":"https://api.github.com/users/DoanVanToan/events{/privacy}","received_events_url":"https://api.github.com/users/DoanVanToan/received_events","type":"User","site_admin":false},"body":"check null mListFragment","created_at":"2016-12-26T09:20:50Z","updated_at":"2016-12-26T09:25:43Z","html_url":"https://github.com/framgia/EnglishForKid_3/pull/8#discussion_r93854247","pull_request_url":"https://api.github.com/repos/framgia/EnglishForKid_3/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/framgia/EnglishForKid_3/pulls/comments/93854247"},"html":{"href":"https://github.com/framgia/EnglishForKid_3/pull/8#discussion_r93854247"},"pull_request":{"href":"https://api.github.com/repos/framgia/EnglishForKid_3/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/EnglishForKid_3/pulls/8","id":99351580,"html_url":"https://github.com/framgia/EnglishForKid_3/pull/8","diff_url":"https://github.com/framgia/EnglishForKid_3/pull/8.diff","patch_url":"https://github.com/framgia/EnglishForKid_3/pull/8.patch","issue_url":"https://api.github.com/repos/framgia/EnglishForKid_3/issues/8","number":8,"state":"open","locked":false,"title":"ref Task#93657 UI MainScreen and Search","user":{"login":"nhahv0902","id":14172027,"avatar_url":"https://avatars.githubusercontent.com/u/14172027?v=3","gravatar_id":"","url":"https://api.github.com/users/nhahv0902","html_url":"https://github.com/nhahv0902","followers_url":"https://api.github.com/users/nhahv0902/followers","following_url":"https://api.github.com/users/nhahv0902/following{/other_user}","gists_url":"https://api.github.com/users/nhahv0902/gists{/gist_id}","starred_url":"https://api.github.com/users/nhahv0902/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhahv0902/subscriptions","organizations_url":"https://api.github.com/users/nhahv0902/orgs","repos_url":"https://api.github.com/users/nhahv0902/repos","events_url":"https://api.github.com/users/nhahv0902/events{/privacy}","received_events_url":"https://api.github.com/users/nhahv0902/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-12-26T08:43:50Z","updated_at":"2016-12-26T09:25:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6b4bd71fca7c58b73e026e3762a9511e769b1880","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/framgia/EnglishForKid_3/pulls/8/commits","review_comments_url":"https://api.github.com/repos/framgia/EnglishForKid_3/pulls/8/comments","review_comment_url":"https://api.github.com/repos/framgia/EnglishForKid_3/pulls/comments{/number}","comments_url":"https://api.github.com/repos/framgia/EnglishForKid_3/issues/8/comments","statuses_url":"https://api.github.com/repos/framgia/EnglishForKid_3/statuses/33bcd19be8c6f2144e4661370517c960986ff200","head":{"label":"nhahv0902:UIMain","ref":"UIMain","sha":"33bcd19be8c6f2144e4661370517c960986ff200","user":{"login":"nhahv0902","id":14172027,"avatar_url":"https://avatars.githubusercontent.com/u/14172027?v=3","gravatar_id":"","url":"https://api.github.com/users/nhahv0902","html_url":"https://github.com/nhahv0902","followers_url":"https://api.github.com/users/nhahv0902/followers","following_url":"https://api.github.com/users/nhahv0902/following{/other_user}","gists_url":"https://api.github.com/users/nhahv0902/gists{/gist_id}","starred_url":"https://api.github.com/users/nhahv0902/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhahv0902/subscriptions","organizations_url":"https://api.github.com/users/nhahv0902/orgs","repos_url":"https://api.github.com/users/nhahv0902/repos","events_url":"https://api.github.com/users/nhahv0902/events{/privacy}","received_events_url":"https://api.github.com/users/nhahv0902/received_events","type":"User","site_admin":false},"repo":{"id":76914031,"name":"EnglishForKid_3","full_name":"nhahv0902/EnglishForKid_3","owner":{"login":"nhahv0902","id":14172027,"avatar_url":"https://avatars.githubusercontent.com/u/14172027?v=3","gravatar_id":"","url":"https://api.github.com/users/nhahv0902","html_url":"https://github.com/nhahv0902","followers_url":"https://api.github.com/users/nhahv0902/followers","following_url":"https://api.github.com/users/nhahv0902/following{/other_user}","gists_url":"https://api.github.com/users/nhahv0902/gists{/gist_id}","starred_url":"https://api.github.com/users/nhahv0902/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhahv0902/subscriptions","organizations_url":"https://api.github.com/users/nhahv0902/orgs","repos_url":"https://api.github.com/users/nhahv0902/repos","events_url":"https://api.github.com/users/nhahv0902/events{/privacy}","received_events_url":"https://api.github.com/users/nhahv0902/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nhahv0902/EnglishForKid_3","description":"EnglishForKid (Training)","fork":true,"url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3","forks_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/forks","keys_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/teams","hooks_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/hooks","issue_events_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/issues/events{/number}","events_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/events","assignees_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/assignees{/user}","branches_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/branches{/branch}","tags_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/tags","blobs_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/git/refs{/sha}","trees_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/statuses/{sha}","languages_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/languages","stargazers_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/stargazers","contributors_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/contributors","subscribers_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/subscribers","subscription_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/subscription","commits_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/commits{/sha}","git_commits_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/git/commits{/sha}","comments_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/comments{/number}","issue_comment_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/issues/comments{/number}","contents_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/contents/{+path}","compare_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/merges","archive_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/downloads","issues_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/issues{/number}","pulls_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/pulls{/number}","milestones_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/milestones{/number}","notifications_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/labels{/name}","releases_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/releases{/id}","deployments_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/deployments","created_at":"2016-12-20T02:08:24Z","updated_at":"2016-12-20T01:10:10Z","pushed_at":"2016-12-26T09:19:45Z","git_url":"git://github.com/nhahv0902/EnglishForKid_3.git","ssh_url":"git@github.com:nhahv0902/EnglishForKid_3.git","clone_url":"https://github.com/nhahv0902/EnglishForKid_3.git","svn_url":"https://github.com/nhahv0902/EnglishForKid_3","homepage":null,"size":191,"stargazers_count":0,"watchers_count":0,"language":null,"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":"framgia:develop","ref":"develop","sha":"b8ffef485d32194679711913c904b20a8dc1b1fa","user":{"login":"framgia","id":2322183,"avatar_url":"https://avatars.githubusercontent.com/u/2322183?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"repo":{"id":76910528,"name":"EnglishForKid_3","full_name":"framgia/EnglishForKid_3","owner":{"login":"framgia","id":2322183,"avatar_url":"https://avatars.githubusercontent.com/u/2322183?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/framgia/EnglishForKid_3","description":"EnglishForKid (Training)","fork":false,"url":"https://api.github.com/repos/framgia/EnglishForKid_3","forks_url":"https://api.github.com/repos/framgia/EnglishForKid_3/forks","keys_url":"https://api.github.com/repos/framgia/EnglishForKid_3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/EnglishForKid_3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/EnglishForKid_3/teams","hooks_url":"https://api.github.com/repos/framgia/EnglishForKid_3/hooks","issue_events_url":"https://api.github.com/repos/framgia/EnglishForKid_3/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/EnglishForKid_3/events","assignees_url":"https://api.github.com/repos/framgia/EnglishForKid_3/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/EnglishForKid_3/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/EnglishForKid_3/tags","blobs_url":"https://api.github.com/repos/framgia/EnglishForKid_3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/EnglishForKid_3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/EnglishForKid_3/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/EnglishForKid_3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/EnglishForKid_3/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/EnglishForKid_3/languages","stargazers_url":"https://api.github.com/repos/framgia/EnglishForKid_3/stargazers","contributors_url":"https://api.github.com/repos/framgia/EnglishForKid_3/contributors","subscribers_url":"https://api.github.com/repos/framgia/EnglishForKid_3/subscribers","subscription_url":"https://api.github.com/repos/framgia/EnglishForKid_3/subscription","commits_url":"https://api.github.com/repos/framgia/EnglishForKid_3/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/EnglishForKid_3/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/EnglishForKid_3/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/EnglishForKid_3/issues/comments{/number}","contents_url":"https://api.github.com/repos/framgia/EnglishForKid_3/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/EnglishForKid_3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/EnglishForKid_3/merges","archive_url":"https://api.github.com/repos/framgia/EnglishForKid_3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/EnglishForKid_3/downloads","issues_url":"https://api.github.com/repos/framgia/EnglishForKid_3/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/EnglishForKid_3/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/EnglishForKid_3/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/EnglishForKid_3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/EnglishForKid_3/labels{/name}","releases_url":"https://api.github.com/repos/framgia/EnglishForKid_3/releases{/id}","deployments_url":"https://api.github.com/repos/framgia/EnglishForKid_3/deployments","created_at":"2016-12-20T01:10:10Z","updated_at":"2016-12-21T02:20:54Z","pushed_at":"2016-12-26T09:19:45Z","git_url":"git://github.com/framgia/EnglishForKid_3.git","ssh_url":"git@github.com:framgia/EnglishForKid_3.git","clone_url":"https://github.com/framgia/EnglishForKid_3.git","svn_url":"https://github.com/framgia/EnglishForKid_3","homepage":null,"size":185,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/EnglishForKid_3/pulls/8"},"html":{"href":"https://github.com/framgia/EnglishForKid_3/pull/8"},"issue":{"href":"https://api.github.com/repos/framgia/EnglishForKid_3/issues/8"},"comments":{"href":"https://api.github.com/repos/framgia/EnglishForKid_3/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/EnglishForKid_3/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/EnglishForKid_3/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/framgia/EnglishForKid_3/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/EnglishForKid_3/statuses/33bcd19be8c6f2144e4661370517c960986ff200"}}}}
{"actor":{"display_login":"DoanVanToan"}}