{"action":"created","comment":{"url":"https://api.github.com/repos/fossasia/open-event-android/pulls/comments/36591415","id":36591415,"diff_hunk":"@@ -2,33 +2,74 @@\n \n import android.os.Bundle;\n import android.support.annotation.Nullable;\n+import android.support.design.widget.Snackbar;\n import android.support.v4.app.Fragment;\n+import android.support.v4.widget.SwipeRefreshLayout;\n import android.support.v7.widget.LinearLayoutManager;\n import android.support.v7.widget.RecyclerView;\n+import android.util.Log;\n import android.view.LayoutInflater;\n import android.view.View;\n import android.view.ViewGroup;\n \n+import com.squareup.otto.Bus;\n+import com.squareup.otto.Subscribe;\n+\n+import org.fossasia.openevent.OpenEventApp;\n import org.fossasia.openevent.adapters.SponsorsListAdapter;\n import org.fossasia.openevent.R;\n+import org.fossasia.openevent.dbutils.DataDownload;\n+import org.fossasia.openevent.dbutils.DbContract;\n import org.fossasia.openevent.dbutils.DbSingleton;\n+import org.fossasia.openevent.events.SpeakerDownloadEvent;\n+import org.fossasia.openevent.events.SponsorDownloadEvent;\n \n /**\n  * Created by MananWason on 05-06-2015.\n  */\n public class SponsorsFragment extends Fragment {\n-    RecyclerView sponsorsRecyclerView;\n-    SponsorsListAdapter sponsorsListAdapter;\n-    DbSingleton dbSingleton = DbSingleton.getInstance();\n+    private RecyclerView sponsorsRecyclerView;\n+    private SponsorsListAdapter sponsorsListAdapter;\n+    private SwipeRefreshLayout swipeRefreshLayout;\n \n     @Nullable\n     @Override\n     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\n         View view = inflater.inflate(R.layout.list_sponsors, container, false);\n+\n+        Bus bus = OpenEventApp.getEventBus();\n+        bus.register(this);\n         sponsorsRecyclerView = (RecyclerView) view.findViewById(R.id.list_sponsors);\n+        final DbSingleton dbSingleton = DbSingleton.getInstance();\n+\n+        swipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.sponsor_swipe_refresh);\n+        swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {\n+            @Override\n+            public void onRefresh() {\n+                DataDownload download = new DataDownload();\n+                dbSingleton.clearDatabase(DbContract.Sponsors.TABLE_NAME);\n+                download.downloadSponsors();\n+\n+            }\n+        });\n         sponsorsListAdapter = new SponsorsListAdapter(dbSingleton.getSponsorList());\n         sponsorsRecyclerView.setAdapter(sponsorsListAdapter);\n         sponsorsRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));\n         return view;\n     }\n+\n+    @Subscribe\n+    public void sponsorDownloadDone(SponsorDownloadEvent event) {\n+\n+        swipeRefreshLayout.setRefreshing(false);\n+        if (event.isState()) {\n+            sponsorsListAdapter.refresh();\n+            Log.d(\"countersp\", \"Refresh done\");\n+\n+        } else {\n+            Snackbar.make(getView(), \"Couldn't Refresh\", Snackbar.LENGTH_LONG).show();","path":"app/src/main/java/org/fossasia/openevent/fragments/SponsorsFragment.java","position":72,"original_position":72,"commit_id":"3b378cd15965c34d2e2a7a1f0b46ee8d32acdf9b","original_commit_id":"3b378cd15965c34d2e2a7a1f0b46ee8d32acdf9b","user":{"login":"creativepsyco","id":547235,"avatar_url":"https://avatars.githubusercontent.com/u/547235?v=3","gravatar_id":"","url":"https://api.github.com/users/creativepsyco","html_url":"https://github.com/creativepsyco","followers_url":"https://api.github.com/users/creativepsyco/followers","following_url":"https://api.github.com/users/creativepsyco/following{/other_user}","gists_url":"https://api.github.com/users/creativepsyco/gists{/gist_id}","starred_url":"https://api.github.com/users/creativepsyco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/creativepsyco/subscriptions","organizations_url":"https://api.github.com/users/creativepsyco/orgs","repos_url":"https://api.github.com/users/creativepsyco/repos","events_url":"https://api.github.com/users/creativepsyco/events{/privacy}","received_events_url":"https://api.github.com/users/creativepsyco/received_events","type":"User","site_admin":false},"body":"This string should be localized, should be under values.xml","created_at":"2015-08-09T17:59:34Z","updated_at":"2015-08-09T17:59:34Z","html_url":"https://github.com/fossasia/open-event-android/pull/69#discussion_r36591415","pull_request_url":"https://api.github.com/repos/fossasia/open-event-android/pulls/69","_links":{"self":{"href":"https://api.github.com/repos/fossasia/open-event-android/pulls/comments/36591415"},"html":{"href":"https://github.com/fossasia/open-event-android/pull/69#discussion_r36591415"},"pull_request":{"href":"https://api.github.com/repos/fossasia/open-event-android/pulls/69"}}},"pull_request":{"url":"https://api.github.com/repos/fossasia/open-event-android/pulls/69","id":41971800,"html_url":"https://github.com/fossasia/open-event-android/pull/69","diff_url":"https://github.com/fossasia/open-event-android/pull/69.diff","patch_url":"https://github.com/fossasia/open-event-android/pull/69.patch","issue_url":"https://api.github.com/repos/fossasia/open-event-android/issues/69","number":69,"state":"open","locked":false,"title":"Data download, basic wear module, swipe to refresh, Time displayed acc. to user's timezone","user":{"login":"mananwason","id":10570249,"avatar_url":"https://avatars.githubusercontent.com/u/10570249?v=3","gravatar_id":"","url":"https://api.github.com/users/mananwason","html_url":"https://github.com/mananwason","followers_url":"https://api.github.com/users/mananwason/followers","following_url":"https://api.github.com/users/mananwason/following{/other_user}","gists_url":"https://api.github.com/users/mananwason/gists{/gist_id}","starred_url":"https://api.github.com/users/mananwason/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mananwason/subscriptions","organizations_url":"https://api.github.com/users/mananwason/orgs","repos_url":"https://api.github.com/users/mananwason/repos","events_url":"https://api.github.com/users/mananwason/events{/privacy}","received_events_url":"https://api.github.com/users/mananwason/received_events","type":"User","site_admin":false},"body":"@creativepsyco Please review and merge.","created_at":"2015-08-09T15:11:18Z","updated_at":"2015-08-09T17:59:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"75e55f514e46c5f7848b09ff694c09c41d3c188a","assignee":{"login":"creativepsyco","id":547235,"avatar_url":"https://avatars.githubusercontent.com/u/547235?v=3","gravatar_id":"","url":"https://api.github.com/users/creativepsyco","html_url":"https://github.com/creativepsyco","followers_url":"https://api.github.com/users/creativepsyco/followers","following_url":"https://api.github.com/users/creativepsyco/following{/other_user}","gists_url":"https://api.github.com/users/creativepsyco/gists{/gist_id}","starred_url":"https://api.github.com/users/creativepsyco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/creativepsyco/subscriptions","organizations_url":"https://api.github.com/users/creativepsyco/orgs","repos_url":"https://api.github.com/users/creativepsyco/repos","events_url":"https://api.github.com/users/creativepsyco/events{/privacy}","received_events_url":"https://api.github.com/users/creativepsyco/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/fossasia/open-event-android/pulls/69/commits","review_comments_url":"https://api.github.com/repos/fossasia/open-event-android/pulls/69/comments","review_comment_url":"https://api.github.com/repos/fossasia/open-event-android/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fossasia/open-event-android/issues/69/comments","statuses_url":"https://api.github.com/repos/fossasia/open-event-android/statuses/3b378cd15965c34d2e2a7a1f0b46ee8d32acdf9b","head":{"label":"mananwason:new_details","ref":"new_details","sha":"3b378cd15965c34d2e2a7a1f0b46ee8d32acdf9b","user":{"login":"mananwason","id":10570249,"avatar_url":"https://avatars.githubusercontent.com/u/10570249?v=3","gravatar_id":"","url":"https://api.github.com/users/mananwason","html_url":"https://github.com/mananwason","followers_url":"https://api.github.com/users/mananwason/followers","following_url":"https://api.github.com/users/mananwason/following{/other_user}","gists_url":"https://api.github.com/users/mananwason/gists{/gist_id}","starred_url":"https://api.github.com/users/mananwason/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mananwason/subscriptions","organizations_url":"https://api.github.com/users/mananwason/orgs","repos_url":"https://api.github.com/users/mananwason/repos","events_url":"https://api.github.com/users/mananwason/events{/privacy}","received_events_url":"https://api.github.com/users/mananwason/received_events","type":"User","site_admin":false},"repo":{"id":37741450,"name":"open-event-android","full_name":"mananwason/open-event-android","owner":{"login":"mananwason","id":10570249,"avatar_url":"https://avatars.githubusercontent.com/u/10570249?v=3","gravatar_id":"","url":"https://api.github.com/users/mananwason","html_url":"https://github.com/mananwason","followers_url":"https://api.github.com/users/mananwason/followers","following_url":"https://api.github.com/users/mananwason/following{/other_user}","gists_url":"https://api.github.com/users/mananwason/gists{/gist_id}","starred_url":"https://api.github.com/users/mananwason/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mananwason/subscriptions","organizations_url":"https://api.github.com/users/mananwason/orgs","repos_url":"https://api.github.com/users/mananwason/repos","events_url":"https://api.github.com/users/mananwason/events{/privacy}","received_events_url":"https://api.github.com/users/mananwason/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mananwason/open-event-android","description":"The Open Event Android Client","fork":true,"url":"https://api.github.com/repos/mananwason/open-event-android","forks_url":"https://api.github.com/repos/mananwason/open-event-android/forks","keys_url":"https://api.github.com/repos/mananwason/open-event-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mananwason/open-event-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mananwason/open-event-android/teams","hooks_url":"https://api.github.com/repos/mananwason/open-event-android/hooks","issue_events_url":"https://api.github.com/repos/mananwason/open-event-android/issues/events{/number}","events_url":"https://api.github.com/repos/mananwason/open-event-android/events","assignees_url":"https://api.github.com/repos/mananwason/open-event-android/assignees{/user}","branches_url":"https://api.github.com/repos/mananwason/open-event-android/branches{/branch}","tags_url":"https://api.github.com/repos/mananwason/open-event-android/tags","blobs_url":"https://api.github.com/repos/mananwason/open-event-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mananwason/open-event-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mananwason/open-event-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/mananwason/open-event-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mananwason/open-event-android/statuses/{sha}","languages_url":"https://api.github.com/repos/mananwason/open-event-android/languages","stargazers_url":"https://api.github.com/repos/mananwason/open-event-android/stargazers","contributors_url":"https://api.github.com/repos/mananwason/open-event-android/contributors","subscribers_url":"https://api.github.com/repos/mananwason/open-event-android/subscribers","subscription_url":"https://api.github.com/repos/mananwason/open-event-android/subscription","commits_url":"https://api.github.com/repos/mananwason/open-event-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/mananwason/open-event-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/mananwason/open-event-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/mananwason/open-event-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/mananwason/open-event-android/contents/{+path}","compare_url":"https://api.github.com/repos/mananwason/open-event-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mananwason/open-event-android/merges","archive_url":"https://api.github.com/repos/mananwason/open-event-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mananwason/open-event-android/downloads","issues_url":"https://api.github.com/repos/mananwason/open-event-android/issues{/number}","pulls_url":"https://api.github.com/repos/mananwason/open-event-android/pulls{/number}","milestones_url":"https://api.github.com/repos/mananwason/open-event-android/milestones{/number}","notifications_url":"https://api.github.com/repos/mananwason/open-event-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mananwason/open-event-android/labels{/name}","releases_url":"https://api.github.com/repos/mananwason/open-event-android/releases{/id}","created_at":"2015-06-19T19:22:59Z","updated_at":"2015-06-19T19:23:00Z","pushed_at":"2015-08-09T15:12:31Z","git_url":"git://github.com/mananwason/open-event-android.git","ssh_url":"git@github.com:mananwason/open-event-android.git","clone_url":"https://github.com/mananwason/open-event-android.git","svn_url":"https://github.com/mananwason/open-event-android","homepage":null,"size":698,"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":"fossasia:master","ref":"master","sha":"bd1438a0d55ece2598fd49556703b44a0457d20a","user":{"login":"fossasia","id":6295529,"avatar_url":"https://avatars.githubusercontent.com/u/6295529?v=3","gravatar_id":"","url":"https://api.github.com/users/fossasia","html_url":"https://github.com/fossasia","followers_url":"https://api.github.com/users/fossasia/followers","following_url":"https://api.github.com/users/fossasia/following{/other_user}","gists_url":"https://api.github.com/users/fossasia/gists{/gist_id}","starred_url":"https://api.github.com/users/fossasia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fossasia/subscriptions","organizations_url":"https://api.github.com/users/fossasia/orgs","repos_url":"https://api.github.com/users/fossasia/repos","events_url":"https://api.github.com/users/fossasia/events{/privacy}","received_events_url":"https://api.github.com/users/fossasia/received_events","type":"Organization","site_admin":false},"repo":{"id":35269607,"name":"open-event-android","full_name":"fossasia/open-event-android","owner":{"login":"fossasia","id":6295529,"avatar_url":"https://avatars.githubusercontent.com/u/6295529?v=3","gravatar_id":"","url":"https://api.github.com/users/fossasia","html_url":"https://github.com/fossasia","followers_url":"https://api.github.com/users/fossasia/followers","following_url":"https://api.github.com/users/fossasia/following{/other_user}","gists_url":"https://api.github.com/users/fossasia/gists{/gist_id}","starred_url":"https://api.github.com/users/fossasia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fossasia/subscriptions","organizations_url":"https://api.github.com/users/fossasia/orgs","repos_url":"https://api.github.com/users/fossasia/repos","events_url":"https://api.github.com/users/fossasia/events{/privacy}","received_events_url":"https://api.github.com/users/fossasia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fossasia/open-event-android","description":"The Open Event Android Client","fork":false,"url":"https://api.github.com/repos/fossasia/open-event-android","forks_url":"https://api.github.com/repos/fossasia/open-event-android/forks","keys_url":"https://api.github.com/repos/fossasia/open-event-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fossasia/open-event-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fossasia/open-event-android/teams","hooks_url":"https://api.github.com/repos/fossasia/open-event-android/hooks","issue_events_url":"https://api.github.com/repos/fossasia/open-event-android/issues/events{/number}","events_url":"https://api.github.com/repos/fossasia/open-event-android/events","assignees_url":"https://api.github.com/repos/fossasia/open-event-android/assignees{/user}","branches_url":"https://api.github.com/repos/fossasia/open-event-android/branches{/branch}","tags_url":"https://api.github.com/repos/fossasia/open-event-android/tags","blobs_url":"https://api.github.com/repos/fossasia/open-event-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fossasia/open-event-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fossasia/open-event-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/fossasia/open-event-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fossasia/open-event-android/statuses/{sha}","languages_url":"https://api.github.com/repos/fossasia/open-event-android/languages","stargazers_url":"https://api.github.com/repos/fossasia/open-event-android/stargazers","contributors_url":"https://api.github.com/repos/fossasia/open-event-android/contributors","subscribers_url":"https://api.github.com/repos/fossasia/open-event-android/subscribers","subscription_url":"https://api.github.com/repos/fossasia/open-event-android/subscription","commits_url":"https://api.github.com/repos/fossasia/open-event-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/fossasia/open-event-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/fossasia/open-event-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/fossasia/open-event-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/fossasia/open-event-android/contents/{+path}","compare_url":"https://api.github.com/repos/fossasia/open-event-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fossasia/open-event-android/merges","archive_url":"https://api.github.com/repos/fossasia/open-event-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fossasia/open-event-android/downloads","issues_url":"https://api.github.com/repos/fossasia/open-event-android/issues{/number}","pulls_url":"https://api.github.com/repos/fossasia/open-event-android/pulls{/number}","milestones_url":"https://api.github.com/repos/fossasia/open-event-android/milestones{/number}","notifications_url":"https://api.github.com/repos/fossasia/open-event-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fossasia/open-event-android/labels{/name}","releases_url":"https://api.github.com/repos/fossasia/open-event-android/releases{/id}","created_at":"2015-05-08T09:04:11Z","updated_at":"2015-07-07T13:06:04Z","pushed_at":"2015-08-09T15:12:31Z","git_url":"git://github.com/fossasia/open-event-android.git","ssh_url":"git@github.com:fossasia/open-event-android.git","clone_url":"https://github.com/fossasia/open-event-android.git","svn_url":"https://github.com/fossasia/open-event-android","homepage":null,"size":1020,"stargazers_count":4,"watchers_count":4,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":12,"forks":6,"open_issues":12,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fossasia/open-event-android/pulls/69"},"html":{"href":"https://github.com/fossasia/open-event-android/pull/69"},"issue":{"href":"https://api.github.com/repos/fossasia/open-event-android/issues/69"},"comments":{"href":"https://api.github.com/repos/fossasia/open-event-android/issues/69/comments"},"review_comments":{"href":"https://api.github.com/repos/fossasia/open-event-android/pulls/69/comments"},"review_comment":{"href":"https://api.github.com/repos/fossasia/open-event-android/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fossasia/open-event-android/pulls/69/commits"},"statuses":{"href":"https://api.github.com/repos/fossasia/open-event-android/statuses/3b378cd15965c34d2e2a7a1f0b46ee8d32acdf9b"}}}}