{"action":"created","comment":{"url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/pulls/comments/23213825","id":23213825,"diff_hunk":"@@ -0,0 +1,90 @@\n+package ru.ifmo.md.lesson8;\n+\n+import android.content.ContentValues;\n+import android.content.Intent;\n+import android.net.Uri;\n+import android.support.v4.content.LocalBroadcastManager;\n+import android.support.v7.app.ActionBarActivity;\n+import android.os.Bundle;\n+import android.text.Editable;\n+import android.text.TextWatcher;\n+import android.view.View;\n+import android.widget.EditText;\n+import android.widget.TextView;\n+\n+import ru.ifmo.md.lesson8.db.CitiesTable;\n+import ru.ifmo.md.lesson8.db.WeatherContentProvider;\n+import ru.ifmo.md.lesson8.service.AsyncResponseReceiver;\n+import ru.ifmo.md.lesson8.service.CitySearchTask;\n+import ru.ifmo.md.lesson8.service.ForecastParser;\n+import ru.ifmo.md.lesson8.service.ForecastService;\n+import ru.ifmo.md.lesson8.service.Throttler;\n+\n+\n+public class AddCityActivity extends ActionBarActivity implements TextWatcher, AsyncResponseReceiver<ForecastParser.LocationResult> {\n+\n+    EditText searchField;\n+    TextView suggestion;\n+    ForecastParser.LocationResult currentResult;\n+    Throttler mThrottler = new Throttler();\n+\n+    @Override\n+    protected void onCreate(Bundle savedInstanceState) {\n+        super.onCreate(savedInstanceState);\n+        setContentView(R.layout.activity_add_city);\n+\n+        searchField = (EditText) findViewById(R.id.search_field);\n+        suggestion = (TextView) findViewById(R.id.suggestion);\n+\n+        searchField.addTextChangedListener(this);\n+    }\n+\n+    @Override\n+    public void beforeTextChanged(CharSequence s, int start, int count, int after) {}\n+\n+    @Override\n+    public void onTextChanged(CharSequence s, int start, int before, int count) {\n+        if(s.length() > 0) {\n+            final String name = s.toString();\n+            final CitySearchTask task = new CitySearchTask(this);\n+            Throttler.Callback foo = new Throttler.Callback() {\n+                @Override\n+                public void call() {\n+                    task.execute(name);\n+                }\n+            };\n+            mThrottler.throttle(foo, 500);\n+        } else {\n+            mThrottler.cancel();\n+        }\n+    }\n+\n+    @Override\n+    public void afterTextChanged(Editable s) {}\n+\n+    @Override\n+    public void processFinish(ForecastParser.LocationResult result) {\n+        if(result == null) {\n+            suggestion.setText(\"An error occured, sorry :(\");","path":"app/src/main/java/ru/ifmo/md/lesson8/AddCityActivity.java","position":68,"original_position":68,"commit_id":"51744ecbcd08a46303f68a0a9ea5c67367cf7773","original_commit_id":"51744ecbcd08a46303f68a0a9ea5c67367cf7773","user":{"login":"thevery","id":99576,"avatar_url":"https://avatars.githubusercontent.com/u/99576?v=3","gravatar_id":"","url":"https://api.github.com/users/thevery","html_url":"https://github.com/thevery","followers_url":"https://api.github.com/users/thevery/followers","following_url":"https://api.github.com/users/thevery/following{/other_user}","gists_url":"https://api.github.com/users/thevery/gists{/gist_id}","starred_url":"https://api.github.com/users/thevery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thevery/subscriptions","organizations_url":"https://api.github.com/users/thevery/orgs","repos_url":"https://api.github.com/users/thevery/repos","events_url":"https://api.github.com/users/thevery/events{/privacy}","received_events_url":"https://api.github.com/users/thevery/received_events","type":"User","site_admin":false},"body":"`strings.xml`!","created_at":"2015-01-20T10:37:19Z","updated_at":"2015-01-20T10:37:19Z","html_url":"https://github.com/IFMO-MobDev-2014/lesson8/pull/34#discussion_r23213825","pull_request_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/pulls/34","_links":{"self":{"href":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/pulls/comments/23213825"},"html":{"href":"https://github.com/IFMO-MobDev-2014/lesson8/pull/34#discussion_r23213825"},"pull_request":{"href":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/pulls/34"}}},"pull_request":{"url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/pulls/34","id":25695861,"html_url":"https://github.com/IFMO-MobDev-2014/lesson8/pull/34","diff_url":"https://github.com/IFMO-MobDev-2014/lesson8/pull/34.diff","patch_url":"https://github.com/IFMO-MobDev-2014/lesson8/pull/34.patch","issue_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/issues/34","number":34,"state":"open","locked":false,"title":"Мухутдинов Дмитрий, 2538: Lesson10","user":{"login":"flyingleafe","id":1803963,"avatar_url":"https://avatars.githubusercontent.com/u/1803963?v=3","gravatar_id":"","url":"https://api.github.com/users/flyingleafe","html_url":"https://github.com/flyingleafe","followers_url":"https://api.github.com/users/flyingleafe/followers","following_url":"https://api.github.com/users/flyingleafe/following{/other_user}","gists_url":"https://api.github.com/users/flyingleafe/gists{/gist_id}","starred_url":"https://api.github.com/users/flyingleafe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flyingleafe/subscriptions","organizations_url":"https://api.github.com/users/flyingleafe/orgs","repos_url":"https://api.github.com/users/flyingleafe/repos","events_url":"https://api.github.com/users/flyingleafe/events{/privacy}","received_events_url":"https://api.github.com/users/flyingleafe/received_events","type":"User","site_admin":false},"body":"Turns out what a good Android app should take much more time than any other educational task.\r\nNot everything is done, and things which are done aren't perfect.","created_at":"2014-12-08T20:49:58Z","updated_at":"2015-01-20T10:37:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a52dc8df8c45f559a72f041e6fc0e12b82602b8b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/pulls/34/commits","review_comments_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/pulls/34/comments","review_comment_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/pulls/comments/{number}","comments_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/issues/34/comments","statuses_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/statuses/51744ecbcd08a46303f68a0a9ea5c67367cf7773","head":{"label":"flyingleafe:lesson10","ref":"lesson10","sha":"51744ecbcd08a46303f68a0a9ea5c67367cf7773","user":{"login":"flyingleafe","id":1803963,"avatar_url":"https://avatars.githubusercontent.com/u/1803963?v=3","gravatar_id":"","url":"https://api.github.com/users/flyingleafe","html_url":"https://github.com/flyingleafe","followers_url":"https://api.github.com/users/flyingleafe/followers","following_url":"https://api.github.com/users/flyingleafe/following{/other_user}","gists_url":"https://api.github.com/users/flyingleafe/gists{/gist_id}","starred_url":"https://api.github.com/users/flyingleafe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flyingleafe/subscriptions","organizations_url":"https://api.github.com/users/flyingleafe/orgs","repos_url":"https://api.github.com/users/flyingleafe/repos","events_url":"https://api.github.com/users/flyingleafe/events{/privacy}","received_events_url":"https://api.github.com/users/flyingleafe/received_events","type":"User","site_admin":false},"repo":{"id":27273895,"name":"lesson8","full_name":"flyingleafe/lesson8","owner":{"login":"flyingleafe","id":1803963,"avatar_url":"https://avatars.githubusercontent.com/u/1803963?v=3","gravatar_id":"","url":"https://api.github.com/users/flyingleafe","html_url":"https://github.com/flyingleafe","followers_url":"https://api.github.com/users/flyingleafe/followers","following_url":"https://api.github.com/users/flyingleafe/following{/other_user}","gists_url":"https://api.github.com/users/flyingleafe/gists{/gist_id}","starred_url":"https://api.github.com/users/flyingleafe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flyingleafe/subscriptions","organizations_url":"https://api.github.com/users/flyingleafe/orgs","repos_url":"https://api.github.com/users/flyingleafe/repos","events_url":"https://api.github.com/users/flyingleafe/events{/privacy}","received_events_url":"https://api.github.com/users/flyingleafe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/flyingleafe/lesson8","description":"","fork":true,"url":"https://api.github.com/repos/flyingleafe/lesson8","forks_url":"https://api.github.com/repos/flyingleafe/lesson8/forks","keys_url":"https://api.github.com/repos/flyingleafe/lesson8/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flyingleafe/lesson8/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flyingleafe/lesson8/teams","hooks_url":"https://api.github.com/repos/flyingleafe/lesson8/hooks","issue_events_url":"https://api.github.com/repos/flyingleafe/lesson8/issues/events{/number}","events_url":"https://api.github.com/repos/flyingleafe/lesson8/events","assignees_url":"https://api.github.com/repos/flyingleafe/lesson8/assignees{/user}","branches_url":"https://api.github.com/repos/flyingleafe/lesson8/branches{/branch}","tags_url":"https://api.github.com/repos/flyingleafe/lesson8/tags","blobs_url":"https://api.github.com/repos/flyingleafe/lesson8/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flyingleafe/lesson8/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flyingleafe/lesson8/git/refs{/sha}","trees_url":"https://api.github.com/repos/flyingleafe/lesson8/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flyingleafe/lesson8/statuses/{sha}","languages_url":"https://api.github.com/repos/flyingleafe/lesson8/languages","stargazers_url":"https://api.github.com/repos/flyingleafe/lesson8/stargazers","contributors_url":"https://api.github.com/repos/flyingleafe/lesson8/contributors","subscribers_url":"https://api.github.com/repos/flyingleafe/lesson8/subscribers","subscription_url":"https://api.github.com/repos/flyingleafe/lesson8/subscription","commits_url":"https://api.github.com/repos/flyingleafe/lesson8/commits{/sha}","git_commits_url":"https://api.github.com/repos/flyingleafe/lesson8/git/commits{/sha}","comments_url":"https://api.github.com/repos/flyingleafe/lesson8/comments{/number}","issue_comment_url":"https://api.github.com/repos/flyingleafe/lesson8/issues/comments/{number}","contents_url":"https://api.github.com/repos/flyingleafe/lesson8/contents/{+path}","compare_url":"https://api.github.com/repos/flyingleafe/lesson8/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flyingleafe/lesson8/merges","archive_url":"https://api.github.com/repos/flyingleafe/lesson8/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flyingleafe/lesson8/downloads","issues_url":"https://api.github.com/repos/flyingleafe/lesson8/issues{/number}","pulls_url":"https://api.github.com/repos/flyingleafe/lesson8/pulls{/number}","milestones_url":"https://api.github.com/repos/flyingleafe/lesson8/milestones{/number}","notifications_url":"https://api.github.com/repos/flyingleafe/lesson8/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flyingleafe/lesson8/labels{/name}","releases_url":"https://api.github.com/repos/flyingleafe/lesson8/releases{/id}","created_at":"2014-11-28T16:13:14Z","updated_at":"2014-12-01T21:01:12Z","pushed_at":"2014-12-12T01:15:01Z","git_url":"git://github.com/flyingleafe/lesson8.git","ssh_url":"git@github.com:flyingleafe/lesson8.git","clone_url":"https://github.com/flyingleafe/lesson8.git","svn_url":"https://github.com/flyingleafe/lesson8","homepage":null,"size":3195,"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":"IFMO-MobDev-2014:master","ref":"master","sha":"108a0745cc1f02a3198b6ddf0adfba6962a24a26","user":{"login":"IFMO-MobDev-2014","id":8738407,"avatar_url":"https://avatars.githubusercontent.com/u/8738407?v=3","gravatar_id":"","url":"https://api.github.com/users/IFMO-MobDev-2014","html_url":"https://github.com/IFMO-MobDev-2014","followers_url":"https://api.github.com/users/IFMO-MobDev-2014/followers","following_url":"https://api.github.com/users/IFMO-MobDev-2014/following{/other_user}","gists_url":"https://api.github.com/users/IFMO-MobDev-2014/gists{/gist_id}","starred_url":"https://api.github.com/users/IFMO-MobDev-2014/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IFMO-MobDev-2014/subscriptions","organizations_url":"https://api.github.com/users/IFMO-MobDev-2014/orgs","repos_url":"https://api.github.com/users/IFMO-MobDev-2014/repos","events_url":"https://api.github.com/users/IFMO-MobDev-2014/events{/privacy}","received_events_url":"https://api.github.com/users/IFMO-MobDev-2014/received_events","type":"Organization","site_admin":false},"repo":{"id":27033654,"name":"lesson8","full_name":"IFMO-MobDev-2014/lesson8","owner":{"login":"IFMO-MobDev-2014","id":8738407,"avatar_url":"https://avatars.githubusercontent.com/u/8738407?v=3","gravatar_id":"","url":"https://api.github.com/users/IFMO-MobDev-2014","html_url":"https://github.com/IFMO-MobDev-2014","followers_url":"https://api.github.com/users/IFMO-MobDev-2014/followers","following_url":"https://api.github.com/users/IFMO-MobDev-2014/following{/other_user}","gists_url":"https://api.github.com/users/IFMO-MobDev-2014/gists{/gist_id}","starred_url":"https://api.github.com/users/IFMO-MobDev-2014/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IFMO-MobDev-2014/subscriptions","organizations_url":"https://api.github.com/users/IFMO-MobDev-2014/orgs","repos_url":"https://api.github.com/users/IFMO-MobDev-2014/repos","events_url":"https://api.github.com/users/IFMO-MobDev-2014/events{/privacy}","received_events_url":"https://api.github.com/users/IFMO-MobDev-2014/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/IFMO-MobDev-2014/lesson8","description":"","fork":false,"url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8","forks_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/forks","keys_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/keys{/key_id}","collaborators_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/teams","hooks_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/hooks","issue_events_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/issues/events{/number}","events_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/events","assignees_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/assignees{/user}","branches_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/branches{/branch}","tags_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/tags","blobs_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/git/refs{/sha}","trees_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/git/trees{/sha}","statuses_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/statuses/{sha}","languages_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/languages","stargazers_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/stargazers","contributors_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/contributors","subscribers_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/subscribers","subscription_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/subscription","commits_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/commits{/sha}","git_commits_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/git/commits{/sha}","comments_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/comments{/number}","issue_comment_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/issues/comments/{number}","contents_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/contents/{+path}","compare_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/compare/{base}...{head}","merges_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/merges","archive_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/downloads","issues_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/issues{/number}","pulls_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/pulls{/number}","milestones_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/milestones{/number}","notifications_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/labels{/name}","releases_url":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/releases{/id}","created_at":"2014-11-23T13:42:50Z","updated_at":"2014-11-23T14:07:36Z","pushed_at":"2014-11-23T14:07:36Z","git_url":"git://github.com/IFMO-MobDev-2014/lesson8.git","ssh_url":"git@github.com:IFMO-MobDev-2014/lesson8.git","clone_url":"https://github.com/IFMO-MobDev-2014/lesson8.git","svn_url":"https://github.com/IFMO-MobDev-2014/lesson8","homepage":null,"size":4923,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":56,"mirror_url":null,"open_issues_count":30,"forks":56,"open_issues":30,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/pulls/34"},"html":{"href":"https://github.com/IFMO-MobDev-2014/lesson8/pull/34"},"issue":{"href":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/issues/34"},"comments":{"href":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/issues/34/comments"},"review_comments":{"href":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/pulls/34/comments"},"review_comment":{"href":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/pulls/34/commits"},"statuses":{"href":"https://api.github.com/repos/IFMO-MobDev-2014/lesson8/statuses/51744ecbcd08a46303f68a0a9ea5c67367cf7773"}}}}