{"action":"created","comment":{"url":"https://api.github.com/repos/sdsmdg/Calling-Text/pulls/comments/126275143","pull_request_review_id":48749751,"id":126275143,"diff_hunk":"@@ -1,65 +1,172 @@\n package com.sdsmdg.pulkit.callingtext;\r\n \r\n+import android.app.ActionBar;\r\n+import android.app.ProgressDialog;\r\n+import android.content.ContentResolver;\r\n+import android.content.Context;\r\n import android.content.Intent;\r\n import android.database.Cursor;\r\n-import android.net.Uri;\r\n import android.os.AsyncTask;\r\n import android.os.Bundle;\r\n import android.provider.ContactsContract;\r\n+import android.support.annotation.Nullable;\r\n import android.support.v4.app.Fragment;\r\n+import android.support.v4.app.FragmentActivity;\r\n import android.support.v4.app.LoaderManager;\r\n-import android.support.v4.content.CursorLoader;\r\n import android.support.v4.content.Loader;\r\n+import android.support.v7.app.AppCompatActivity;\r\n import android.support.v7.widget.LinearLayoutManager;\r\n import android.support.v7.widget.RecyclerView;\r\n+import android.support.v7.widget.Toolbar;\r\n import android.text.Editable;\r\n import android.text.TextWatcher;\r\n import android.util.Log;\r\n import android.view.LayoutInflater;\r\n+import android.view.Menu;\r\n+import android.view.MenuInflater;\r\n+import android.view.MenuItem;\r\n import android.view.View;\r\n import android.view.ViewGroup;\r\n import android.view.animation.OvershootInterpolator;\r\n+import android.view.inputmethod.InputMethodManager;\r\n+import android.widget.AutoCompleteTextView;\r\n import android.widget.Button;\r\n import android.widget.EditText;\r\n+import android.widget.FrameLayout;\r\n import android.widget.ImageButton;\r\n+import android.widget.ImageView;\r\n+import android.widget.LinearLayout;\r\n+import android.widget.Toast;\r\n \r\n import java.util.ArrayList;\r\n import java.util.List;\r\n \r\n import jp.co.recruit_lifestyle.android.widget.WaveSwipeRefreshLayout;\r\n import jp.wasabeef.recyclerview.animators.adapters.ScaleInAnimationAdapter;\r\n \r\n+import static com.sdsmdg.pulkit.callingtext.BaseActivity.getSavedContacts;\r\n+\r\n public class ContactListFragment extends Fragment implements LoaderManager.LoaderCallbacks<Cursor> {\r\n \r\n \r\n     public RecyclerView recList;\r\n     public ImageButton button1;\r\n     Button button;\r\n     EditText et1;\r\n-    List<ArrayList> result;\r\n+    static List<ArrayList> result;\r\n     View view;\r\n     WaveSwipeRefreshLayout mWaveSwipeRefreshLayout;\r\n-\r\n+    private ImageView searchButton, settingsButton, backButton;\r\n+    AutoCompleteTextView searchBox;\r\n+    FrameLayout dimLayout;\r\n+    LinearLayout searchLayout;\r\n+    ArrayList<PhoneContact> phoneContactsList;\r\n+    PhoneSearchSuggestionAdapter adapter;\r\n+    Toolbar toolbar;\r\n+    ProgressDialog mProgress;\r\n+    ScaleInAnimationAdapter alphaAdapter;\r\n+    OnContactsLoaded onContactsLoaded;\r\n+    ContactListAdapter ca;\r\n+    int mShortDurationTime;\r\n \r\n     @Override\r\n     public void onCreate(Bundle savedInstanceState) {\r\n         super.onCreate(savedInstanceState);\r\n+        setHasOptionsMenu(true);\r\n     }\r\n \r\n     @Override\r\n-    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\r\n+    public void onAttach(Context context) {\r\n+        super.onAttach(context);\r\n+        mProgress = new ProgressDialog(context);\r\n \r\n+        try{\r\n+            onContactsLoaded = (OnContactsLoaded)context;\r\n+        }catch (ClassCastException e){\r\n+            throw new ClassCastException(context.toString() + \" must implement OnContactsLoaded\");\r\n+        }\r\n+    }\r\n+\r\n+    @Override\r\n+    public View onCreateView(LayoutInflater inflater, ViewGroup container, final Bundle savedInstanceState) {\r\n \r\n         view = inflater.inflate(R.layout.activity_contact_list, container, false);\r\n+\r\n+        // init views\r\n         button1 = (ImageButton) view.findViewById(R.id.imageButton21);\r\n-        et1 = (EditText) view.findViewById(R.id.editText3);\r\n         recList = (RecyclerView) view.findViewById(R.id.questionList_recycler);\r\n-        et1.addTextChangedListener(new TextWatcher() {\r\n+        dimLayout = (FrameLayout) view.findViewById(R.id.dim_layout);\r\n+        searchLayout = (LinearLayout) view.findViewById(R.id.searchbar);\r\n+        backButton = (ImageView) view.findViewById(R.id.backbutton);\r\n+        searchBox = (AutoCompleteTextView) view.findViewById(R.id.searchbox);\r\n+        result = new ArrayList<>();\r\n+        // Initially hide the content view.\r\n+        recList.setVisibility(View.GONE);\r\n+        // Retrieve and cache the system's default \"short\" animation time.\r\n+        mShortDurationTime = getResources().getInteger(android.R.integer.config_shortAnimTime);\r\n+\r\n+        // To retain the contact list when the fragments are swiped or device is rotated\r\n+        result = new ArrayList<>();\r\n+        result = ((BaseActivity)getActivity()).getSavedContacts();\r\n+        phoneContactsList = ((BaseActivity)getActivity()).getSavedPhoneContacts();\r\n+        if (result == null || result.size() == 0)\r\n+            new CreateContactList().execute();\r\n+\r\n+        // set the message for progress bar\r\n+        mProgress.setMessage(\"Displaying Contacts...\");\r\n+\r\n+        // Back button to request the focus back to the ContactsListFragment\r\n+        backButton.setOnClickListener(new View.OnClickListener() {\r\n             @Override\r\n-            public void beforeTextChanged(CharSequence s, int start, int count, int after) {\r\n+            public void onClick(View view) {\r\n+                dimLayout.setVisibility(View.GONE);\r\n+                searchLayout.setVisibility(View.GONE);\r\n+                searchBox.clearFocus();\r\n+                InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);\r\n+                inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0);\r\n+\r\n+            }\r\n+        });\r\n+\r\n+        // Dim layout which is present during search operattions\r\n+        dimLayout.setOnClickListener(new View.OnClickListener() {\r\n+            @Override\r\n+            public void onClick(View view) {\r","path":"app/src/main/java/com/sdsmdg/pulkit/callingtext/ContactListFragment.java","position":128,"original_position":142,"commit_id":"481d2aa3524daa9cdba756af9aef703047172ebf","original_commit_id":"02a7f354f5af9a90f583df236c1aceeae7932294","user":{"login":"pulkonet","id":24983958,"avatar_url":"https://avatars2.githubusercontent.com/u/24983958?v=3","gravatar_id":"","url":"https://api.github.com/users/pulkonet","html_url":"https://github.com/pulkonet","followers_url":"https://api.github.com/users/pulkonet/followers","following_url":"https://api.github.com/users/pulkonet/following{/other_user}","gists_url":"https://api.github.com/users/pulkonet/gists{/gist_id}","starred_url":"https://api.github.com/users/pulkonet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pulkonet/subscriptions","organizations_url":"https://api.github.com/users/pulkonet/orgs","repos_url":"https://api.github.com/users/pulkonet/repos","events_url":"https://api.github.com/users/pulkonet/events{/privacy}","received_events_url":"https://api.github.com/users/pulkonet/received_events","type":"User","site_admin":false},"body":"It's called for the second time here.\r\n","created_at":"2017-07-08T05:24:28Z","updated_at":"2017-07-08T05:24:28Z","html_url":"https://github.com/sdsmdg/Calling-Text/pull/14#discussion_r126275143","pull_request_url":"https://api.github.com/repos/sdsmdg/Calling-Text/pulls/14","_links":{"self":{"href":"https://api.github.com/repos/sdsmdg/Calling-Text/pulls/comments/126275143"},"html":{"href":"https://github.com/sdsmdg/Calling-Text/pull/14#discussion_r126275143"},"pull_request":{"href":"https://api.github.com/repos/sdsmdg/Calling-Text/pulls/14"}}},"pull_request":{"url":"https://api.github.com/repos/sdsmdg/Calling-Text/pulls/14","id":129341649,"html_url":"https://github.com/sdsmdg/Calling-Text/pull/14","diff_url":"https://github.com/sdsmdg/Calling-Text/pull/14.diff","patch_url":"https://github.com/sdsmdg/Calling-Text/pull/14.patch","issue_url":"https://api.github.com/repos/sdsmdg/Calling-Text/issues/14","number":14,"state":"open","locked":false,"title":"Search contacts adapter","user":{"login":"iamharsshit","id":24504421,"avatar_url":"https://avatars0.githubusercontent.com/u/24504421?v=3","gravatar_id":"","url":"https://api.github.com/users/iamharsshit","html_url":"https://github.com/iamharsshit","followers_url":"https://api.github.com/users/iamharsshit/followers","following_url":"https://api.github.com/users/iamharsshit/following{/other_user}","gists_url":"https://api.github.com/users/iamharsshit/gists{/gist_id}","starred_url":"https://api.github.com/users/iamharsshit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iamharsshit/subscriptions","organizations_url":"https://api.github.com/users/iamharsshit/orgs","repos_url":"https://api.github.com/users/iamharsshit/repos","events_url":"https://api.github.com/users/iamharsshit/events{/privacy}","received_events_url":"https://api.github.com/users/iamharsshit/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-07-07T07:03:25Z","updated_at":"2017-07-08T05:24:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6dec770b17876da75b15df7e98e27daca1e49057","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/sdsmdg/Calling-Text/pulls/14/commits","review_comments_url":"https://api.github.com/repos/sdsmdg/Calling-Text/pulls/14/comments","review_comment_url":"https://api.github.com/repos/sdsmdg/Calling-Text/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sdsmdg/Calling-Text/issues/14/comments","statuses_url":"https://api.github.com/repos/sdsmdg/Calling-Text/statuses/481d2aa3524daa9cdba756af9aef703047172ebf","head":{"label":"sdsmdg:SearchContactsAdapter","ref":"SearchContactsAdapter","sha":"481d2aa3524daa9cdba756af9aef703047172ebf","user":{"login":"sdsmdg","id":6321651,"avatar_url":"https://avatars1.githubusercontent.com/u/6321651?v=3","gravatar_id":"","url":"https://api.github.com/users/sdsmdg","html_url":"https://github.com/sdsmdg","followers_url":"https://api.github.com/users/sdsmdg/followers","following_url":"https://api.github.com/users/sdsmdg/following{/other_user}","gists_url":"https://api.github.com/users/sdsmdg/gists{/gist_id}","starred_url":"https://api.github.com/users/sdsmdg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdsmdg/subscriptions","organizations_url":"https://api.github.com/users/sdsmdg/orgs","repos_url":"https://api.github.com/users/sdsmdg/repos","events_url":"https://api.github.com/users/sdsmdg/events{/privacy}","received_events_url":"https://api.github.com/users/sdsmdg/received_events","type":"Organization","site_admin":false},"repo":{"id":68532352,"name":"Calling-Text","full_name":"sdsmdg/Calling-Text","owner":{"login":"sdsmdg","id":6321651,"avatar_url":"https://avatars1.githubusercontent.com/u/6321651?v=3","gravatar_id":"","url":"https://api.github.com/users/sdsmdg","html_url":"https://github.com/sdsmdg","followers_url":"https://api.github.com/users/sdsmdg/followers","following_url":"https://api.github.com/users/sdsmdg/following{/other_user}","gists_url":"https://api.github.com/users/sdsmdg/gists{/gist_id}","starred_url":"https://api.github.com/users/sdsmdg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdsmdg/subscriptions","organizations_url":"https://api.github.com/users/sdsmdg/orgs","repos_url":"https://api.github.com/users/sdsmdg/repos","events_url":"https://api.github.com/users/sdsmdg/events{/privacy}","received_events_url":"https://api.github.com/users/sdsmdg/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sdsmdg/Calling-Text","description":null,"fork":true,"url":"https://api.github.com/repos/sdsmdg/Calling-Text","forks_url":"https://api.github.com/repos/sdsmdg/Calling-Text/forks","keys_url":"https://api.github.com/repos/sdsmdg/Calling-Text/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sdsmdg/Calling-Text/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sdsmdg/Calling-Text/teams","hooks_url":"https://api.github.com/repos/sdsmdg/Calling-Text/hooks","issue_events_url":"https://api.github.com/repos/sdsmdg/Calling-Text/issues/events{/number}","events_url":"https://api.github.com/repos/sdsmdg/Calling-Text/events","assignees_url":"https://api.github.com/repos/sdsmdg/Calling-Text/assignees{/user}","branches_url":"https://api.github.com/repos/sdsmdg/Calling-Text/branches{/branch}","tags_url":"https://api.github.com/repos/sdsmdg/Calling-Text/tags","blobs_url":"https://api.github.com/repos/sdsmdg/Calling-Text/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sdsmdg/Calling-Text/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sdsmdg/Calling-Text/git/refs{/sha}","trees_url":"https://api.github.com/repos/sdsmdg/Calling-Text/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sdsmdg/Calling-Text/statuses/{sha}","languages_url":"https://api.github.com/repos/sdsmdg/Calling-Text/languages","stargazers_url":"https://api.github.com/repos/sdsmdg/Calling-Text/stargazers","contributors_url":"https://api.github.com/repos/sdsmdg/Calling-Text/contributors","subscribers_url":"https://api.github.com/repos/sdsmdg/Calling-Text/subscribers","subscription_url":"https://api.github.com/repos/sdsmdg/Calling-Text/subscription","commits_url":"https://api.github.com/repos/sdsmdg/Calling-Text/commits{/sha}","git_commits_url":"https://api.github.com/repos/sdsmdg/Calling-Text/git/commits{/sha}","comments_url":"https://api.github.com/repos/sdsmdg/Calling-Text/comments{/number}","issue_comment_url":"https://api.github.com/repos/sdsmdg/Calling-Text/issues/comments{/number}","contents_url":"https://api.github.com/repos/sdsmdg/Calling-Text/contents/{+path}","compare_url":"https://api.github.com/repos/sdsmdg/Calling-Text/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sdsmdg/Calling-Text/merges","archive_url":"https://api.github.com/repos/sdsmdg/Calling-Text/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sdsmdg/Calling-Text/downloads","issues_url":"https://api.github.com/repos/sdsmdg/Calling-Text/issues{/number}","pulls_url":"https://api.github.com/repos/sdsmdg/Calling-Text/pulls{/number}","milestones_url":"https://api.github.com/repos/sdsmdg/Calling-Text/milestones{/number}","notifications_url":"https://api.github.com/repos/sdsmdg/Calling-Text/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sdsmdg/Calling-Text/labels{/name}","releases_url":"https://api.github.com/repos/sdsmdg/Calling-Text/releases{/id}","deployments_url":"https://api.github.com/repos/sdsmdg/Calling-Text/deployments","created_at":"2016-09-18T16:12:14Z","updated_at":"2017-06-30T17:43:23Z","pushed_at":"2017-07-08T05:21:15Z","git_url":"git://github.com/sdsmdg/Calling-Text.git","ssh_url":"git@github.com:sdsmdg/Calling-Text.git","clone_url":"https://github.com/sdsmdg/Calling-Text.git","svn_url":"https://github.com/sdsmdg/Calling-Text","homepage":null,"size":1594,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":3,"default_branch":"master"}},"base":{"label":"sdsmdg:branch_develop","ref":"branch_develop","sha":"9e8b658e207c766a1fd79cb5758b2391e2314b80","user":{"login":"sdsmdg","id":6321651,"avatar_url":"https://avatars1.githubusercontent.com/u/6321651?v=3","gravatar_id":"","url":"https://api.github.com/users/sdsmdg","html_url":"https://github.com/sdsmdg","followers_url":"https://api.github.com/users/sdsmdg/followers","following_url":"https://api.github.com/users/sdsmdg/following{/other_user}","gists_url":"https://api.github.com/users/sdsmdg/gists{/gist_id}","starred_url":"https://api.github.com/users/sdsmdg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdsmdg/subscriptions","organizations_url":"https://api.github.com/users/sdsmdg/orgs","repos_url":"https://api.github.com/users/sdsmdg/repos","events_url":"https://api.github.com/users/sdsmdg/events{/privacy}","received_events_url":"https://api.github.com/users/sdsmdg/received_events","type":"Organization","site_admin":false},"repo":{"id":68532352,"name":"Calling-Text","full_name":"sdsmdg/Calling-Text","owner":{"login":"sdsmdg","id":6321651,"avatar_url":"https://avatars1.githubusercontent.com/u/6321651?v=3","gravatar_id":"","url":"https://api.github.com/users/sdsmdg","html_url":"https://github.com/sdsmdg","followers_url":"https://api.github.com/users/sdsmdg/followers","following_url":"https://api.github.com/users/sdsmdg/following{/other_user}","gists_url":"https://api.github.com/users/sdsmdg/gists{/gist_id}","starred_url":"https://api.github.com/users/sdsmdg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdsmdg/subscriptions","organizations_url":"https://api.github.com/users/sdsmdg/orgs","repos_url":"https://api.github.com/users/sdsmdg/repos","events_url":"https://api.github.com/users/sdsmdg/events{/privacy}","received_events_url":"https://api.github.com/users/sdsmdg/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sdsmdg/Calling-Text","description":null,"fork":true,"url":"https://api.github.com/repos/sdsmdg/Calling-Text","forks_url":"https://api.github.com/repos/sdsmdg/Calling-Text/forks","keys_url":"https://api.github.com/repos/sdsmdg/Calling-Text/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sdsmdg/Calling-Text/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sdsmdg/Calling-Text/teams","hooks_url":"https://api.github.com/repos/sdsmdg/Calling-Text/hooks","issue_events_url":"https://api.github.com/repos/sdsmdg/Calling-Text/issues/events{/number}","events_url":"https://api.github.com/repos/sdsmdg/Calling-Text/events","assignees_url":"https://api.github.com/repos/sdsmdg/Calling-Text/assignees{/user}","branches_url":"https://api.github.com/repos/sdsmdg/Calling-Text/branches{/branch}","tags_url":"https://api.github.com/repos/sdsmdg/Calling-Text/tags","blobs_url":"https://api.github.com/repos/sdsmdg/Calling-Text/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sdsmdg/Calling-Text/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sdsmdg/Calling-Text/git/refs{/sha}","trees_url":"https://api.github.com/repos/sdsmdg/Calling-Text/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sdsmdg/Calling-Text/statuses/{sha}","languages_url":"https://api.github.com/repos/sdsmdg/Calling-Text/languages","stargazers_url":"https://api.github.com/repos/sdsmdg/Calling-Text/stargazers","contributors_url":"https://api.github.com/repos/sdsmdg/Calling-Text/contributors","subscribers_url":"https://api.github.com/repos/sdsmdg/Calling-Text/subscribers","subscription_url":"https://api.github.com/repos/sdsmdg/Calling-Text/subscription","commits_url":"https://api.github.com/repos/sdsmdg/Calling-Text/commits{/sha}","git_commits_url":"https://api.github.com/repos/sdsmdg/Calling-Text/git/commits{/sha}","comments_url":"https://api.github.com/repos/sdsmdg/Calling-Text/comments{/number}","issue_comment_url":"https://api.github.com/repos/sdsmdg/Calling-Text/issues/comments{/number}","contents_url":"https://api.github.com/repos/sdsmdg/Calling-Text/contents/{+path}","compare_url":"https://api.github.com/repos/sdsmdg/Calling-Text/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sdsmdg/Calling-Text/merges","archive_url":"https://api.github.com/repos/sdsmdg/Calling-Text/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sdsmdg/Calling-Text/downloads","issues_url":"https://api.github.com/repos/sdsmdg/Calling-Text/issues{/number}","pulls_url":"https://api.github.com/repos/sdsmdg/Calling-Text/pulls{/number}","milestones_url":"https://api.github.com/repos/sdsmdg/Calling-Text/milestones{/number}","notifications_url":"https://api.github.com/repos/sdsmdg/Calling-Text/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sdsmdg/Calling-Text/labels{/name}","releases_url":"https://api.github.com/repos/sdsmdg/Calling-Text/releases{/id}","deployments_url":"https://api.github.com/repos/sdsmdg/Calling-Text/deployments","created_at":"2016-09-18T16:12:14Z","updated_at":"2017-06-30T17:43:23Z","pushed_at":"2017-07-08T05:21:15Z","git_url":"git://github.com/sdsmdg/Calling-Text.git","ssh_url":"git@github.com:sdsmdg/Calling-Text.git","clone_url":"https://github.com/sdsmdg/Calling-Text.git","svn_url":"https://github.com/sdsmdg/Calling-Text","homepage":null,"size":1594,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sdsmdg/Calling-Text/pulls/14"},"html":{"href":"https://github.com/sdsmdg/Calling-Text/pull/14"},"issue":{"href":"https://api.github.com/repos/sdsmdg/Calling-Text/issues/14"},"comments":{"href":"https://api.github.com/repos/sdsmdg/Calling-Text/issues/14/comments"},"review_comments":{"href":"https://api.github.com/repos/sdsmdg/Calling-Text/pulls/14/comments"},"review_comment":{"href":"https://api.github.com/repos/sdsmdg/Calling-Text/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sdsmdg/Calling-Text/pulls/14/commits"},"statuses":{"href":"https://api.github.com/repos/sdsmdg/Calling-Text/statuses/481d2aa3524daa9cdba756af9aef703047172ebf"}}}}
{"actor":{"display_login":"pulkonet"}}