{"action":"created","comment":{"url":"https://api.github.com/repos/IFMO-Android-2015/homework4/pulls/comments/45561263","id":45561263,"diff_hunk":"@@ -0,0 +1,73 @@\n+package ru.ifmo.android_2015.compass;\n+\n+import android.content.Context;\n+import android.graphics.Canvas;\n+import android.graphics.Paint;\n+import android.hardware.Sensor;\n+import android.hardware.SensorEvent;\n+import android.hardware.SensorEventListener;\n+import android.util.AttributeSet;\n+import android.view.View;\n+\n+import java.util.Random;\n+\n+/**\n+ * Created by sandwwraith(@gmail.com)\n+ * ITMO University, 2015.\n+ */\n+public class CompassView extends View implements SensorEventListener {\n+\n+    private final Paint circlePaint = new Paint();\n+    private final Paint arrowPaint = new Paint();\n+\n+    private float x_mag = 0, y_mag = 0; //Data from sensor\n+\n+    public CompassView(Context context, AttributeSet attrs) {\n+        super(context, attrs);\n+\n+        circlePaint.setColor(new Random().nextInt());\n+        int c = circlePaint.getColor();\n+        c |= (0xFF << 16); //Setting red value to maximum\n+        arrowPaint.setColor(c);\n+\n+        circlePaint.setStrokeWidth(15);\n+        arrowPaint.setStrokeWidth(10);\n+\n+        circlePaint.setStyle(Paint.Style.STROKE);\n+    }\n+\n+    @Override\n+    public void onSensorChanged(SensorEvent event) {\n+        x_mag = event.values[0];\n+        y_mag = event.values[1];\n+        invalidate();\n+    }\n+\n+    @Override\n+    public void onAccuracyChanged(Sensor sensor, int accuracy) {\n+\n+    }\n+\n+    @Override\n+    protected void onDraw(Canvas canvas) {\n+        super.onDraw(canvas);\n+\n+        double len = Math.sqrt(x_mag * x_mag + y_mag * y_mag);\n+        double cos = x_mag / len;\n+        double sin = y_mag / len;\n+\n+        float R; // Circle radius\n+        int width = getWidth();\n+        int height = getHeight();\n+\n+        float x_center = width / 2;\n+        float y_center = height / 2;\n+        R = Math.min(width, height) / 2.1f; // Cannot use 2 because android cannot stroke line inside - half of the line won't fit screen","path":"app/src/main/java/ru/ifmo/android_2015/compass/CompassView.java","position":65,"original_position":65,"commit_id":"bf9ec7ec2a224abeeaf981bb13dcf71e16b8e94b","original_commit_id":"bf9ec7ec2a224abeeaf981bb13dcf71e16b8e94b","user":{"login":"HighFlyer13","id":2953187,"avatar_url":"https://avatars.githubusercontent.com/u/2953187?v=3","gravatar_id":"","url":"https://api.github.com/users/HighFlyer13","html_url":"https://github.com/HighFlyer13","followers_url":"https://api.github.com/users/HighFlyer13/followers","following_url":"https://api.github.com/users/HighFlyer13/following{/other_user}","gists_url":"https://api.github.com/users/HighFlyer13/gists{/gist_id}","starred_url":"https://api.github.com/users/HighFlyer13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HighFlyer13/subscriptions","organizations_url":"https://api.github.com/users/HighFlyer13/orgs","repos_url":"https://api.github.com/users/HighFlyer13/repos","events_url":"https://api.github.com/users/HighFlyer13/events{/privacy}","received_events_url":"https://api.github.com/users/HighFlyer13/received_events","type":"User","site_admin":false},"body":"Если решается описанная проблема, может из R вычесть толщину линии?","created_at":"2015-11-22T17:05:38Z","updated_at":"2015-11-22T17:05:38Z","html_url":"https://github.com/IFMO-Android-2015/homework4/pull/1#discussion_r45561263","pull_request_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/IFMO-Android-2015/homework4/pulls/comments/45561263"},"html":{"href":"https://github.com/IFMO-Android-2015/homework4/pull/1#discussion_r45561263"},"pull_request":{"href":"https://api.github.com/repos/IFMO-Android-2015/homework4/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/IFMO-Android-2015/homework4/pulls/1","id":50502244,"html_url":"https://github.com/IFMO-Android-2015/homework4/pull/1","diff_url":"https://github.com/IFMO-Android-2015/homework4/pull/1.diff","patch_url":"https://github.com/IFMO-Android-2015/homework4/pull/1.patch","issue_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/issues/1","number":1,"state":"open","locked":false,"title":"Task 3(4?) Ready","user":{"login":"sandwwraith","id":11777575,"avatar_url":"https://avatars.githubusercontent.com/u/11777575?v=3","gravatar_id":"","url":"https://api.github.com/users/sandwwraith","html_url":"https://github.com/sandwwraith","followers_url":"https://api.github.com/users/sandwwraith/followers","following_url":"https://api.github.com/users/sandwwraith/following{/other_user}","gists_url":"https://api.github.com/users/sandwwraith/gists{/gist_id}","starred_url":"https://api.github.com/users/sandwwraith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandwwraith/subscriptions","organizations_url":"https://api.github.com/users/sandwwraith/orgs","repos_url":"https://api.github.com/users/sandwwraith/repos","events_url":"https://api.github.com/users/sandwwraith/events{/privacy}","received_events_url":"https://api.github.com/users/sandwwraith/received_events","type":"User","site_admin":false},"body":"#### *Старцев Леонид Михайлович*\r\n\r\nСкриншот:\r\n\r\n![img](http://i.imgur.com/paLIvZO.png?1)","created_at":"2015-11-12T11:56:28Z","updated_at":"2015-11-22T17:05:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2d864fabe5469168fbb52d3d8b2dec690680bedf","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/pulls/1/commits","review_comments_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/pulls/1/comments","review_comment_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/pulls/comments{/number}","comments_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/issues/1/comments","statuses_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/statuses/bf9ec7ec2a224abeeaf981bb13dcf71e16b8e94b","head":{"label":"sandwwraith:master","ref":"master","sha":"bf9ec7ec2a224abeeaf981bb13dcf71e16b8e94b","user":{"login":"sandwwraith","id":11777575,"avatar_url":"https://avatars.githubusercontent.com/u/11777575?v=3","gravatar_id":"","url":"https://api.github.com/users/sandwwraith","html_url":"https://github.com/sandwwraith","followers_url":"https://api.github.com/users/sandwwraith/followers","following_url":"https://api.github.com/users/sandwwraith/following{/other_user}","gists_url":"https://api.github.com/users/sandwwraith/gists{/gist_id}","starred_url":"https://api.github.com/users/sandwwraith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandwwraith/subscriptions","organizations_url":"https://api.github.com/users/sandwwraith/orgs","repos_url":"https://api.github.com/users/sandwwraith/repos","events_url":"https://api.github.com/users/sandwwraith/events{/privacy}","received_events_url":"https://api.github.com/users/sandwwraith/received_events","type":"User","site_admin":false},"repo":{"id":46038727,"name":"homework4","full_name":"sandwwraith/homework4","owner":{"login":"sandwwraith","id":11777575,"avatar_url":"https://avatars.githubusercontent.com/u/11777575?v=3","gravatar_id":"","url":"https://api.github.com/users/sandwwraith","html_url":"https://github.com/sandwwraith","followers_url":"https://api.github.com/users/sandwwraith/followers","following_url":"https://api.github.com/users/sandwwraith/following{/other_user}","gists_url":"https://api.github.com/users/sandwwraith/gists{/gist_id}","starred_url":"https://api.github.com/users/sandwwraith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandwwraith/subscriptions","organizations_url":"https://api.github.com/users/sandwwraith/orgs","repos_url":"https://api.github.com/users/sandwwraith/repos","events_url":"https://api.github.com/users/sandwwraith/events{/privacy}","received_events_url":"https://api.github.com/users/sandwwraith/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sandwwraith/homework4","description":"Компас","fork":true,"url":"https://api.github.com/repos/sandwwraith/homework4","forks_url":"https://api.github.com/repos/sandwwraith/homework4/forks","keys_url":"https://api.github.com/repos/sandwwraith/homework4/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sandwwraith/homework4/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sandwwraith/homework4/teams","hooks_url":"https://api.github.com/repos/sandwwraith/homework4/hooks","issue_events_url":"https://api.github.com/repos/sandwwraith/homework4/issues/events{/number}","events_url":"https://api.github.com/repos/sandwwraith/homework4/events","assignees_url":"https://api.github.com/repos/sandwwraith/homework4/assignees{/user}","branches_url":"https://api.github.com/repos/sandwwraith/homework4/branches{/branch}","tags_url":"https://api.github.com/repos/sandwwraith/homework4/tags","blobs_url":"https://api.github.com/repos/sandwwraith/homework4/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sandwwraith/homework4/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sandwwraith/homework4/git/refs{/sha}","trees_url":"https://api.github.com/repos/sandwwraith/homework4/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sandwwraith/homework4/statuses/{sha}","languages_url":"https://api.github.com/repos/sandwwraith/homework4/languages","stargazers_url":"https://api.github.com/repos/sandwwraith/homework4/stargazers","contributors_url":"https://api.github.com/repos/sandwwraith/homework4/contributors","subscribers_url":"https://api.github.com/repos/sandwwraith/homework4/subscribers","subscription_url":"https://api.github.com/repos/sandwwraith/homework4/subscription","commits_url":"https://api.github.com/repos/sandwwraith/homework4/commits{/sha}","git_commits_url":"https://api.github.com/repos/sandwwraith/homework4/git/commits{/sha}","comments_url":"https://api.github.com/repos/sandwwraith/homework4/comments{/number}","issue_comment_url":"https://api.github.com/repos/sandwwraith/homework4/issues/comments{/number}","contents_url":"https://api.github.com/repos/sandwwraith/homework4/contents/{+path}","compare_url":"https://api.github.com/repos/sandwwraith/homework4/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sandwwraith/homework4/merges","archive_url":"https://api.github.com/repos/sandwwraith/homework4/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sandwwraith/homework4/downloads","issues_url":"https://api.github.com/repos/sandwwraith/homework4/issues{/number}","pulls_url":"https://api.github.com/repos/sandwwraith/homework4/pulls{/number}","milestones_url":"https://api.github.com/repos/sandwwraith/homework4/milestones{/number}","notifications_url":"https://api.github.com/repos/sandwwraith/homework4/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sandwwraith/homework4/labels{/name}","releases_url":"https://api.github.com/repos/sandwwraith/homework4/releases{/id}","created_at":"2015-11-12T08:11:55Z","updated_at":"2015-11-12T11:52:28Z","pushed_at":"2015-11-12T11:52:25Z","git_url":"git://github.com/sandwwraith/homework4.git","ssh_url":"git@github.com:sandwwraith/homework4.git","clone_url":"https://github.com/sandwwraith/homework4.git","svn_url":"https://github.com/sandwwraith/homework4","homepage":null,"size":0,"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-Android-2015:master","ref":"master","sha":"0cf032a36d2d7616bbb0a2cc159581d66c9f8c92","user":{"login":"IFMO-Android-2015","id":15182437,"avatar_url":"https://avatars.githubusercontent.com/u/15182437?v=3","gravatar_id":"","url":"https://api.github.com/users/IFMO-Android-2015","html_url":"https://github.com/IFMO-Android-2015","followers_url":"https://api.github.com/users/IFMO-Android-2015/followers","following_url":"https://api.github.com/users/IFMO-Android-2015/following{/other_user}","gists_url":"https://api.github.com/users/IFMO-Android-2015/gists{/gist_id}","starred_url":"https://api.github.com/users/IFMO-Android-2015/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IFMO-Android-2015/subscriptions","organizations_url":"https://api.github.com/users/IFMO-Android-2015/orgs","repos_url":"https://api.github.com/users/IFMO-Android-2015/repos","events_url":"https://api.github.com/users/IFMO-Android-2015/events{/privacy}","received_events_url":"https://api.github.com/users/IFMO-Android-2015/received_events","type":"User","site_admin":false},"repo":{"id":45971155,"name":"homework4","full_name":"IFMO-Android-2015/homework4","owner":{"login":"IFMO-Android-2015","id":15182437,"avatar_url":"https://avatars.githubusercontent.com/u/15182437?v=3","gravatar_id":"","url":"https://api.github.com/users/IFMO-Android-2015","html_url":"https://github.com/IFMO-Android-2015","followers_url":"https://api.github.com/users/IFMO-Android-2015/followers","following_url":"https://api.github.com/users/IFMO-Android-2015/following{/other_user}","gists_url":"https://api.github.com/users/IFMO-Android-2015/gists{/gist_id}","starred_url":"https://api.github.com/users/IFMO-Android-2015/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IFMO-Android-2015/subscriptions","organizations_url":"https://api.github.com/users/IFMO-Android-2015/orgs","repos_url":"https://api.github.com/users/IFMO-Android-2015/repos","events_url":"https://api.github.com/users/IFMO-Android-2015/events{/privacy}","received_events_url":"https://api.github.com/users/IFMO-Android-2015/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/IFMO-Android-2015/homework4","description":"Компас","fork":false,"url":"https://api.github.com/repos/IFMO-Android-2015/homework4","forks_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/forks","keys_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/keys{/key_id}","collaborators_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/teams","hooks_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/hooks","issue_events_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/issues/events{/number}","events_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/events","assignees_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/assignees{/user}","branches_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/branches{/branch}","tags_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/tags","blobs_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/git/refs{/sha}","trees_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/git/trees{/sha}","statuses_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/statuses/{sha}","languages_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/languages","stargazers_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/stargazers","contributors_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/contributors","subscribers_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/subscribers","subscription_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/subscription","commits_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/commits{/sha}","git_commits_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/git/commits{/sha}","comments_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/comments{/number}","issue_comment_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/issues/comments{/number}","contents_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/contents/{+path}","compare_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/compare/{base}...{head}","merges_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/merges","archive_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/downloads","issues_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/issues{/number}","pulls_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/pulls{/number}","milestones_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/milestones{/number}","notifications_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/labels{/name}","releases_url":"https://api.github.com/repos/IFMO-Android-2015/homework4/releases{/id}","created_at":"2015-11-11T09:07:40Z","updated_at":"2015-11-11T09:07:40Z","pushed_at":"2015-11-22T15:35:38Z","git_url":"git://github.com/IFMO-Android-2015/homework4.git","ssh_url":"git@github.com:IFMO-Android-2015/homework4.git","clone_url":"https://github.com/IFMO-Android-2015/homework4.git","svn_url":"https://github.com/IFMO-Android-2015/homework4","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":22,"mirror_url":null,"open_issues_count":15,"forks":22,"open_issues":15,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/IFMO-Android-2015/homework4/pulls/1"},"html":{"href":"https://github.com/IFMO-Android-2015/homework4/pull/1"},"issue":{"href":"https://api.github.com/repos/IFMO-Android-2015/homework4/issues/1"},"comments":{"href":"https://api.github.com/repos/IFMO-Android-2015/homework4/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/IFMO-Android-2015/homework4/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/IFMO-Android-2015/homework4/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/IFMO-Android-2015/homework4/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/IFMO-Android-2015/homework4/statuses/bf9ec7ec2a224abeeaf981bb13dcf71e16b8e94b"}}}}