{"action":"created","comment":{"url":"https://api.github.com/repos/MZuev/Resemblance/pulls/comments/93971600","pull_request_review_id":14414058,"id":93971600,"diff_hunk":"@@ -0,0 +1,193 @@\n+package ru.spbau.resemblance;\r\n+\r\n+import android.content.BroadcastReceiver;\r\n+import android.content.Context;\r\n+import android.content.Intent;\r\n+import android.content.IntentFilter;\r\n+import android.net.Uri;\r\n+import android.support.v4.content.LocalBroadcastManager;\r\n+import android.support.v7.app.AppCompatActivity;\r\n+import android.os.Bundle;\r\n+import android.widget.ImageView;\r\n+import android.widget.TextView;\r\n+\r\n+import java.util.ArrayList;\r\n+\r\n+public class GameIntermediateActivity extends AppCompatActivity implements Message.GameMessageListener {\r\n+    public static final String ROUNDS_NUMBER_PARAM = \"rounds_number\";\r\n+    public static final String PLAYERS_NUMBER_PARAM = \"players_number\";\r\n+    public static final String PLAYERS_NAMES_PARAM = \"players_names\";\r\n+    public static final int LEADING_ASSOCIATION_REQUEST = 1;\r\n+    public static final int CHOICE_REQUEST = 2;\r\n+    public static final int VOTE_REQUEST = 3;\r\n+\r\n+    private static final String ASSOCIATION_SUGGESTION = \"   Ассоциация: \";\r\n+    private static final String CHOICE_TITLE = \"Ваша карта\";\r\n+    private static final String VOTE_TITLE = \"Голосование\";\r\n+    private static final String ROUND_PREFIX = \"Раунд: \";\r\n+    private static final String SCORE_PREFIX = \"Счёт:\";\r\n+    private static final String UPDATE_SCREEN_MESSAGE = \"ru.spbau.resemblance.UPDATE_INFO\";\r\n+\r\n+    private final ArrayList<Long> cards = new ArrayList<>();\r\n+    private int roundsNumber = -1;\r\n+    private int currentRound = -1;\r\n+    private TextView roundText = null;\r\n+    private TextView scoreText = null;\r\n+    private ImageView answerView = null;\r\n+    private int playersNumber = -1;\r\n+    private ArrayList<String> playersNames = null;\r\n+    private int[] scores = null;\r\n+    private long answer = -1;\r\n+    private BroadcastReceiver receiver;\r\n+\r\n+    @Override\r\n+    protected void onCreate(Bundle savedInstanceState) {\r\n+        super.onCreate(savedInstanceState);\r\n+        setContentView(R.layout.activity_game_intermediate);\r\n+\r\n+        Message.setGameListener(this);\r\n+\r\n+        Intent callingIntent = getIntent();\r\n+        roundsNumber = callingIntent.getIntExtra(ROUNDS_NUMBER_PARAM, -1);\r\n+        currentRound = 1;\r\n+        playersNumber = callingIntent.getIntExtra(PLAYERS_NUMBER_PARAM, -1);\r\n+        playersNames = callingIntent.getStringArrayListExtra(PLAYERS_NAMES_PARAM);\r\n+        scores = new int[playersNumber];\r\n+\r\n+        roundText = (TextView)findViewById(R.id.intermediateRoundText);\r\n+        scoreText = (TextView)findViewById(R.id.intermediateScoreText);\r\n+        answerView = (ImageView)findViewById(R.id.intermediateAnswerView);\r\n+\r\n+        receiver = new UpdateScreenMessageReceiver();\r\n+        IntentFilter filter = new IntentFilter(UPDATE_SCREEN_MESSAGE);\r\n+        LocalBroadcastManager.getInstance(this).registerReceiver(receiver, filter);\r\n+    }\r\n+\r\n+    @Override\r\n+    protected void onResume() {\r\n+        super.onResume();\r\n+\r\n+        updateScreen();\r\n+    }\r\n+\r\n+    @Override\r\n+    public void onLeadRequest() {\r\n+        Intent lead = new Intent(this, LeadingCardsGridActivity.class);\r\n+        lead.putExtra(LeadingCardsGridActivity.OUR_CARDS_PARAM, getCardsArr());\r\n+        startActivityForResult(lead, LEADING_ASSOCIATION_REQUEST);\r\n+    }\r\n+\r\n+    @Override\r\n+    public void onChoiceRequest(String association) {\r\n+        Intent choose = new Intent(this, CardPickerActivity.class);\r\n+        choose.putExtra(CardPickerActivity.SUGGESTION_PARAM, ASSOCIATION_SUGGESTION + association);\r\n+        choose.putExtra(CardPickerActivity.TITLE_PARAM, CHOICE_TITLE);\r\n+        choose.putExtra(CardPickerActivity.OUR_CARDS_PARAM, getCardsArr());\r\n+        startActivityForResult(choose, CHOICE_REQUEST);\r\n+    }\r\n+\r\n+    @Override\r\n+    public void onVoteRequest(String association, long[] candidates) {\r\n+        Intent vote = new Intent(this, CardPickerActivity.class);\r\n+        vote.putExtra(CardPickerActivity.SUGGESTION_PARAM, ASSOCIATION_SUGGESTION+ association);\r\n+        vote.putExtra(CardPickerActivity.TITLE_PARAM, VOTE_TITLE);\r\n+        vote.putExtra(CardPickerActivity.OUR_CARDS_PARAM, candidates);\r\n+        startActivityForResult(vote, VOTE_REQUEST);\r\n+    }\r\n+\r\n+    @Override\r\n+    public void onSendCard(long card) {\r\n+        synchronized (cards) {\r\n+            cards.add(card);\r\n+        }\r\n+    }\r\n+\r\n+    @Override\r\n+    public void onRoundEnd(long leadersAssociation, int[] scores){\r\n+        this.scores = scores;\r\n+        answer = leadersAssociation;\r\n+        currentRound++;\r\n+\r\n+        LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent(UPDATE_SCREEN_MESSAGE));\r\n+    }\r\n+\r\n+    @Override\r\n+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {\r\n+        long pictureId = data.getLongExtra(LeadingCardsGridActivity.PICTURE_PARAM, -1L);\r\n+        switch (requestCode) {\r\n+            case LEADING_ASSOCIATION_REQUEST: {\r\n+                //Now we need to send the association and remove the card fom our cards list.\r\n+                String association = data.getStringExtra(LeadingCardsGridActivity.ASSOCIATION_PARAM);\r\n+\r\n+                cards.remove(cards.indexOf(pictureId));\r","path":"app/src/main/java/ru/spbau/resemblance/GameIntermediateActivity.java","position":122,"original_position":122,"commit_id":"ea92faa233c3088dd1dbf295a85827ea095417b1","original_commit_id":"ea92faa233c3088dd1dbf295a85827ea095417b1","user":{"login":"sproshev","id":4990763,"avatar_url":"https://avatars.githubusercontent.com/u/4990763?v=3","gravatar_id":"","url":"https://api.github.com/users/sproshev","html_url":"https://github.com/sproshev","followers_url":"https://api.github.com/users/sproshev/followers","following_url":"https://api.github.com/users/sproshev/following{/other_user}","gists_url":"https://api.github.com/users/sproshev/gists{/gist_id}","starred_url":"https://api.github.com/users/sproshev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sproshev/subscriptions","organizations_url":"https://api.github.com/users/sproshev/orgs","repos_url":"https://api.github.com/users/sproshev/repos","events_url":"https://api.github.com/users/sproshev/events{/privacy}","received_events_url":"https://api.github.com/users/sproshev/received_events","type":"User","site_admin":false},"body":"`cards.remove(pictureId);`","created_at":"2016-12-27T21:20:06Z","updated_at":"2016-12-27T21:36:20Z","html_url":"https://github.com/MZuev/Resemblance/pull/2#discussion_r93971600","pull_request_url":"https://api.github.com/repos/MZuev/Resemblance/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/MZuev/Resemblance/pulls/comments/93971600"},"html":{"href":"https://github.com/MZuev/Resemblance/pull/2#discussion_r93971600"},"pull_request":{"href":"https://api.github.com/repos/MZuev/Resemblance/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/MZuev/Resemblance/pulls/2","id":99360489,"html_url":"https://github.com/MZuev/Resemblance/pull/2","diff_url":"https://github.com/MZuev/Resemblance/pull/2.diff","patch_url":"https://github.com/MZuev/Resemblance/pull/2.patch","issue_url":"https://api.github.com/repos/MZuev/Resemblance/issues/2","number":2,"state":"open","locked":false,"title":"First code review of the client part","user":{"login":"ASGusev","id":5954975,"avatar_url":"https://avatars.githubusercontent.com/u/5954975?v=3","gravatar_id":"","url":"https://api.github.com/users/ASGusev","html_url":"https://github.com/ASGusev","followers_url":"https://api.github.com/users/ASGusev/followers","following_url":"https://api.github.com/users/ASGusev/following{/other_user}","gists_url":"https://api.github.com/users/ASGusev/gists{/gist_id}","starred_url":"https://api.github.com/users/ASGusev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ASGusev/subscriptions","organizations_url":"https://api.github.com/users/ASGusev/orgs","repos_url":"https://api.github.com/users/ASGusev/repos","events_url":"https://api.github.com/users/ASGusev/events{/privacy}","received_events_url":"https://api.github.com/users/ASGusev/received_events","type":"User","site_admin":false},"body":"Я недавно узнал про runInInterfaceThread и собираюсь убрать BroadcastReceiver.","created_at":"2016-12-26T10:49:14Z","updated_at":"2016-12-27T21:36:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"61f10384cbd72576758e3a68d742cfeac470c1dd","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/MZuev/Resemblance/pulls/2/commits","review_comments_url":"https://api.github.com/repos/MZuev/Resemblance/pulls/2/comments","review_comment_url":"https://api.github.com/repos/MZuev/Resemblance/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MZuev/Resemblance/issues/2/comments","statuses_url":"https://api.github.com/repos/MZuev/Resemblance/statuses/ea92faa233c3088dd1dbf295a85827ea095417b1","head":{"label":"MZuev:master","ref":"master","sha":"ea92faa233c3088dd1dbf295a85827ea095417b1","user":{"login":"MZuev","id":15003954,"avatar_url":"https://avatars.githubusercontent.com/u/15003954?v=3","gravatar_id":"","url":"https://api.github.com/users/MZuev","html_url":"https://github.com/MZuev","followers_url":"https://api.github.com/users/MZuev/followers","following_url":"https://api.github.com/users/MZuev/following{/other_user}","gists_url":"https://api.github.com/users/MZuev/gists{/gist_id}","starred_url":"https://api.github.com/users/MZuev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MZuev/subscriptions","organizations_url":"https://api.github.com/users/MZuev/orgs","repos_url":"https://api.github.com/users/MZuev/repos","events_url":"https://api.github.com/users/MZuev/events{/privacy}","received_events_url":"https://api.github.com/users/MZuev/received_events","type":"User","site_admin":false},"repo":{"id":69184400,"name":"Resemblance","full_name":"MZuev/Resemblance","owner":{"login":"MZuev","id":15003954,"avatar_url":"https://avatars.githubusercontent.com/u/15003954?v=3","gravatar_id":"","url":"https://api.github.com/users/MZuev","html_url":"https://github.com/MZuev","followers_url":"https://api.github.com/users/MZuev/followers","following_url":"https://api.github.com/users/MZuev/following{/other_user}","gists_url":"https://api.github.com/users/MZuev/gists{/gist_id}","starred_url":"https://api.github.com/users/MZuev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MZuev/subscriptions","organizations_url":"https://api.github.com/users/MZuev/orgs","repos_url":"https://api.github.com/users/MZuev/repos","events_url":"https://api.github.com/users/MZuev/events{/privacy}","received_events_url":"https://api.github.com/users/MZuev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MZuev/Resemblance","description":null,"fork":false,"url":"https://api.github.com/repos/MZuev/Resemblance","forks_url":"https://api.github.com/repos/MZuev/Resemblance/forks","keys_url":"https://api.github.com/repos/MZuev/Resemblance/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MZuev/Resemblance/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MZuev/Resemblance/teams","hooks_url":"https://api.github.com/repos/MZuev/Resemblance/hooks","issue_events_url":"https://api.github.com/repos/MZuev/Resemblance/issues/events{/number}","events_url":"https://api.github.com/repos/MZuev/Resemblance/events","assignees_url":"https://api.github.com/repos/MZuev/Resemblance/assignees{/user}","branches_url":"https://api.github.com/repos/MZuev/Resemblance/branches{/branch}","tags_url":"https://api.github.com/repos/MZuev/Resemblance/tags","blobs_url":"https://api.github.com/repos/MZuev/Resemblance/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MZuev/Resemblance/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MZuev/Resemblance/git/refs{/sha}","trees_url":"https://api.github.com/repos/MZuev/Resemblance/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MZuev/Resemblance/statuses/{sha}","languages_url":"https://api.github.com/repos/MZuev/Resemblance/languages","stargazers_url":"https://api.github.com/repos/MZuev/Resemblance/stargazers","contributors_url":"https://api.github.com/repos/MZuev/Resemblance/contributors","subscribers_url":"https://api.github.com/repos/MZuev/Resemblance/subscribers","subscription_url":"https://api.github.com/repos/MZuev/Resemblance/subscription","commits_url":"https://api.github.com/repos/MZuev/Resemblance/commits{/sha}","git_commits_url":"https://api.github.com/repos/MZuev/Resemblance/git/commits{/sha}","comments_url":"https://api.github.com/repos/MZuev/Resemblance/comments{/number}","issue_comment_url":"https://api.github.com/repos/MZuev/Resemblance/issues/comments{/number}","contents_url":"https://api.github.com/repos/MZuev/Resemblance/contents/{+path}","compare_url":"https://api.github.com/repos/MZuev/Resemblance/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MZuev/Resemblance/merges","archive_url":"https://api.github.com/repos/MZuev/Resemblance/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MZuev/Resemblance/downloads","issues_url":"https://api.github.com/repos/MZuev/Resemblance/issues{/number}","pulls_url":"https://api.github.com/repos/MZuev/Resemblance/pulls{/number}","milestones_url":"https://api.github.com/repos/MZuev/Resemblance/milestones{/number}","notifications_url":"https://api.github.com/repos/MZuev/Resemblance/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MZuev/Resemblance/labels{/name}","releases_url":"https://api.github.com/repos/MZuev/Resemblance/releases{/id}","deployments_url":"https://api.github.com/repos/MZuev/Resemblance/deployments","created_at":"2016-09-25T19:03:44Z","updated_at":"2016-11-19T08:53:42Z","pushed_at":"2016-12-26T10:49:14Z","git_url":"git://github.com/MZuev/Resemblance.git","ssh_url":"git@github.com:MZuev/Resemblance.git","clone_url":"https://github.com/MZuev/Resemblance.git","svn_url":"https://github.com/MZuev/Resemblance","homepage":null,"size":25947,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"MZuev:applied","ref":"applied","sha":"dfc6f19fc666689bfa6b6f8c3d6e7346c177cc32","user":{"login":"MZuev","id":15003954,"avatar_url":"https://avatars.githubusercontent.com/u/15003954?v=3","gravatar_id":"","url":"https://api.github.com/users/MZuev","html_url":"https://github.com/MZuev","followers_url":"https://api.github.com/users/MZuev/followers","following_url":"https://api.github.com/users/MZuev/following{/other_user}","gists_url":"https://api.github.com/users/MZuev/gists{/gist_id}","starred_url":"https://api.github.com/users/MZuev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MZuev/subscriptions","organizations_url":"https://api.github.com/users/MZuev/orgs","repos_url":"https://api.github.com/users/MZuev/repos","events_url":"https://api.github.com/users/MZuev/events{/privacy}","received_events_url":"https://api.github.com/users/MZuev/received_events","type":"User","site_admin":false},"repo":{"id":69184400,"name":"Resemblance","full_name":"MZuev/Resemblance","owner":{"login":"MZuev","id":15003954,"avatar_url":"https://avatars.githubusercontent.com/u/15003954?v=3","gravatar_id":"","url":"https://api.github.com/users/MZuev","html_url":"https://github.com/MZuev","followers_url":"https://api.github.com/users/MZuev/followers","following_url":"https://api.github.com/users/MZuev/following{/other_user}","gists_url":"https://api.github.com/users/MZuev/gists{/gist_id}","starred_url":"https://api.github.com/users/MZuev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MZuev/subscriptions","organizations_url":"https://api.github.com/users/MZuev/orgs","repos_url":"https://api.github.com/users/MZuev/repos","events_url":"https://api.github.com/users/MZuev/events{/privacy}","received_events_url":"https://api.github.com/users/MZuev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MZuev/Resemblance","description":null,"fork":false,"url":"https://api.github.com/repos/MZuev/Resemblance","forks_url":"https://api.github.com/repos/MZuev/Resemblance/forks","keys_url":"https://api.github.com/repos/MZuev/Resemblance/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MZuev/Resemblance/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MZuev/Resemblance/teams","hooks_url":"https://api.github.com/repos/MZuev/Resemblance/hooks","issue_events_url":"https://api.github.com/repos/MZuev/Resemblance/issues/events{/number}","events_url":"https://api.github.com/repos/MZuev/Resemblance/events","assignees_url":"https://api.github.com/repos/MZuev/Resemblance/assignees{/user}","branches_url":"https://api.github.com/repos/MZuev/Resemblance/branches{/branch}","tags_url":"https://api.github.com/repos/MZuev/Resemblance/tags","blobs_url":"https://api.github.com/repos/MZuev/Resemblance/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MZuev/Resemblance/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MZuev/Resemblance/git/refs{/sha}","trees_url":"https://api.github.com/repos/MZuev/Resemblance/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MZuev/Resemblance/statuses/{sha}","languages_url":"https://api.github.com/repos/MZuev/Resemblance/languages","stargazers_url":"https://api.github.com/repos/MZuev/Resemblance/stargazers","contributors_url":"https://api.github.com/repos/MZuev/Resemblance/contributors","subscribers_url":"https://api.github.com/repos/MZuev/Resemblance/subscribers","subscription_url":"https://api.github.com/repos/MZuev/Resemblance/subscription","commits_url":"https://api.github.com/repos/MZuev/Resemblance/commits{/sha}","git_commits_url":"https://api.github.com/repos/MZuev/Resemblance/git/commits{/sha}","comments_url":"https://api.github.com/repos/MZuev/Resemblance/comments{/number}","issue_comment_url":"https://api.github.com/repos/MZuev/Resemblance/issues/comments{/number}","contents_url":"https://api.github.com/repos/MZuev/Resemblance/contents/{+path}","compare_url":"https://api.github.com/repos/MZuev/Resemblance/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MZuev/Resemblance/merges","archive_url":"https://api.github.com/repos/MZuev/Resemblance/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MZuev/Resemblance/downloads","issues_url":"https://api.github.com/repos/MZuev/Resemblance/issues{/number}","pulls_url":"https://api.github.com/repos/MZuev/Resemblance/pulls{/number}","milestones_url":"https://api.github.com/repos/MZuev/Resemblance/milestones{/number}","notifications_url":"https://api.github.com/repos/MZuev/Resemblance/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MZuev/Resemblance/labels{/name}","releases_url":"https://api.github.com/repos/MZuev/Resemblance/releases{/id}","deployments_url":"https://api.github.com/repos/MZuev/Resemblance/deployments","created_at":"2016-09-25T19:03:44Z","updated_at":"2016-11-19T08:53:42Z","pushed_at":"2016-12-26T10:49:14Z","git_url":"git://github.com/MZuev/Resemblance.git","ssh_url":"git@github.com:MZuev/Resemblance.git","clone_url":"https://github.com/MZuev/Resemblance.git","svn_url":"https://github.com/MZuev/Resemblance","homepage":null,"size":25947,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MZuev/Resemblance/pulls/2"},"html":{"href":"https://github.com/MZuev/Resemblance/pull/2"},"issue":{"href":"https://api.github.com/repos/MZuev/Resemblance/issues/2"},"comments":{"href":"https://api.github.com/repos/MZuev/Resemblance/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/MZuev/Resemblance/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/MZuev/Resemblance/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MZuev/Resemblance/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/MZuev/Resemblance/statuses/ea92faa233c3088dd1dbf295a85827ea095417b1"}}}}
{"actor":{"display_login":"sproshev"}}