{"action":"created","comment":{"url":"https://api.github.com/repos/NovahubTech/ZenAndroid/pulls/comments/180991495","pull_request_review_id":111506806,"id":180991495,"diff_hunk":"@@ -1,18 +1,111 @@\n ﻿using System;\n using Android.App;\n+using Android.Content;\n using Android.OS;\n using Android.Views;\n using Android.Widget;\n+using Zen.Activities;\n+using Zen.Configuration;\n \n namespace Zen.Fragments\n {\n     public class SettingFragment : Fragment\n     {\n+        private static readonly Configuration.Configuration DefaultConfiguration = new Configuration.Configuration\n+        {\n+            BellEnable = true,\n+            Bell = \"Bell 1\",\n+            Time = 5,\n+            MusicEnable = true,\n+            Song = \"Let it be\",\n+            MusicVolume = 10,\n+            AmbientSoundEnable = true,\n+            Type = \"Bird\",\n+            AmbientSoundVolume = 10\n+        };\n+\n+        private readonly Configuration.Configuration configuration = UserConfiguration.Instance.Load() ?? DefaultConfiguration;\n+\n+        [InjectView(Resource.Id.tvIntervalBell)] private TextView tvIntervalBell;\n+\n+        [InjectView(Resource.Id.tvMusic)] private TextView tvMusic;\n+\n+        [InjectView(Resource.Id.tvAmbientSounds)] private TextView tvAmbientSounds;\n+\n+        [InjectOnClick(Resource.Id.cvSettingIntervalBell)]\n+        private void SettingIntervalBell(object sender, EventArgs e)\n+        {\n+            var intent = new Intent(Activity, typeof(SettingBellActivity));\n+            intent.PutExtra(\"BellEnable\", configuration.BellEnable);\n+            intent.PutExtra(\"Bell\", configuration.Bell);\n+            intent.PutExtra(\"Time\", configuration.Time);\n+            StartActivityForResult(intent, 1);\n+        }\n+\n+        [InjectOnClick(Resource.Id.cvSettingMusic)]\n+        private void SettingMusic(object sender, EventArgs e)\n+        {\n+            var intent = new Intent(Activity, typeof(SettingMusicActivity));\n+            intent.PutExtra(\"MusicEnable\", configuration.MusicEnable);\n+            intent.PutExtra(\"Song\", configuration.Song);\n+            intent.PutExtra(\"MusicVolume\", configuration.MusicVolume);\n+            StartActivityForResult(intent, 2);\n+        }\n+\n+        [InjectOnClick(Resource.Id.cvSettingAmbientSounds)]\n+        private void SettingAmbientSound(object sender, EventArgs e)\n+        {\n+            var intent = new Intent(Activity, typeof(SettingAmbientSound));\n+            intent.PutExtra(\"AmbientSoundEnable\", configuration.AmbientSoundEnable);\n+            intent.PutExtra(\"Type\", configuration.Type);\n+            intent.PutExtra(\"AmbientSoundVolume\", configuration.AmbientSoundVolume);\n+            StartActivityForResult(intent, 3);\n+        }\n+\n         public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)\n         {\n             var view = inflater.Inflate(Resource.Layout.SettingLayout, container, false);\n             Cheeseknife.Inject(this, view);\n+            Init();\n             return view;\n         }\n+\n+        private void Init()\n+        {\n+            SetWidgets(tvMusic, configuration.MusicEnable, configuration.Song);\n+            SetWidgets(tvIntervalBell, configuration.BellEnable, configuration.Bell);\n+            SetWidgets(tvAmbientSounds, configuration.AmbientSoundEnable, configuration.Type);\n+        }\n+\n+        public override void OnActivityResult(int requestCode, Result resultCode, Intent data)\n+        {\n+            if (resultCode != Result.Ok) return;\n+            switch (requestCode)\n+            {\n+                case 1:\n+                    configuration.BellEnable = data.GetBooleanExtra(\"BellEnable\", configuration.BellEnable);\n+                    configuration.Bell = data.GetStringExtra(\"Bell\");\n+                    configuration.Time = data.GetIntExtra(\"Time\", configuration.Time);\n+                    break;\n+                case 2:\n+                    configuration.MusicEnable = data.GetBooleanExtra(\"MusicEnable\", configuration.MusicEnable);","path":"Zen/Fragments/SettingFragment.cs","position":91,"original_position":91,"commit_id":"2d82a839f5901ac4838e81a343828b2b574f4716","original_commit_id":"2d82a839f5901ac4838e81a343828b2b574f4716","user":{"login":"voquanghoa","id":10450325,"avatar_url":"https://avatars0.githubusercontent.com/u/10450325?v=4","gravatar_id":"","url":"https://api.github.com/users/voquanghoa","html_url":"https://github.com/voquanghoa","followers_url":"https://api.github.com/users/voquanghoa/followers","following_url":"https://api.github.com/users/voquanghoa/following{/other_user}","gists_url":"https://api.github.com/users/voquanghoa/gists{/gist_id}","starred_url":"https://api.github.com/users/voquanghoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/voquanghoa/subscriptions","organizations_url":"https://api.github.com/users/voquanghoa/orgs","repos_url":"https://api.github.com/users/voquanghoa/repos","events_url":"https://api.github.com/users/voquanghoa/events{/privacy}","received_events_url":"https://api.github.com/users/voquanghoa/received_events","type":"User","site_admin":false},"body":"You can save the config from the child activities, so here, you just need to update the view values.","created_at":"2018-04-12T07:48:13Z","updated_at":"2018-04-12T07:53:44Z","html_url":"https://github.com/NovahubTech/ZenAndroid/pull/4#discussion_r180991495","pull_request_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/pulls/4","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/NovahubTech/ZenAndroid/pulls/comments/180991495"},"html":{"href":"https://github.com/NovahubTech/ZenAndroid/pull/4#discussion_r180991495"},"pull_request":{"href":"https://api.github.com/repos/NovahubTech/ZenAndroid/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/NovahubTech/ZenAndroid/pulls/4","id":180973821,"html_url":"https://github.com/NovahubTech/ZenAndroid/pull/4","diff_url":"https://github.com/NovahubTech/ZenAndroid/pull/4.diff","patch_url":"https://github.com/NovahubTech/ZenAndroid/pull/4.patch","issue_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/issues/4","number":4,"state":"open","locked":false,"title":"Settings screen","user":{"login":"nguyenvanman","id":28146284,"avatar_url":"https://avatars3.githubusercontent.com/u/28146284?v=4","gravatar_id":"","url":"https://api.github.com/users/nguyenvanman","html_url":"https://github.com/nguyenvanman","followers_url":"https://api.github.com/users/nguyenvanman/followers","following_url":"https://api.github.com/users/nguyenvanman/following{/other_user}","gists_url":"https://api.github.com/users/nguyenvanman/gists{/gist_id}","starred_url":"https://api.github.com/users/nguyenvanman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nguyenvanman/subscriptions","organizations_url":"https://api.github.com/users/nguyenvanman/orgs","repos_url":"https://api.github.com/users/nguyenvanman/repos","events_url":"https://api.github.com/users/nguyenvanman/events{/privacy}","received_events_url":"https://api.github.com/users/nguyenvanman/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-04-11T17:22:53Z","updated_at":"2018-04-12T07:53:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/pulls/4/commits","review_comments_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/pulls/4/comments","review_comment_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/pulls/comments{/number}","comments_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/issues/4/comments","statuses_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/statuses/2d82a839f5901ac4838e81a343828b2b574f4716","head":{"label":"NovahubTech:SettingsScreen","ref":"SettingsScreen","sha":"2d82a839f5901ac4838e81a343828b2b574f4716","user":{"login":"NovahubTech","id":37789332,"avatar_url":"https://avatars2.githubusercontent.com/u/37789332?v=4","gravatar_id":"","url":"https://api.github.com/users/NovahubTech","html_url":"https://github.com/NovahubTech","followers_url":"https://api.github.com/users/NovahubTech/followers","following_url":"https://api.github.com/users/NovahubTech/following{/other_user}","gists_url":"https://api.github.com/users/NovahubTech/gists{/gist_id}","starred_url":"https://api.github.com/users/NovahubTech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NovahubTech/subscriptions","organizations_url":"https://api.github.com/users/NovahubTech/orgs","repos_url":"https://api.github.com/users/NovahubTech/repos","events_url":"https://api.github.com/users/NovahubTech/events{/privacy}","received_events_url":"https://api.github.com/users/NovahubTech/received_events","type":"Organization","site_admin":false},"repo":{"id":126773419,"name":"ZenAndroid","full_name":"NovahubTech/ZenAndroid","owner":{"login":"NovahubTech","id":37789332,"avatar_url":"https://avatars2.githubusercontent.com/u/37789332?v=4","gravatar_id":"","url":"https://api.github.com/users/NovahubTech","html_url":"https://github.com/NovahubTech","followers_url":"https://api.github.com/users/NovahubTech/followers","following_url":"https://api.github.com/users/NovahubTech/following{/other_user}","gists_url":"https://api.github.com/users/NovahubTech/gists{/gist_id}","starred_url":"https://api.github.com/users/NovahubTech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NovahubTech/subscriptions","organizations_url":"https://api.github.com/users/NovahubTech/orgs","repos_url":"https://api.github.com/users/NovahubTech/repos","events_url":"https://api.github.com/users/NovahubTech/events{/privacy}","received_events_url":"https://api.github.com/users/NovahubTech/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NovahubTech/ZenAndroid","description":null,"fork":false,"url":"https://api.github.com/repos/NovahubTech/ZenAndroid","forks_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/forks","keys_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/teams","hooks_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/hooks","issue_events_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/issues/events{/number}","events_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/events","assignees_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/assignees{/user}","branches_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/branches{/branch}","tags_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/tags","blobs_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/git/refs{/sha}","trees_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/statuses/{sha}","languages_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/languages","stargazers_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/stargazers","contributors_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/contributors","subscribers_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/subscribers","subscription_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/subscription","commits_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/commits{/sha}","git_commits_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/git/commits{/sha}","comments_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/comments{/number}","issue_comment_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/issues/comments{/number}","contents_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/contents/{+path}","compare_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/merges","archive_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/downloads","issues_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/issues{/number}","pulls_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/pulls{/number}","milestones_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/milestones{/number}","notifications_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/labels{/name}","releases_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/releases{/id}","deployments_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/deployments","created_at":"2018-03-26T04:29:38Z","updated_at":"2018-04-02T14:32:49Z","pushed_at":"2018-04-11T17:22:54Z","git_url":"git://github.com/NovahubTech/ZenAndroid.git","ssh_url":"git@github.com:NovahubTech/ZenAndroid.git","clone_url":"https://github.com/NovahubTech/ZenAndroid.git","svn_url":"https://github.com/NovahubTech/ZenAndroid","homepage":null,"size":916,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"NovahubTech:master","ref":"master","sha":"9c40cd590881e92c1700fda2212a4694e378a1a9","user":{"login":"NovahubTech","id":37789332,"avatar_url":"https://avatars2.githubusercontent.com/u/37789332?v=4","gravatar_id":"","url":"https://api.github.com/users/NovahubTech","html_url":"https://github.com/NovahubTech","followers_url":"https://api.github.com/users/NovahubTech/followers","following_url":"https://api.github.com/users/NovahubTech/following{/other_user}","gists_url":"https://api.github.com/users/NovahubTech/gists{/gist_id}","starred_url":"https://api.github.com/users/NovahubTech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NovahubTech/subscriptions","organizations_url":"https://api.github.com/users/NovahubTech/orgs","repos_url":"https://api.github.com/users/NovahubTech/repos","events_url":"https://api.github.com/users/NovahubTech/events{/privacy}","received_events_url":"https://api.github.com/users/NovahubTech/received_events","type":"Organization","site_admin":false},"repo":{"id":126773419,"name":"ZenAndroid","full_name":"NovahubTech/ZenAndroid","owner":{"login":"NovahubTech","id":37789332,"avatar_url":"https://avatars2.githubusercontent.com/u/37789332?v=4","gravatar_id":"","url":"https://api.github.com/users/NovahubTech","html_url":"https://github.com/NovahubTech","followers_url":"https://api.github.com/users/NovahubTech/followers","following_url":"https://api.github.com/users/NovahubTech/following{/other_user}","gists_url":"https://api.github.com/users/NovahubTech/gists{/gist_id}","starred_url":"https://api.github.com/users/NovahubTech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NovahubTech/subscriptions","organizations_url":"https://api.github.com/users/NovahubTech/orgs","repos_url":"https://api.github.com/users/NovahubTech/repos","events_url":"https://api.github.com/users/NovahubTech/events{/privacy}","received_events_url":"https://api.github.com/users/NovahubTech/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NovahubTech/ZenAndroid","description":null,"fork":false,"url":"https://api.github.com/repos/NovahubTech/ZenAndroid","forks_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/forks","keys_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/teams","hooks_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/hooks","issue_events_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/issues/events{/number}","events_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/events","assignees_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/assignees{/user}","branches_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/branches{/branch}","tags_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/tags","blobs_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/git/refs{/sha}","trees_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/statuses/{sha}","languages_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/languages","stargazers_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/stargazers","contributors_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/contributors","subscribers_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/subscribers","subscription_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/subscription","commits_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/commits{/sha}","git_commits_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/git/commits{/sha}","comments_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/comments{/number}","issue_comment_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/issues/comments{/number}","contents_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/contents/{+path}","compare_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/merges","archive_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/downloads","issues_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/issues{/number}","pulls_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/pulls{/number}","milestones_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/milestones{/number}","notifications_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/labels{/name}","releases_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/releases{/id}","deployments_url":"https://api.github.com/repos/NovahubTech/ZenAndroid/deployments","created_at":"2018-03-26T04:29:38Z","updated_at":"2018-04-02T14:32:49Z","pushed_at":"2018-04-11T17:22:54Z","git_url":"git://github.com/NovahubTech/ZenAndroid.git","ssh_url":"git@github.com:NovahubTech/ZenAndroid.git","clone_url":"https://github.com/NovahubTech/ZenAndroid.git","svn_url":"https://github.com/NovahubTech/ZenAndroid","homepage":null,"size":916,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/NovahubTech/ZenAndroid/pulls/4"},"html":{"href":"https://github.com/NovahubTech/ZenAndroid/pull/4"},"issue":{"href":"https://api.github.com/repos/NovahubTech/ZenAndroid/issues/4"},"comments":{"href":"https://api.github.com/repos/NovahubTech/ZenAndroid/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/NovahubTech/ZenAndroid/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/NovahubTech/ZenAndroid/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/NovahubTech/ZenAndroid/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/NovahubTech/ZenAndroid/statuses/2d82a839f5901ac4838e81a343828b2b574f4716"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"voquanghoa"}}