{"action":"created","comment":{"url":"https://api.github.com/repos/IFMO-Android-2015/homework1/pulls/comments/44226841","id":44226841,"diff_hunk":"@@ -0,0 +1,252 @@\n+package com.dz1.ifmo.daniil.calculator;\n+\n+import android.os.AsyncTask;\n+import android.os.Bundle;\n+import android.support.v7.app.AppCompatActivity;\n+import android.util.Log;\n+import android.view.View;\n+import android.widget.TextView;\n+\n+import expression.CheckedParser;\n+import expression.types.CheckedBigDecimal;\n+\n+public class MainActivity extends AppCompatActivity {\n+    public TextView expression;\n+    public TextView memoryStatus;\n+    public String memory;\n+    public int flag;\n+    public boolean finishCalc;\n+    public boolean writeInMem;\n+    public CalcTask ct;\n+\n+    static public class CalcTask extends AsyncTask<String, Void, String> {\n+        private MainActivity activity;\n+\n+        void attachActivity(MainActivity activity) {\n+            this.activity = activity;\n+        }\n+\n+        @Override\n+        protected String doInBackground(String... params) {\n+            try {\n+                if (params[0].length() != 0) {\n+                    return new CheckedParser<>(new CheckedBigDecimal(\"0\")).parse(params[0]).evaluate().toString();\n+                } else {\n+                    return \"\";\n+                }\n+            } catch (Exception e) {\n+                return \"Error\";\n+            }\n+        }\n+\n+        @Override\n+        protected void onPostExecute(String result) {\n+            super.onPostExecute(result);\n+            if (activity.writeInMem == true) {\n+                activity.memory = result;\n+            } else {\n+                activity.expression.setText(result);\n+                if (result.equals(\"Error\")) {\n+                    activity.flag = 2;\n+                } else {\n+                    activity.flag = 1;\n+                }\n+            }\n+            activity.finishCalc = true;\n+        }\n+    }\n+\n+\n+    @Override\n+    protected void onCreate(Bundle savedInstanceState) {\n+        Log.d(\"DEBUG\", \"Create new activity\");\n+        super.onCreate(savedInstanceState);\n+        setContentView(R.layout.activity_main);\n+\n+        expression = (TextView) findViewById(R.id.expr);\n+        memoryStatus = (TextView) findViewById(R.id.mexpr);\n+\n+        ct = (CalcTask) getLastCustomNonConfigurationInstance();\n+        if (ct != null) {\n+            ct.attachActivity(this);\n+        }\n+\n+        if (savedInstanceState != null) {\n+            expression.setText(savedInstanceState.getString(\"EXPRESSION\"));\n+            memoryStatus.setText(savedInstanceState.getString(\"MEMORY_STATUS\"));\n+            memory = savedInstanceState.getString(\"MEMORY\");\n+            flag = savedInstanceState.getInt(\"FLAG\");\n+            finishCalc = savedInstanceState.getBoolean(\"FINISH_CALC\");\n+            writeInMem = savedInstanceState.getBoolean(\"WRITE_IN_MEMORY\");\n+        } else {\n+            memory =\"\";\n+            flag = 0;\n+            finishCalc = true;\n+            writeInMem = true;\n+        }\n+    }\n+\n+    public boolean toClear(View v) {\n+        return  ((v.getId() == R.id.Button0) || (v.getId() == R.id.Button1) || (v.getId() == R.id.Button2)\n+                || (v.getId() == R.id.Button3) || (v.getId() == R.id.Button4) || (v.getId() == R.id.Button5)\n+                || (v.getId() == R.id.Button6) || (v.getId() == R.id.Button7) || (v.getId() == R.id.Button8)\n+                || (v.getId() == R.id.Button9) || (v.getId() == R.id.dotButton) || (v.getId() == R.id.lBButton)\n+                || (v.getId() == R.id.rBButton) || (v.getId() == R.id.piButton) || (v.getId() == R.id.eButton));\n+    }\n+\n+    public void onClick(View v) {\n+        if (!finishCalc) {\n+            return;\n+        }\n+\n+        if (flag == 2) {\n+            expression.setText(\"\");\n+            flag = 0;\n+        }\n+\n+        if (flag == 1) {","path":"app/src/main/java/com/dz1/ifmo/daniil/calculator/MainActivity.java","position":107,"original_position":107,"commit_id":"756714857af906005aed0f2138ace879ede20077","original_commit_id":"756714857af906005aed0f2138ace879ede20077","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\nЛибо сделать перечислением, либо назвать понятными словами 0, 1 & 2.","created_at":"2015-11-08T16:39:50Z","updated_at":"2015-11-08T16:39:50Z","html_url":"https://github.com/IFMO-Android-2015/homework1/pull/17#discussion_r44226841","pull_request_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/pulls/17","_links":{"self":{"href":"https://api.github.com/repos/IFMO-Android-2015/homework1/pulls/comments/44226841"},"html":{"href":"https://github.com/IFMO-Android-2015/homework1/pull/17#discussion_r44226841"},"pull_request":{"href":"https://api.github.com/repos/IFMO-Android-2015/homework1/pulls/17"}}},"pull_request":{"url":"https://api.github.com/repos/IFMO-Android-2015/homework1/pulls/17","id":49483088,"html_url":"https://github.com/IFMO-Android-2015/homework1/pull/17","diff_url":"https://github.com/IFMO-Android-2015/homework1/pull/17.diff","patch_url":"https://github.com/IFMO-Android-2015/homework1/pull/17.patch","issue_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/issues/17","number":17,"state":"open","locked":false,"title":"Толмачев Даниил","user":{"login":"Voidmster","id":15573313,"avatar_url":"https://avatars.githubusercontent.com/u/15573313?v=3","gravatar_id":"","url":"https://api.github.com/users/Voidmster","html_url":"https://github.com/Voidmster","followers_url":"https://api.github.com/users/Voidmster/followers","following_url":"https://api.github.com/users/Voidmster/following{/other_user}","gists_url":"https://api.github.com/users/Voidmster/gists{/gist_id}","starred_url":"https://api.github.com/users/Voidmster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Voidmster/subscriptions","organizations_url":"https://api.github.com/users/Voidmster/orgs","repos_url":"https://api.github.com/users/Voidmster/repos","events_url":"https://api.github.com/users/Voidmster/events{/privacy}","received_events_url":"https://api.github.com/users/Voidmster/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-11-02T20:44:44Z","updated_at":"2015-11-08T16:39:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"296651acb84f05381b143dac1d04009f12ab3ef4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/pulls/17/commits","review_comments_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/pulls/17/comments","review_comment_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/pulls/comments{/number}","comments_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/issues/17/comments","statuses_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/statuses/756714857af906005aed0f2138ace879ede20077","head":{"label":"Voidmster:master","ref":"master","sha":"756714857af906005aed0f2138ace879ede20077","user":{"login":"Voidmster","id":15573313,"avatar_url":"https://avatars.githubusercontent.com/u/15573313?v=3","gravatar_id":"","url":"https://api.github.com/users/Voidmster","html_url":"https://github.com/Voidmster","followers_url":"https://api.github.com/users/Voidmster/followers","following_url":"https://api.github.com/users/Voidmster/following{/other_user}","gists_url":"https://api.github.com/users/Voidmster/gists{/gist_id}","starred_url":"https://api.github.com/users/Voidmster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Voidmster/subscriptions","organizations_url":"https://api.github.com/users/Voidmster/orgs","repos_url":"https://api.github.com/users/Voidmster/repos","events_url":"https://api.github.com/users/Voidmster/events{/privacy}","received_events_url":"https://api.github.com/users/Voidmster/received_events","type":"User","site_admin":false},"repo":{"id":45405249,"name":"homework1","full_name":"Voidmster/homework1","owner":{"login":"Voidmster","id":15573313,"avatar_url":"https://avatars.githubusercontent.com/u/15573313?v=3","gravatar_id":"","url":"https://api.github.com/users/Voidmster","html_url":"https://github.com/Voidmster","followers_url":"https://api.github.com/users/Voidmster/followers","following_url":"https://api.github.com/users/Voidmster/following{/other_user}","gists_url":"https://api.github.com/users/Voidmster/gists{/gist_id}","starred_url":"https://api.github.com/users/Voidmster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Voidmster/subscriptions","organizations_url":"https://api.github.com/users/Voidmster/orgs","repos_url":"https://api.github.com/users/Voidmster/repos","events_url":"https://api.github.com/users/Voidmster/events{/privacy}","received_events_url":"https://api.github.com/users/Voidmster/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Voidmster/homework1","description":"","fork":true,"url":"https://api.github.com/repos/Voidmster/homework1","forks_url":"https://api.github.com/repos/Voidmster/homework1/forks","keys_url":"https://api.github.com/repos/Voidmster/homework1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Voidmster/homework1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Voidmster/homework1/teams","hooks_url":"https://api.github.com/repos/Voidmster/homework1/hooks","issue_events_url":"https://api.github.com/repos/Voidmster/homework1/issues/events{/number}","events_url":"https://api.github.com/repos/Voidmster/homework1/events","assignees_url":"https://api.github.com/repos/Voidmster/homework1/assignees{/user}","branches_url":"https://api.github.com/repos/Voidmster/homework1/branches{/branch}","tags_url":"https://api.github.com/repos/Voidmster/homework1/tags","blobs_url":"https://api.github.com/repos/Voidmster/homework1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Voidmster/homework1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Voidmster/homework1/git/refs{/sha}","trees_url":"https://api.github.com/repos/Voidmster/homework1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Voidmster/homework1/statuses/{sha}","languages_url":"https://api.github.com/repos/Voidmster/homework1/languages","stargazers_url":"https://api.github.com/repos/Voidmster/homework1/stargazers","contributors_url":"https://api.github.com/repos/Voidmster/homework1/contributors","subscribers_url":"https://api.github.com/repos/Voidmster/homework1/subscribers","subscription_url":"https://api.github.com/repos/Voidmster/homework1/subscription","commits_url":"https://api.github.com/repos/Voidmster/homework1/commits{/sha}","git_commits_url":"https://api.github.com/repos/Voidmster/homework1/git/commits{/sha}","comments_url":"https://api.github.com/repos/Voidmster/homework1/comments{/number}","issue_comment_url":"https://api.github.com/repos/Voidmster/homework1/issues/comments{/number}","contents_url":"https://api.github.com/repos/Voidmster/homework1/contents/{+path}","compare_url":"https://api.github.com/repos/Voidmster/homework1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Voidmster/homework1/merges","archive_url":"https://api.github.com/repos/Voidmster/homework1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Voidmster/homework1/downloads","issues_url":"https://api.github.com/repos/Voidmster/homework1/issues{/number}","pulls_url":"https://api.github.com/repos/Voidmster/homework1/pulls{/number}","milestones_url":"https://api.github.com/repos/Voidmster/homework1/milestones{/number}","notifications_url":"https://api.github.com/repos/Voidmster/homework1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Voidmster/homework1/labels{/name}","releases_url":"https://api.github.com/repos/Voidmster/homework1/releases{/id}","created_at":"2015-11-02T16:03:30Z","updated_at":"2015-11-02T20:30:57Z","pushed_at":"2015-11-02T20:43:29Z","git_url":"git://github.com/Voidmster/homework1.git","ssh_url":"git@github.com:Voidmster/homework1.git","clone_url":"https://github.com/Voidmster/homework1.git","svn_url":"https://github.com/Voidmster/homework1","homepage":null,"size":270,"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":"cdba00f6819b33da0471f8c16e24aa4849063ef0","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":45344078,"name":"homework1","full_name":"IFMO-Android-2015/homework1","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/homework1","description":"","fork":false,"url":"https://api.github.com/repos/IFMO-Android-2015/homework1","forks_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/forks","keys_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/teams","hooks_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/hooks","issue_events_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/issues/events{/number}","events_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/events","assignees_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/assignees{/user}","branches_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/branches{/branch}","tags_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/tags","blobs_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/git/refs{/sha}","trees_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/statuses/{sha}","languages_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/languages","stargazers_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/stargazers","contributors_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/contributors","subscribers_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/subscribers","subscription_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/subscription","commits_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/commits{/sha}","git_commits_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/git/commits{/sha}","comments_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/comments{/number}","issue_comment_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/issues/comments{/number}","contents_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/contents/{+path}","compare_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/merges","archive_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/downloads","issues_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/issues{/number}","pulls_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/pulls{/number}","milestones_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/milestones{/number}","notifications_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/labels{/name}","releases_url":"https://api.github.com/repos/IFMO-Android-2015/homework1/releases{/id}","created_at":"2015-11-01T14:43:27Z","updated_at":"2015-11-01T14:43:27Z","pushed_at":"2015-11-08T14:34:38Z","git_url":"git://github.com/IFMO-Android-2015/homework1.git","ssh_url":"git@github.com:IFMO-Android-2015/homework1.git","clone_url":"https://github.com/IFMO-Android-2015/homework1.git","svn_url":"https://github.com/IFMO-Android-2015/homework1","homepage":null,"size":1176,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":42,"mirror_url":null,"open_issues_count":31,"forks":42,"open_issues":31,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/IFMO-Android-2015/homework1/pulls/17"},"html":{"href":"https://github.com/IFMO-Android-2015/homework1/pull/17"},"issue":{"href":"https://api.github.com/repos/IFMO-Android-2015/homework1/issues/17"},"comments":{"href":"https://api.github.com/repos/IFMO-Android-2015/homework1/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/IFMO-Android-2015/homework1/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/IFMO-Android-2015/homework1/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/IFMO-Android-2015/homework1/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/IFMO-Android-2015/homework1/statuses/756714857af906005aed0f2138ace879ede20077"}}}}