{"action":"created","comment":{"url":"https://api.github.com/repos/tuskyapp/Tusky/pulls/comments/221292222","pull_request_review_id":159908605,"id":221292222,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMTI5MjIyMg==","diff_hunk":"@@ -0,0 +1,249 @@\n+/* Copyright 2017 Andrew Dawson\n+ *\n+ * This file is a part of Tusky.\n+ *\n+ * This program is free software; you can redistribute it and/or modify it under the terms of the\n+ * GNU General Public License as published by the Free Software Foundation; either version 3 of the\n+ * License, or (at your option) any later version.\n+ *\n+ * Tusky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even\n+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General\n+ * Public License for more details.\n+ *\n+ * You should have received a copy of the GNU General Public License along with Tusky; if not,\n+ * see <http://www.gnu.org/licenses>. */\n+\n+package com.keylesspalace.tusky\n+\n+import android.animation.Animator\n+import android.animation.AnimatorListenerAdapter\n+import android.content.Context\n+import android.content.Intent\n+import android.content.pm.PackageManager\n+import android.graphics.Bitmap\n+import android.graphics.Color\n+import android.graphics.drawable.Drawable\n+import android.net.Uri\n+import android.os.Build\n+import android.os.Bundle\n+import android.support.v4.content.FileProvider\n+import android.support.v4.view.ViewPager\n+import android.support.v7.widget.Toolbar\n+import android.util.Log\n+import android.view.Menu\n+import android.view.MenuItem\n+import android.view.View\n+import com.keylesspalace.tusky.BuildConfig.APPLICATION_ID\n+\n+import com.keylesspalace.tusky.fragment.ViewMediaFragment\n+import com.keylesspalace.tusky.pager.AvatarImagePagerAdapter\n+import com.keylesspalace.tusky.pager.ImagePagerAdapter\n+import com.keylesspalace.tusky.util.CollectionUtil.map\n+import com.keylesspalace.tusky.util.MediaUtils\n+import com.keylesspalace.tusky.view.ImageViewPager\n+import com.keylesspalace.tusky.viewdata.AttachmentViewData\n+import com.squareup.picasso.Picasso\n+import com.squareup.picasso.Target\n+\n+import java.io.File\n+import java.io.FileNotFoundException\n+import java.io.FileOutputStream\n+import java.io.IOException\n+import java.util.ArrayList\n+\n+class ViewMediaActivity : BaseActivity(), ViewMediaFragment.PhotoActionsListener {\n+    companion object {\n+        private const val EXTRA_ATTACHMENTS = \"attachments\"\n+        private const val EXTRA_ATTACHMENT_INDEX = \"index\"\n+        private const val EXTRA_AVATAR_URL = \"avatar\"\n+        private const val TAG = \"ViewMediaActivity\"\n+\n+        @JvmStatic\n+        fun newIntent(context: Context?, attachments: List<AttachmentViewData>, index: Int): Intent {\n+            val intent = Intent(context, ViewMediaActivity::class.java)\n+            intent.putParcelableArrayListExtra(EXTRA_ATTACHMENTS, ArrayList(attachments))\n+            intent.putExtra(EXTRA_ATTACHMENT_INDEX, index)\n+            return intent\n+        }\n+\n+        fun newAvatarIntent(context: Context, url: String): Intent {\n+            val intent = Intent(context, ViewMediaActivity::class.java)\n+            intent.putExtra(EXTRA_AVATAR_URL, url)\n+            return intent\n+        }\n+    }\n+\n+    private lateinit var viewPager: ImageViewPager\n+    private lateinit var toolbar: Toolbar\n+\n+    private var attachments: ArrayList<AttachmentViewData>? = null\n+\n+    private var toolbarVisible = true\n+    private val toolbarVisibilityListeners = ArrayList<ToolbarVisibilityListener>()\n+\n+    interface ToolbarVisibilityListener {\n+        fun onToolbarVisiblityChanged(isVisible: Boolean)\n+    }\n+\n+    fun addToolbarVisibilityListener(listener: ToolbarVisibilityListener): Function0<Boolean> {\n+        this.toolbarVisibilityListeners.add(listener)\n+        listener.onToolbarVisiblityChanged(toolbarVisible)\n+        return { toolbarVisibilityListeners.remove(listener) }\n+    }\n+\n+    fun isToolbarVisible(): Boolean {\n+        return toolbarVisible\n+    }\n+\n+    override fun onCreate(savedInstanceState: Bundle?) {\n+        super.onCreate(savedInstanceState)\n+        setContentView(R.layout.activity_view_media)\n+\n+        supportPostponeEnterTransition()\n+\n+        // Obtain the views.\n+        toolbar = findViewById(R.id.toolbar)\n+        viewPager = findViewById(R.id.view_pager)\n+\n+        // Gather the parameters.\n+        val intent = this.intent","path":"app/src/main/java/com/keylesspalace/tusky/ViewMediaActivity.kt","position":109,"original_position":109,"commit_id":"c6bc7cec75bf5f456e4af783a2cc6adc3d8f2dab","original_commit_id":"c6bc7cec75bf5f456e4af783a2cc6adc3d8f2dab","user":{"login":"connyduck","id":10157047,"node_id":"MDQ6VXNlcjEwMTU3MDQ3","avatar_url":"https://avatars1.githubusercontent.com/u/10157047?v=4","gravatar_id":"","url":"https://api.github.com/users/connyduck","html_url":"https://github.com/connyduck","followers_url":"https://api.github.com/users/connyduck/followers","following_url":"https://api.github.com/users/connyduck/following{/other_user}","gists_url":"https://api.github.com/users/connyduck/gists{/gist_id}","starred_url":"https://api.github.com/users/connyduck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/connyduck/subscriptions","organizations_url":"https://api.github.com/users/connyduck/orgs","repos_url":"https://api.github.com/users/connyduck/repos","events_url":"https://api.github.com/users/connyduck/events{/privacy}","received_events_url":"https://api.github.com/users/connyduck/received_events","type":"User","site_admin":false},"body":"this should not be necessary, just use intent directly","created_at":"2018-09-28T15:26:15Z","updated_at":"2018-09-28T15:39:10Z","html_url":"https://github.com/tuskyapp/Tusky/pull/852#discussion_r221292222","pull_request_url":"https://api.github.com/repos/tuskyapp/Tusky/pulls/852","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/tuskyapp/Tusky/pulls/comments/221292222"},"html":{"href":"https://github.com/tuskyapp/Tusky/pull/852#discussion_r221292222"},"pull_request":{"href":"https://api.github.com/repos/tuskyapp/Tusky/pulls/852"}}},"pull_request":{"url":"https://api.github.com/repos/tuskyapp/Tusky/pulls/852","id":215911811,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE1OTExODEx","html_url":"https://github.com/tuskyapp/Tusky/pull/852","diff_url":"https://github.com/tuskyapp/Tusky/pull/852.diff","patch_url":"https://github.com/tuskyapp/Tusky/pull/852.patch","issue_url":"https://api.github.com/repos/tuskyapp/Tusky/issues/852","number":852,"state":"open","locked":false,"title":"Enable sharing media directly from Tusky","user":{"login":"Tak","id":142250,"node_id":"MDQ6VXNlcjE0MjI1MA==","avatar_url":"https://avatars2.githubusercontent.com/u/142250?v=4","gravatar_id":"","url":"https://api.github.com/users/Tak","html_url":"https://github.com/Tak","followers_url":"https://api.github.com/users/Tak/followers","following_url":"https://api.github.com/users/Tak/following{/other_user}","gists_url":"https://api.github.com/users/Tak/gists{/gist_id}","starred_url":"https://api.github.com/users/Tak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tak/subscriptions","organizations_url":"https://api.github.com/users/Tak/orgs","repos_url":"https://api.github.com/users/Tak/repos","events_url":"https://api.github.com/users/Tak/events{/privacy}","received_events_url":"https://api.github.com/users/Tak/received_events","type":"User","site_admin":false},"body":"Enables sharing images and videos/gifs directly from Tusky to other android applications that register for the appropriate mime types. Includes migration of relevant classes to kotlin.\r\n\r\nResolves #822 and #799 ","created_at":"2018-09-17T08:57:35Z","updated_at":"2018-09-28T15:39:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f461ef430d1b1bc4f35847aec924104e1907dbe7","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/tuskyapp/Tusky/pulls/852/commits","review_comments_url":"https://api.github.com/repos/tuskyapp/Tusky/pulls/852/comments","review_comment_url":"https://api.github.com/repos/tuskyapp/Tusky/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tuskyapp/Tusky/issues/852/comments","statuses_url":"https://api.github.com/repos/tuskyapp/Tusky/statuses/c6bc7cec75bf5f456e4af783a2cc6adc3d8f2dab","head":{"label":"Tak:share-media","ref":"share-media","sha":"c6bc7cec75bf5f456e4af783a2cc6adc3d8f2dab","user":{"login":"Tak","id":142250,"node_id":"MDQ6VXNlcjE0MjI1MA==","avatar_url":"https://avatars2.githubusercontent.com/u/142250?v=4","gravatar_id":"","url":"https://api.github.com/users/Tak","html_url":"https://github.com/Tak","followers_url":"https://api.github.com/users/Tak/followers","following_url":"https://api.github.com/users/Tak/following{/other_user}","gists_url":"https://api.github.com/users/Tak/gists{/gist_id}","starred_url":"https://api.github.com/users/Tak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tak/subscriptions","organizations_url":"https://api.github.com/users/Tak/orgs","repos_url":"https://api.github.com/users/Tak/repos","events_url":"https://api.github.com/users/Tak/events{/privacy}","received_events_url":"https://api.github.com/users/Tak/received_events","type":"User","site_admin":false},"repo":{"id":124057983,"node_id":"MDEwOlJlcG9zaXRvcnkxMjQwNTc5ODM=","name":"Tusky","full_name":"Tak/Tusky","private":false,"owner":{"login":"Tak","id":142250,"node_id":"MDQ6VXNlcjE0MjI1MA==","avatar_url":"https://avatars2.githubusercontent.com/u/142250?v=4","gravatar_id":"","url":"https://api.github.com/users/Tak","html_url":"https://github.com/Tak","followers_url":"https://api.github.com/users/Tak/followers","following_url":"https://api.github.com/users/Tak/following{/other_user}","gists_url":"https://api.github.com/users/Tak/gists{/gist_id}","starred_url":"https://api.github.com/users/Tak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tak/subscriptions","organizations_url":"https://api.github.com/users/Tak/orgs","repos_url":"https://api.github.com/users/Tak/repos","events_url":"https://api.github.com/users/Tak/events{/privacy}","received_events_url":"https://api.github.com/users/Tak/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Tak/Tusky","description":"an android client for the microblogging server Mastodon","fork":true,"url":"https://api.github.com/repos/Tak/Tusky","forks_url":"https://api.github.com/repos/Tak/Tusky/forks","keys_url":"https://api.github.com/repos/Tak/Tusky/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Tak/Tusky/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Tak/Tusky/teams","hooks_url":"https://api.github.com/repos/Tak/Tusky/hooks","issue_events_url":"https://api.github.com/repos/Tak/Tusky/issues/events{/number}","events_url":"https://api.github.com/repos/Tak/Tusky/events","assignees_url":"https://api.github.com/repos/Tak/Tusky/assignees{/user}","branches_url":"https://api.github.com/repos/Tak/Tusky/branches{/branch}","tags_url":"https://api.github.com/repos/Tak/Tusky/tags","blobs_url":"https://api.github.com/repos/Tak/Tusky/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Tak/Tusky/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Tak/Tusky/git/refs{/sha}","trees_url":"https://api.github.com/repos/Tak/Tusky/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Tak/Tusky/statuses/{sha}","languages_url":"https://api.github.com/repos/Tak/Tusky/languages","stargazers_url":"https://api.github.com/repos/Tak/Tusky/stargazers","contributors_url":"https://api.github.com/repos/Tak/Tusky/contributors","subscribers_url":"https://api.github.com/repos/Tak/Tusky/subscribers","subscription_url":"https://api.github.com/repos/Tak/Tusky/subscription","commits_url":"https://api.github.com/repos/Tak/Tusky/commits{/sha}","git_commits_url":"https://api.github.com/repos/Tak/Tusky/git/commits{/sha}","comments_url":"https://api.github.com/repos/Tak/Tusky/comments{/number}","issue_comment_url":"https://api.github.com/repos/Tak/Tusky/issues/comments{/number}","contents_url":"https://api.github.com/repos/Tak/Tusky/contents/{+path}","compare_url":"https://api.github.com/repos/Tak/Tusky/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Tak/Tusky/merges","archive_url":"https://api.github.com/repos/Tak/Tusky/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Tak/Tusky/downloads","issues_url":"https://api.github.com/repos/Tak/Tusky/issues{/number}","pulls_url":"https://api.github.com/repos/Tak/Tusky/pulls{/number}","milestones_url":"https://api.github.com/repos/Tak/Tusky/milestones{/number}","notifications_url":"https://api.github.com/repos/Tak/Tusky/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Tak/Tusky/labels{/name}","releases_url":"https://api.github.com/repos/Tak/Tusky/releases{/id}","deployments_url":"https://api.github.com/repos/Tak/Tusky/deployments","created_at":"2018-03-06T09:57:08Z","updated_at":"2018-04-30T09:49:43Z","pushed_at":"2018-09-19T09:11:20Z","git_url":"git://github.com/Tak/Tusky.git","ssh_url":"git@github.com:Tak/Tusky.git","clone_url":"https://github.com/Tak/Tusky.git","svn_url":"https://github.com/Tak/Tusky","homepage":"https://tuskyapp.github.io","size":12626,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"tuskyapp:master","ref":"master","sha":"bfea5119d5d95d0b47031f56789e2137a8857751","user":{"login":"tuskyapp","id":36388208,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2Mzg4MjA4","avatar_url":"https://avatars1.githubusercontent.com/u/36388208?v=4","gravatar_id":"","url":"https://api.github.com/users/tuskyapp","html_url":"https://github.com/tuskyapp","followers_url":"https://api.github.com/users/tuskyapp/followers","following_url":"https://api.github.com/users/tuskyapp/following{/other_user}","gists_url":"https://api.github.com/users/tuskyapp/gists{/gist_id}","starred_url":"https://api.github.com/users/tuskyapp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tuskyapp/subscriptions","organizations_url":"https://api.github.com/users/tuskyapp/orgs","repos_url":"https://api.github.com/users/tuskyapp/repos","events_url":"https://api.github.com/users/tuskyapp/events{/privacy}","received_events_url":"https://api.github.com/users/tuskyapp/received_events","type":"Organization","site_admin":false},"repo":{"id":77868163,"node_id":"MDEwOlJlcG9zaXRvcnk3Nzg2ODE2Mw==","name":"Tusky","full_name":"tuskyapp/Tusky","private":false,"owner":{"login":"tuskyapp","id":36388208,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2Mzg4MjA4","avatar_url":"https://avatars1.githubusercontent.com/u/36388208?v=4","gravatar_id":"","url":"https://api.github.com/users/tuskyapp","html_url":"https://github.com/tuskyapp","followers_url":"https://api.github.com/users/tuskyapp/followers","following_url":"https://api.github.com/users/tuskyapp/following{/other_user}","gists_url":"https://api.github.com/users/tuskyapp/gists{/gist_id}","starred_url":"https://api.github.com/users/tuskyapp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tuskyapp/subscriptions","organizations_url":"https://api.github.com/users/tuskyapp/orgs","repos_url":"https://api.github.com/users/tuskyapp/repos","events_url":"https://api.github.com/users/tuskyapp/events{/privacy}","received_events_url":"https://api.github.com/users/tuskyapp/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/tuskyapp/Tusky","description":"An Android client for the microblogging server Mastodon","fork":false,"url":"https://api.github.com/repos/tuskyapp/Tusky","forks_url":"https://api.github.com/repos/tuskyapp/Tusky/forks","keys_url":"https://api.github.com/repos/tuskyapp/Tusky/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tuskyapp/Tusky/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tuskyapp/Tusky/teams","hooks_url":"https://api.github.com/repos/tuskyapp/Tusky/hooks","issue_events_url":"https://api.github.com/repos/tuskyapp/Tusky/issues/events{/number}","events_url":"https://api.github.com/repos/tuskyapp/Tusky/events","assignees_url":"https://api.github.com/repos/tuskyapp/Tusky/assignees{/user}","branches_url":"https://api.github.com/repos/tuskyapp/Tusky/branches{/branch}","tags_url":"https://api.github.com/repos/tuskyapp/Tusky/tags","blobs_url":"https://api.github.com/repos/tuskyapp/Tusky/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tuskyapp/Tusky/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tuskyapp/Tusky/git/refs{/sha}","trees_url":"https://api.github.com/repos/tuskyapp/Tusky/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tuskyapp/Tusky/statuses/{sha}","languages_url":"https://api.github.com/repos/tuskyapp/Tusky/languages","stargazers_url":"https://api.github.com/repos/tuskyapp/Tusky/stargazers","contributors_url":"https://api.github.com/repos/tuskyapp/Tusky/contributors","subscribers_url":"https://api.github.com/repos/tuskyapp/Tusky/subscribers","subscription_url":"https://api.github.com/repos/tuskyapp/Tusky/subscription","commits_url":"https://api.github.com/repos/tuskyapp/Tusky/commits{/sha}","git_commits_url":"https://api.github.com/repos/tuskyapp/Tusky/git/commits{/sha}","comments_url":"https://api.github.com/repos/tuskyapp/Tusky/comments{/number}","issue_comment_url":"https://api.github.com/repos/tuskyapp/Tusky/issues/comments{/number}","contents_url":"https://api.github.com/repos/tuskyapp/Tusky/contents/{+path}","compare_url":"https://api.github.com/repos/tuskyapp/Tusky/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tuskyapp/Tusky/merges","archive_url":"https://api.github.com/repos/tuskyapp/Tusky/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tuskyapp/Tusky/downloads","issues_url":"https://api.github.com/repos/tuskyapp/Tusky/issues{/number}","pulls_url":"https://api.github.com/repos/tuskyapp/Tusky/pulls{/number}","milestones_url":"https://api.github.com/repos/tuskyapp/Tusky/milestones{/number}","notifications_url":"https://api.github.com/repos/tuskyapp/Tusky/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tuskyapp/Tusky/labels{/name}","releases_url":"https://api.github.com/repos/tuskyapp/Tusky/releases{/id}","deployments_url":"https://api.github.com/repos/tuskyapp/Tusky/deployments","created_at":"2017-01-02T23:20:55Z","updated_at":"2018-09-28T15:15:04Z","pushed_at":"2018-09-28T15:15:02Z","git_url":"git://github.com/tuskyapp/Tusky.git","ssh_url":"git@github.com:tuskyapp/Tusky.git","clone_url":"https://github.com/tuskyapp/Tusky.git","svn_url":"https://github.com/tuskyapp/Tusky","homepage":"https://tuskyapp.github.io","size":12627,"stargazers_count":503,"watchers_count":503,"language":"Java","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":121,"mirror_url":null,"archived":false,"open_issues_count":126,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":121,"open_issues":126,"watchers":503,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tuskyapp/Tusky/pulls/852"},"html":{"href":"https://github.com/tuskyapp/Tusky/pull/852"},"issue":{"href":"https://api.github.com/repos/tuskyapp/Tusky/issues/852"},"comments":{"href":"https://api.github.com/repos/tuskyapp/Tusky/issues/852/comments"},"review_comments":{"href":"https://api.github.com/repos/tuskyapp/Tusky/pulls/852/comments"},"review_comment":{"href":"https://api.github.com/repos/tuskyapp/Tusky/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tuskyapp/Tusky/pulls/852/commits"},"statuses":{"href":"https://api.github.com/repos/tuskyapp/Tusky/statuses/c6bc7cec75bf5f456e4af783a2cc6adc3d8f2dab"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"connyduck"}}