{"action":"created","comment":{"url":"https://api.github.com/repos/silantyevmn/MaterialDesign/pulls/comments/218598384","pull_request_review_id":156572352,"id":218598384,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxODU5ODM4NA==","diff_hunk":"@@ -10,61 +12,66 @@\n import silantyevmn.ru.materialdesign.model.photo.Photo;\n import silantyevmn.ru.materialdesign.model.photo.PhotoModel;\n import silantyevmn.ru.materialdesign.view.DialogView;\n+import silantyevmn.ru.materialdesign.view.activity.GaleryActivity;\n+import silantyevmn.ru.materialdesign.view.activity.IGaleryView;\n import silantyevmn.ru.materialdesign.view.fragment.IPhotoFragment;\n-import silantyevmn.ru.materialdesign.view.fragment.IPhotoFragmentFavorite;\n-import silantyevmn.ru.materialdesign.view.fragment.PhotoFragment;\n import silantyevmn.ru.materialdesign.view.fragment.PhotoFragmentFavorite;\n \n /**\n  * Created by silan on 25.08.2018.\n  */\n \n public class PhotoPresenterFavorite {\n-    private final IPhotoFragmentFavorite view;\n+    private final IPhotoFragment view;\n     private final IModelPhoto model;\n+    private final IGaleryView mainActivity;\n \n     public PhotoPresenterFavorite(PhotoFragmentFavorite photoFragment) {\n         this.view = photoFragment;\n+        this.mainActivity = (GaleryActivity) photoFragment.getActivity();\n         model = PhotoModel.getInstance();\n     }\n+\n     //создание View\n-    public void onViewCreated() {\n-        view.init(getPhotos());\n+    public void init(Context context) {\n+        view.init(getPhotos(), model.getGridLayoutManagerSpan(context.getResources().getConfiguration().orientation));\n     }\n \n     private List<Photo> getPhotos() {\n         return model.getListFavorite();\n     }\n \n-    private void updateAdapter() {\n+    public void updateAdapter() {\n         view.setAdapter(getPhotos());\n     }\n \n-    public void delete(int position) {\n-        if(position==-1){\n-            Uri uri= Uri.parse(DataSharedPreference.getInstance().getUriCamera());\n-            Photo photo = new Photo(uri.getLastPathSegment(),uri.toString());\n+    public void delete(int position, Activity activity) {\n+        if (position == -1) {\n+            Uri uri = Uri.parse(DataSharedPreference.getInstance().getUriCamera());\n+            Photo photo = new Photo(uri.getLastPathSegment(), uri.toString());\n             model.delete(photo);\n             return;\n         }\n-        new DialogView(view.getActivity(), view.getActivity().getString(R.string.dialog_title_delete), () -> {\n+        new DialogView(activity, activity.getString(R.string.dialog_title_delete), () -> {\n             model.delete(getPhotos().get(position));\n             updateAdapter();\n             view.showLog(\"delete\", String.valueOf(position));\n         });\n+\n     }\n \n     public void favorite(int position) {\n-        model.favorites(getPhotos().get(position));\n+        model.favorite(getPhotos().get(position));\n         updateAdapter();\n         view.showLog(\"favourites\", String.valueOf(position));\n     }\n \n     public void onClickPhoto(int adapterPosition) {\n-        view.showFullPhoto(getPhotos().get(adapterPosition));\n+        //запускаем в главной активити\n+        mainActivity.showFullPhoto(getPhotos().get(adapterPosition));","path":"app/src/main/java/silantyevmn/ru/materialdesign/presenter/PhotoPresenterFavorite.java","position":81,"original_position":81,"commit_id":"652da36f868740f8af39772dd87344f6e50c519a","original_commit_id":"652da36f868740f8af39772dd87344f6e50c519a","user":{"login":"grigoryfedorov","id":6428909,"node_id":"MDQ6VXNlcjY0Mjg5MDk=","avatar_url":"https://avatars3.githubusercontent.com/u/6428909?v=4","gravatar_id":"","url":"https://api.github.com/users/grigoryfedorov","html_url":"https://github.com/grigoryfedorov","followers_url":"https://api.github.com/users/grigoryfedorov/followers","following_url":"https://api.github.com/users/grigoryfedorov/following{/other_user}","gists_url":"https://api.github.com/users/grigoryfedorov/gists{/gist_id}","starred_url":"https://api.github.com/users/grigoryfedorov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grigoryfedorov/subscriptions","organizations_url":"https://api.github.com/users/grigoryfedorov/orgs","repos_url":"https://api.github.com/users/grigoryfedorov/repos","events_url":"https://api.github.com/users/grigoryfedorov/events{/privacy}","received_events_url":"https://api.github.com/users/grigoryfedorov/received_events","type":"User","site_admin":false},"body":"тут конечно не очень решение. конечно активити не место в презентере. в простом случае можно оставить как было - передать во view, а там уже как-то передать активити. \r\nв модных реализациях делают навигацию через роутеры-навигаторы. может быть вам про них ещё расскажут","created_at":"2018-09-18T21:17:26Z","updated_at":"2018-09-18T21:17:44Z","html_url":"https://github.com/silantyevmn/MaterialDesign/pull/6#discussion_r218598384","pull_request_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/pulls/6","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/silantyevmn/MaterialDesign/pulls/comments/218598384"},"html":{"href":"https://github.com/silantyevmn/MaterialDesign/pull/6#discussion_r218598384"},"pull_request":{"href":"https://api.github.com/repos/silantyevmn/MaterialDesign/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/silantyevmn/MaterialDesign/pulls/6","id":215050926,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE1MDUwOTI2","html_url":"https://github.com/silantyevmn/MaterialDesign/pull/6","diff_url":"https://github.com/silantyevmn/MaterialDesign/pull/6.diff","patch_url":"https://github.com/silantyevmn/MaterialDesign/pull/6.patch","issue_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/issues/6","number":6,"state":"closed","locked":false,"title":"Lesson8","user":{"login":"silantyevmn","id":30726814,"node_id":"MDQ6VXNlcjMwNzI2ODE0","avatar_url":"https://avatars2.githubusercontent.com/u/30726814?v=4","gravatar_id":"","url":"https://api.github.com/users/silantyevmn","html_url":"https://github.com/silantyevmn","followers_url":"https://api.github.com/users/silantyevmn/followers","following_url":"https://api.github.com/users/silantyevmn/following{/other_user}","gists_url":"https://api.github.com/users/silantyevmn/gists{/gist_id}","starred_url":"https://api.github.com/users/silantyevmn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silantyevmn/subscriptions","organizations_url":"https://api.github.com/users/silantyevmn/orgs","repos_url":"https://api.github.com/users/silantyevmn/repos","events_url":"https://api.github.com/users/silantyevmn/events{/privacy}","received_events_url":"https://api.github.com/users/silantyevmn/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-09-12T18:14:07Z","updated_at":"2018-09-18T21:17:44Z","closed_at":"2018-09-12T18:14:17Z","merged_at":"2018-09-12T18:14:17Z","merge_commit_sha":"16611826ae0a1cd3a741664dfeb32674c80ad790","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/pulls/6/commits","review_comments_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/pulls/6/comments","review_comment_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/pulls/comments{/number}","comments_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/issues/6/comments","statuses_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/statuses/652da36f868740f8af39772dd87344f6e50c519a","head":{"label":"silantyevmn:lesson8","ref":"lesson8","sha":"652da36f868740f8af39772dd87344f6e50c519a","user":{"login":"silantyevmn","id":30726814,"node_id":"MDQ6VXNlcjMwNzI2ODE0","avatar_url":"https://avatars2.githubusercontent.com/u/30726814?v=4","gravatar_id":"","url":"https://api.github.com/users/silantyevmn","html_url":"https://github.com/silantyevmn","followers_url":"https://api.github.com/users/silantyevmn/followers","following_url":"https://api.github.com/users/silantyevmn/following{/other_user}","gists_url":"https://api.github.com/users/silantyevmn/gists{/gist_id}","starred_url":"https://api.github.com/users/silantyevmn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silantyevmn/subscriptions","organizations_url":"https://api.github.com/users/silantyevmn/orgs","repos_url":"https://api.github.com/users/silantyevmn/repos","events_url":"https://api.github.com/users/silantyevmn/events{/privacy}","received_events_url":"https://api.github.com/users/silantyevmn/received_events","type":"User","site_admin":false},"repo":{"id":145338440,"node_id":"MDEwOlJlcG9zaXRvcnkxNDUzMzg0NDA=","name":"MaterialDesign","full_name":"silantyevmn/MaterialDesign","private":false,"owner":{"login":"silantyevmn","id":30726814,"node_id":"MDQ6VXNlcjMwNzI2ODE0","avatar_url":"https://avatars2.githubusercontent.com/u/30726814?v=4","gravatar_id":"","url":"https://api.github.com/users/silantyevmn","html_url":"https://github.com/silantyevmn","followers_url":"https://api.github.com/users/silantyevmn/followers","following_url":"https://api.github.com/users/silantyevmn/following{/other_user}","gists_url":"https://api.github.com/users/silantyevmn/gists{/gist_id}","starred_url":"https://api.github.com/users/silantyevmn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silantyevmn/subscriptions","organizations_url":"https://api.github.com/users/silantyevmn/orgs","repos_url":"https://api.github.com/users/silantyevmn/repos","events_url":"https://api.github.com/users/silantyevmn/events{/privacy}","received_events_url":"https://api.github.com/users/silantyevmn/received_events","type":"User","site_admin":false},"html_url":"https://github.com/silantyevmn/MaterialDesign","description":null,"fork":false,"url":"https://api.github.com/repos/silantyevmn/MaterialDesign","forks_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/forks","keys_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/keys{/key_id}","collaborators_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/teams","hooks_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/hooks","issue_events_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/issues/events{/number}","events_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/events","assignees_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/assignees{/user}","branches_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/branches{/branch}","tags_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/tags","blobs_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/git/refs{/sha}","trees_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/git/trees{/sha}","statuses_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/statuses/{sha}","languages_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/languages","stargazers_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/stargazers","contributors_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/contributors","subscribers_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/subscribers","subscription_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/subscription","commits_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/commits{/sha}","git_commits_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/git/commits{/sha}","comments_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/comments{/number}","issue_comment_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/issues/comments{/number}","contents_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/contents/{+path}","compare_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/compare/{base}...{head}","merges_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/merges","archive_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/downloads","issues_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/issues{/number}","pulls_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/pulls{/number}","milestones_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/milestones{/number}","notifications_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/labels{/name}","releases_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/releases{/id}","deployments_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/deployments","created_at":"2018-08-19T21:22:25Z","updated_at":"2018-09-17T06:49:58Z","pushed_at":"2018-09-17T06:49:57Z","git_url":"git://github.com/silantyevmn/MaterialDesign.git","ssh_url":"git@github.com:silantyevmn/MaterialDesign.git","clone_url":"https://github.com/silantyevmn/MaterialDesign.git","svn_url":"https://github.com/silantyevmn/MaterialDesign","homepage":null,"size":387,"stargazers_count":0,"watchers_count":0,"language":"Java","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":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"silantyevmn:master","ref":"master","sha":"1c663ead409484b0b716a7f4e1f268adfbe6dcd1","user":{"login":"silantyevmn","id":30726814,"node_id":"MDQ6VXNlcjMwNzI2ODE0","avatar_url":"https://avatars2.githubusercontent.com/u/30726814?v=4","gravatar_id":"","url":"https://api.github.com/users/silantyevmn","html_url":"https://github.com/silantyevmn","followers_url":"https://api.github.com/users/silantyevmn/followers","following_url":"https://api.github.com/users/silantyevmn/following{/other_user}","gists_url":"https://api.github.com/users/silantyevmn/gists{/gist_id}","starred_url":"https://api.github.com/users/silantyevmn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silantyevmn/subscriptions","organizations_url":"https://api.github.com/users/silantyevmn/orgs","repos_url":"https://api.github.com/users/silantyevmn/repos","events_url":"https://api.github.com/users/silantyevmn/events{/privacy}","received_events_url":"https://api.github.com/users/silantyevmn/received_events","type":"User","site_admin":false},"repo":{"id":145338440,"node_id":"MDEwOlJlcG9zaXRvcnkxNDUzMzg0NDA=","name":"MaterialDesign","full_name":"silantyevmn/MaterialDesign","private":false,"owner":{"login":"silantyevmn","id":30726814,"node_id":"MDQ6VXNlcjMwNzI2ODE0","avatar_url":"https://avatars2.githubusercontent.com/u/30726814?v=4","gravatar_id":"","url":"https://api.github.com/users/silantyevmn","html_url":"https://github.com/silantyevmn","followers_url":"https://api.github.com/users/silantyevmn/followers","following_url":"https://api.github.com/users/silantyevmn/following{/other_user}","gists_url":"https://api.github.com/users/silantyevmn/gists{/gist_id}","starred_url":"https://api.github.com/users/silantyevmn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silantyevmn/subscriptions","organizations_url":"https://api.github.com/users/silantyevmn/orgs","repos_url":"https://api.github.com/users/silantyevmn/repos","events_url":"https://api.github.com/users/silantyevmn/events{/privacy}","received_events_url":"https://api.github.com/users/silantyevmn/received_events","type":"User","site_admin":false},"html_url":"https://github.com/silantyevmn/MaterialDesign","description":null,"fork":false,"url":"https://api.github.com/repos/silantyevmn/MaterialDesign","forks_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/forks","keys_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/keys{/key_id}","collaborators_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/teams","hooks_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/hooks","issue_events_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/issues/events{/number}","events_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/events","assignees_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/assignees{/user}","branches_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/branches{/branch}","tags_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/tags","blobs_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/git/refs{/sha}","trees_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/git/trees{/sha}","statuses_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/statuses/{sha}","languages_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/languages","stargazers_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/stargazers","contributors_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/contributors","subscribers_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/subscribers","subscription_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/subscription","commits_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/commits{/sha}","git_commits_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/git/commits{/sha}","comments_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/comments{/number}","issue_comment_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/issues/comments{/number}","contents_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/contents/{+path}","compare_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/compare/{base}...{head}","merges_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/merges","archive_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/downloads","issues_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/issues{/number}","pulls_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/pulls{/number}","milestones_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/milestones{/number}","notifications_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/labels{/name}","releases_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/releases{/id}","deployments_url":"https://api.github.com/repos/silantyevmn/MaterialDesign/deployments","created_at":"2018-08-19T21:22:25Z","updated_at":"2018-09-17T06:49:58Z","pushed_at":"2018-09-17T06:49:57Z","git_url":"git://github.com/silantyevmn/MaterialDesign.git","ssh_url":"git@github.com:silantyevmn/MaterialDesign.git","clone_url":"https://github.com/silantyevmn/MaterialDesign.git","svn_url":"https://github.com/silantyevmn/MaterialDesign","homepage":null,"size":387,"stargazers_count":0,"watchers_count":0,"language":"Java","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":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/silantyevmn/MaterialDesign/pulls/6"},"html":{"href":"https://github.com/silantyevmn/MaterialDesign/pull/6"},"issue":{"href":"https://api.github.com/repos/silantyevmn/MaterialDesign/issues/6"},"comments":{"href":"https://api.github.com/repos/silantyevmn/MaterialDesign/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/silantyevmn/MaterialDesign/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/silantyevmn/MaterialDesign/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/silantyevmn/MaterialDesign/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/silantyevmn/MaterialDesign/statuses/652da36f868740f8af39772dd87344f6e50c519a"}},"author_association":"OWNER"}}
{"actor":{"display_login":"grigoryfedorov"}}