{"action":"created","comment":{"url":"https://api.github.com/repos/griin/FLNPublicTransportation/pulls/comments/31451248","id":31451248,"diff_hunk":"@@ -0,0 +1,127 @@\n+package activity;\n+\n+import android.app.Activity;\n+import android.content.Intent;\n+import android.os.Bundle;\n+import android.widget.EditText;\n+import android.widget.ListView;\n+import android.widget.Button;\n+import android.view.View.OnClickListener;\n+import java.util.ArrayList;\n+import java.util.List;\n+import android.view.View;\n+import android.widget.AdapterView;\n+import android.widget.Toast;\n+import android.widget.AdapterView.OnItemClickListener;\n+import org.json.JSONArray;\n+import org.json.JSONObject;\n+import android.os.AsyncTask;\n+import android.app.ProgressDialog;\n+import com.fln.flnpublictransportation.R;\n+import android.view.inputmethod.InputMethodManager;\n+import controlers.RestServices;\n+import controlers.RouteAdapter;\n+import dto.Route;\n+import android.content.Context;\n+\n+public class MainActivity extends Activity {\n+\n+    private RouteAdapter routeAdapter;\n+    private EditText inputSearch;\n+    private String searchKey;\n+    private ListView listRoutes;\n+\n+    @Override\n+    protected void onCreate(Bundle savedInstanceState) {\n+        super.onCreate(savedInstanceState);\n+        setContentView(R.layout.activity_main);\n+\n+        inputSearch = (EditText) findViewById(R.id.item_search);\n+\n+        routeAdapter  = new RouteAdapter(new ArrayList<Route>(), this);\n+        listRoutes = (ListView) findViewById(R.id.list_routes);\n+        listRoutes.setAdapter(routeAdapter);\n+\n+        Bundle params = getIntent().getExtras();\n+        if(params != null) {\n+            searchKey = params.getString(\"searchKey\");\n+            inputSearch.setText(searchKey);\n+            (new AsyncListRoutesLoader()).execute(getString(R.string.findRoutesByStopName));\n+        }\n+\n+        Button btnSearch = (Button) findViewById(R.id.button_search);\n+        btnSearch.setOnClickListener(new OnClickListener() {\n+            @Override\n+            public void onClick(View v) {\n+                searchKey = inputSearch.getText().toString();\n+                InputMethodManager inputManager = (InputMethodManager)\n+                        getSystemService(Context.INPUT_METHOD_SERVICE);\n+                inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(),\n+                        InputMethodManager.HIDE_NOT_ALWAYS);\n+                (new AsyncListRoutesLoader()).execute(getString(R.string.findRoutesByStopName));\n+            }\n+        });\n+\n+        listRoutes.setOnItemClickListener(new OnItemClickListener() {\n+            @Override\n+            public void onItemClick(AdapterView<?> parent, View view,int position, long id) {\n+\n+                Route selectedRoute = routeAdapter.getItem(position);\n+\n+                Intent intent = new Intent(MainActivity.this, DetailsActivity.class);\n+                Bundle params = new Bundle();\n+                params.putString(\"id\", selectedRoute.getId());\n+                params.putString(\"name\", selectedRoute.getLongName() + \" - \" + selectedRoute.getShortName());\n+                params.putString(\"searchKey\", searchKey);\n+                intent.putExtras(params);\n+                startActivity(intent);\n+                finish();\n+            }\n+        });\n+    }\n+\n+    private class AsyncListRoutesLoader extends AsyncTask<String, Void, List<Route>> {\n+        private final ProgressDialog dialogRoutesLoader = new ProgressDialog(MainActivity.this);\n+\n+        @Override\n+        protected void onPostExecute(List<Route> listRoutes) {\n+            super.onPostExecute(listRoutes);\n+            dialogRoutesLoader.dismiss();\n+            routeAdapter.setItemList(listRoutes);\n+            routeAdapter.notifyDataSetChanged();\n+            if(listRoutes == null || listRoutes.isEmpty()) {\n+                Toast.makeText(getApplicationContext(),R.string.no_routes, Toast.LENGTH_LONG).show();\n+            }\n+        }\n+\n+        @Override\n+        protected void onPreExecute() {\n+            super.onPreExecute();\n+            dialogRoutesLoader.setMessage(getString(R.string.loading_routes));\n+            dialogRoutesLoader.show();\n+        }\n+\n+        @Override\n+        protected List<Route> doInBackground(String... params) {\n+            List<Route> listRoutes = new ArrayList<Route>();\n+\n+            try {\n+                RestServices restService = new RestServices();\n+                String param =  \"{\\\"params\\\":{\\\"stopName\\\": \\\"%\" + searchKey.replace(\" \",\"%\") + \"%\\\"}}\";\n+\n+                JSONObject objJSON = restService.connectToRestService(params[0], param, getApplicationContext());\n+                JSONArray arrJSON = objJSON.getJSONArray(\"rows\");","path":"app/src/main/java/activity/MainActivity.java","position":113,"original_position":113,"commit_id":"b30c3901d3b3194f327842c1c93513601f91c8e6","original_commit_id":"b30c3901d3b3194f327842c1c93513601f91c8e6","user":{"login":"arctouch-thiagocechetto","id":1844246,"avatar_url":"https://avatars.githubusercontent.com/u/1844246?v=3","gravatar_id":"","url":"https://api.github.com/users/arctouch-thiagocechetto","html_url":"https://github.com/arctouch-thiagocechetto","followers_url":"https://api.github.com/users/arctouch-thiagocechetto/followers","following_url":"https://api.github.com/users/arctouch-thiagocechetto/following{/other_user}","gists_url":"https://api.github.com/users/arctouch-thiagocechetto/gists{/gist_id}","starred_url":"https://api.github.com/users/arctouch-thiagocechetto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arctouch-thiagocechetto/subscriptions","organizations_url":"https://api.github.com/users/arctouch-thiagocechetto/orgs","repos_url":"https://api.github.com/users/arctouch-thiagocechetto/repos","events_url":"https://api.github.com/users/arctouch-thiagocechetto/events{/privacy}","received_events_url":"https://api.github.com/users/arctouch-thiagocechetto/received_events","type":"User","site_admin":false},"body":"More copy and paste here.","created_at":"2015-06-01T17:54:00Z","updated_at":"2015-06-01T17:54:00Z","html_url":"https://github.com/griin/FLNPublicTransportation/pull/1#discussion_r31451248","pull_request_url":"https://api.github.com/repos/griin/FLNPublicTransportation/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/griin/FLNPublicTransportation/pulls/comments/31451248"},"html":{"href":"https://github.com/griin/FLNPublicTransportation/pull/1#discussion_r31451248"},"pull_request":{"href":"https://api.github.com/repos/griin/FLNPublicTransportation/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/griin/FLNPublicTransportation/pulls/1","id":36649653,"html_url":"https://github.com/griin/FLNPublicTransportation/pull/1","diff_url":"https://github.com/griin/FLNPublicTransportation/pull/1.diff","patch_url":"https://github.com/griin/FLNPublicTransportation/pull/1.patch","issue_url":"https://api.github.com/repos/griin/FLNPublicTransportation/issues/1","number":1,"state":"open","locked":false,"title":"Dev","user":{"login":"arctouch-thiagocechetto","id":1844246,"avatar_url":"https://avatars.githubusercontent.com/u/1844246?v=3","gravatar_id":"","url":"https://api.github.com/users/arctouch-thiagocechetto","html_url":"https://github.com/arctouch-thiagocechetto","followers_url":"https://api.github.com/users/arctouch-thiagocechetto/followers","following_url":"https://api.github.com/users/arctouch-thiagocechetto/following{/other_user}","gists_url":"https://api.github.com/users/arctouch-thiagocechetto/gists{/gist_id}","starred_url":"https://api.github.com/users/arctouch-thiagocechetto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arctouch-thiagocechetto/subscriptions","organizations_url":"https://api.github.com/users/arctouch-thiagocechetto/orgs","repos_url":"https://api.github.com/users/arctouch-thiagocechetto/repos","events_url":"https://api.github.com/users/arctouch-thiagocechetto/events{/privacy}","received_events_url":"https://api.github.com/users/arctouch-thiagocechetto/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-06-01T17:11:38Z","updated_at":"2015-06-01T17:54:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c33ad425e34b08ea8745d46c927c1140a9fc8a4e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/griin/FLNPublicTransportation/pulls/1/commits","review_comments_url":"https://api.github.com/repos/griin/FLNPublicTransportation/pulls/1/comments","review_comment_url":"https://api.github.com/repos/griin/FLNPublicTransportation/pulls/comments{/number}","comments_url":"https://api.github.com/repos/griin/FLNPublicTransportation/issues/1/comments","statuses_url":"https://api.github.com/repos/griin/FLNPublicTransportation/statuses/b30c3901d3b3194f327842c1c93513601f91c8e6","head":{"label":"griin:Dev","ref":"Dev","sha":"b30c3901d3b3194f327842c1c93513601f91c8e6","user":{"login":"griin","id":4395443,"avatar_url":"https://avatars.githubusercontent.com/u/4395443?v=3","gravatar_id":"","url":"https://api.github.com/users/griin","html_url":"https://github.com/griin","followers_url":"https://api.github.com/users/griin/followers","following_url":"https://api.github.com/users/griin/following{/other_user}","gists_url":"https://api.github.com/users/griin/gists{/gist_id}","starred_url":"https://api.github.com/users/griin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/griin/subscriptions","organizations_url":"https://api.github.com/users/griin/orgs","repos_url":"https://api.github.com/users/griin/repos","events_url":"https://api.github.com/users/griin/events{/privacy}","received_events_url":"https://api.github.com/users/griin/received_events","type":"User","site_admin":false},"repo":{"id":36315174,"name":"FLNPublicTransportation","full_name":"griin/FLNPublicTransportation","owner":{"login":"griin","id":4395443,"avatar_url":"https://avatars.githubusercontent.com/u/4395443?v=3","gravatar_id":"","url":"https://api.github.com/users/griin","html_url":"https://github.com/griin","followers_url":"https://api.github.com/users/griin/followers","following_url":"https://api.github.com/users/griin/following{/other_user}","gists_url":"https://api.github.com/users/griin/gists{/gist_id}","starred_url":"https://api.github.com/users/griin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/griin/subscriptions","organizations_url":"https://api.github.com/users/griin/orgs","repos_url":"https://api.github.com/users/griin/repos","events_url":"https://api.github.com/users/griin/events{/privacy}","received_events_url":"https://api.github.com/users/griin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/griin/FLNPublicTransportation","description":"An app for public transportation","fork":false,"url":"https://api.github.com/repos/griin/FLNPublicTransportation","forks_url":"https://api.github.com/repos/griin/FLNPublicTransportation/forks","keys_url":"https://api.github.com/repos/griin/FLNPublicTransportation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/griin/FLNPublicTransportation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/griin/FLNPublicTransportation/teams","hooks_url":"https://api.github.com/repos/griin/FLNPublicTransportation/hooks","issue_events_url":"https://api.github.com/repos/griin/FLNPublicTransportation/issues/events{/number}","events_url":"https://api.github.com/repos/griin/FLNPublicTransportation/events","assignees_url":"https://api.github.com/repos/griin/FLNPublicTransportation/assignees{/user}","branches_url":"https://api.github.com/repos/griin/FLNPublicTransportation/branches{/branch}","tags_url":"https://api.github.com/repos/griin/FLNPublicTransportation/tags","blobs_url":"https://api.github.com/repos/griin/FLNPublicTransportation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/griin/FLNPublicTransportation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/griin/FLNPublicTransportation/git/refs{/sha}","trees_url":"https://api.github.com/repos/griin/FLNPublicTransportation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/griin/FLNPublicTransportation/statuses/{sha}","languages_url":"https://api.github.com/repos/griin/FLNPublicTransportation/languages","stargazers_url":"https://api.github.com/repos/griin/FLNPublicTransportation/stargazers","contributors_url":"https://api.github.com/repos/griin/FLNPublicTransportation/contributors","subscribers_url":"https://api.github.com/repos/griin/FLNPublicTransportation/subscribers","subscription_url":"https://api.github.com/repos/griin/FLNPublicTransportation/subscription","commits_url":"https://api.github.com/repos/griin/FLNPublicTransportation/commits{/sha}","git_commits_url":"https://api.github.com/repos/griin/FLNPublicTransportation/git/commits{/sha}","comments_url":"https://api.github.com/repos/griin/FLNPublicTransportation/comments{/number}","issue_comment_url":"https://api.github.com/repos/griin/FLNPublicTransportation/issues/comments{/number}","contents_url":"https://api.github.com/repos/griin/FLNPublicTransportation/contents/{+path}","compare_url":"https://api.github.com/repos/griin/FLNPublicTransportation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/griin/FLNPublicTransportation/merges","archive_url":"https://api.github.com/repos/griin/FLNPublicTransportation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/griin/FLNPublicTransportation/downloads","issues_url":"https://api.github.com/repos/griin/FLNPublicTransportation/issues{/number}","pulls_url":"https://api.github.com/repos/griin/FLNPublicTransportation/pulls{/number}","milestones_url":"https://api.github.com/repos/griin/FLNPublicTransportation/milestones{/number}","notifications_url":"https://api.github.com/repos/griin/FLNPublicTransportation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/griin/FLNPublicTransportation/labels{/name}","releases_url":"https://api.github.com/repos/griin/FLNPublicTransportation/releases{/id}","created_at":"2015-05-26T18:21:27Z","updated_at":"2015-05-27T03:35:24Z","pushed_at":"2015-06-01T17:11:38Z","git_url":"git://github.com/griin/FLNPublicTransportation.git","ssh_url":"git@github.com:griin/FLNPublicTransportation.git","clone_url":"https://github.com/griin/FLNPublicTransportation.git","svn_url":"https://github.com/griin/FLNPublicTransportation","homepage":null,"size":0,"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":"griin:master","ref":"master","sha":"3d1e191dd7a6f29cc5c2cfb39cdf2058d72fbbd2","user":{"login":"griin","id":4395443,"avatar_url":"https://avatars.githubusercontent.com/u/4395443?v=3","gravatar_id":"","url":"https://api.github.com/users/griin","html_url":"https://github.com/griin","followers_url":"https://api.github.com/users/griin/followers","following_url":"https://api.github.com/users/griin/following{/other_user}","gists_url":"https://api.github.com/users/griin/gists{/gist_id}","starred_url":"https://api.github.com/users/griin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/griin/subscriptions","organizations_url":"https://api.github.com/users/griin/orgs","repos_url":"https://api.github.com/users/griin/repos","events_url":"https://api.github.com/users/griin/events{/privacy}","received_events_url":"https://api.github.com/users/griin/received_events","type":"User","site_admin":false},"repo":{"id":36315174,"name":"FLNPublicTransportation","full_name":"griin/FLNPublicTransportation","owner":{"login":"griin","id":4395443,"avatar_url":"https://avatars.githubusercontent.com/u/4395443?v=3","gravatar_id":"","url":"https://api.github.com/users/griin","html_url":"https://github.com/griin","followers_url":"https://api.github.com/users/griin/followers","following_url":"https://api.github.com/users/griin/following{/other_user}","gists_url":"https://api.github.com/users/griin/gists{/gist_id}","starred_url":"https://api.github.com/users/griin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/griin/subscriptions","organizations_url":"https://api.github.com/users/griin/orgs","repos_url":"https://api.github.com/users/griin/repos","events_url":"https://api.github.com/users/griin/events{/privacy}","received_events_url":"https://api.github.com/users/griin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/griin/FLNPublicTransportation","description":"An app for public transportation","fork":false,"url":"https://api.github.com/repos/griin/FLNPublicTransportation","forks_url":"https://api.github.com/repos/griin/FLNPublicTransportation/forks","keys_url":"https://api.github.com/repos/griin/FLNPublicTransportation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/griin/FLNPublicTransportation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/griin/FLNPublicTransportation/teams","hooks_url":"https://api.github.com/repos/griin/FLNPublicTransportation/hooks","issue_events_url":"https://api.github.com/repos/griin/FLNPublicTransportation/issues/events{/number}","events_url":"https://api.github.com/repos/griin/FLNPublicTransportation/events","assignees_url":"https://api.github.com/repos/griin/FLNPublicTransportation/assignees{/user}","branches_url":"https://api.github.com/repos/griin/FLNPublicTransportation/branches{/branch}","tags_url":"https://api.github.com/repos/griin/FLNPublicTransportation/tags","blobs_url":"https://api.github.com/repos/griin/FLNPublicTransportation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/griin/FLNPublicTransportation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/griin/FLNPublicTransportation/git/refs{/sha}","trees_url":"https://api.github.com/repos/griin/FLNPublicTransportation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/griin/FLNPublicTransportation/statuses/{sha}","languages_url":"https://api.github.com/repos/griin/FLNPublicTransportation/languages","stargazers_url":"https://api.github.com/repos/griin/FLNPublicTransportation/stargazers","contributors_url":"https://api.github.com/repos/griin/FLNPublicTransportation/contributors","subscribers_url":"https://api.github.com/repos/griin/FLNPublicTransportation/subscribers","subscription_url":"https://api.github.com/repos/griin/FLNPublicTransportation/subscription","commits_url":"https://api.github.com/repos/griin/FLNPublicTransportation/commits{/sha}","git_commits_url":"https://api.github.com/repos/griin/FLNPublicTransportation/git/commits{/sha}","comments_url":"https://api.github.com/repos/griin/FLNPublicTransportation/comments{/number}","issue_comment_url":"https://api.github.com/repos/griin/FLNPublicTransportation/issues/comments{/number}","contents_url":"https://api.github.com/repos/griin/FLNPublicTransportation/contents/{+path}","compare_url":"https://api.github.com/repos/griin/FLNPublicTransportation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/griin/FLNPublicTransportation/merges","archive_url":"https://api.github.com/repos/griin/FLNPublicTransportation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/griin/FLNPublicTransportation/downloads","issues_url":"https://api.github.com/repos/griin/FLNPublicTransportation/issues{/number}","pulls_url":"https://api.github.com/repos/griin/FLNPublicTransportation/pulls{/number}","milestones_url":"https://api.github.com/repos/griin/FLNPublicTransportation/milestones{/number}","notifications_url":"https://api.github.com/repos/griin/FLNPublicTransportation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/griin/FLNPublicTransportation/labels{/name}","releases_url":"https://api.github.com/repos/griin/FLNPublicTransportation/releases{/id}","created_at":"2015-05-26T18:21:27Z","updated_at":"2015-05-27T03:35:24Z","pushed_at":"2015-06-01T17:11:38Z","git_url":"git://github.com/griin/FLNPublicTransportation.git","ssh_url":"git@github.com:griin/FLNPublicTransportation.git","clone_url":"https://github.com/griin/FLNPublicTransportation.git","svn_url":"https://github.com/griin/FLNPublicTransportation","homepage":null,"size":0,"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/griin/FLNPublicTransportation/pulls/1"},"html":{"href":"https://github.com/griin/FLNPublicTransportation/pull/1"},"issue":{"href":"https://api.github.com/repos/griin/FLNPublicTransportation/issues/1"},"comments":{"href":"https://api.github.com/repos/griin/FLNPublicTransportation/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/griin/FLNPublicTransportation/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/griin/FLNPublicTransportation/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/griin/FLNPublicTransportation/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/griin/FLNPublicTransportation/statuses/b30c3901d3b3194f327842c1c93513601f91c8e6"}}}}