{"action":"created","comment":{"url":"https://api.github.com/repos/nextcloud/android/pulls/comments/229535168","pull_request_review_id":170058347,"id":229535168,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyOTUzNTE2OA==","diff_hunk":"@@ -0,0 +1,365 @@\n+/*\n+ * Nextcloud Android client application\n+ *\n+ * @author Tobias Kaminsky\n+ * Copyright (C) 2018 Tobias Kaminsky\n+ * Copyright (C) 2018 Nextcloud GmbH.\n+ *\n+ * This program is free software: you can redistribute it and/or modify\n+ * it under the terms of the GNU General Public License as published by\n+ * the Free Software Foundation, either version 3 of the License, or\n+ * (at your option) any later version.\n+ *\n+ * This program is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n+ * GNU General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU General Public License\n+ * along with this program. If not, see <https://www.gnu.org/licenses/>.\n+ */\n+\n+package com.owncloud.android.ui.activity;\n+\n+import android.accounts.Account;\n+import android.annotation.SuppressLint;\n+import android.content.ActivityNotFoundException;\n+import android.content.Intent;\n+import android.graphics.Bitmap;\n+import android.net.Uri;\n+import android.os.AsyncTask;\n+import android.os.Build;\n+import android.os.Bundle;\n+import android.support.annotation.RequiresApi;\n+import android.text.TextUtils;\n+import android.view.View;\n+import android.webkit.JavascriptInterface;\n+import android.webkit.ValueCallback;\n+import android.webkit.WebChromeClient;\n+import android.webkit.WebView;\n+import android.widget.ImageView;\n+import android.widget.ProgressBar;\n+import android.widget.TextView;\n+import android.widget.Toast;\n+\n+import com.owncloud.android.R;\n+import com.owncloud.android.authentication.AccountUtils;\n+import com.owncloud.android.datamodel.OCFile;\n+import com.owncloud.android.datamodel.ThumbnailsCacheManager;\n+import com.owncloud.android.lib.common.operations.RemoteOperationResult;\n+import com.owncloud.android.lib.common.utils.Log_OC;\n+import com.owncloud.android.operations.RichDocumentsCreateAssetOperation;\n+import com.owncloud.android.operations.RichDocumentsUrlOperation;\n+import com.owncloud.android.ui.fragment.OCFileListFragment;\n+import com.owncloud.android.utils.DisplayUtils;\n+import com.owncloud.android.utils.MimeTypeUtil;\n+\n+import java.lang.ref.WeakReference;\n+\n+import butterknife.BindView;\n+import butterknife.ButterKnife;\n+import butterknife.Unbinder;\n+\n+/**\n+ * Opens document for editing via Richdocuments app in a web view\n+ */\n+@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)\n+public class RichDocumentsWebView extends ExternalSiteWebView {\n+\n+    private static final String TAG = RichDocumentsWebView.class.getSimpleName();\n+    private static final int REQUEST_REMOTE_FILE = 100;\n+\n+    public static final int REQUEST_LOCAL_FILE = 101;\n+\n+    public static final int MINIMUM_API = Build.VERSION_CODES.LOLLIPOP;\n+\n+    private Unbinder unbinder;\n+    private OCFile file;\n+\n+    public ValueCallback<Uri[]> uploadMessage;\n+\n+    @BindView(R.id.progressBar2)\n+    ProgressBar progressBar;\n+\n+    @BindView(R.id.thumbnail)\n+    ImageView thumbnail;\n+\n+    @BindView(R.id.filename)\n+    TextView fileName;\n+\n+    @SuppressLint(\"AddJavascriptInterface\") // suppress warning as webview is only used >= Lollipop\n+    @Override\n+    protected void onCreate(Bundle savedInstanceState) {\n+        showToolbar = false;\n+        webViewLayout = R.layout.richdocuments_webview;\n+        super.onCreate(savedInstanceState);\n+\n+        unbinder = ButterKnife.bind(this);\n+\n+        file = getIntent().getParcelableExtra(EXTRA_FILE);\n+\n+        // TODO make file nullable\n+        if (file == null) {\n+            fileName.setText(R.string.create_file_from_template);\n+        } else {\n+            setThumbnail(file, thumbnail);\n+            fileName.setText(file.getFileName());\n+        }\n+\n+        webview.addJavascriptInterface(new RichDocumentsMobileInterface(), \"RichDocumentsMobileInterface\");\n+\n+        webview.setWebChromeClient(new WebChromeClient() {\n+            RichDocumentsWebView activity = RichDocumentsWebView.this;\n+\n+            @Override\n+            public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback,\n+                                             FileChooserParams fileChooserParams) {\n+                if (uploadMessage != null) {\n+                    uploadMessage.onReceiveValue(null);\n+                    uploadMessage = null;","path":"src/main/java/com/owncloud/android/ui/activity/RichDocumentsWebView.java","position":119,"original_position":119,"commit_id":"5b7fea4f0e62c88dbf308d0bf5662fd37b86207a","original_commit_id":"5b7fea4f0e62c88dbf308d0bf5662fd37b86207a","user":{"login":"codacy-bot","id":19940114,"node_id":"MDQ6VXNlcjE5OTQwMTE0","avatar_url":"https://avatars1.githubusercontent.com/u/19940114?v=4","gravatar_id":"","url":"https://api.github.com/users/codacy-bot","html_url":"https://github.com/codacy-bot","followers_url":"https://api.github.com/users/codacy-bot/followers","following_url":"https://api.github.com/users/codacy-bot/following{/other_user}","gists_url":"https://api.github.com/users/codacy-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy-bot/subscriptions","organizations_url":"https://api.github.com/users/codacy-bot/orgs","repos_url":"https://api.github.com/users/codacy-bot/repos","events_url":"https://api.github.com/users/codacy-bot/events{/privacy}","received_events_url":"https://api.github.com/users/codacy-bot/received_events","type":"User","site_admin":false},"body":"![Codacy](https://app.codacy.com/assets/images/favicon.png) Issue found: [Assigning an Object to null is a code smell.  Consider refactoring.](https://app.codacy.com/app/Nextcloud/android/pullRequest?prid=2333916)","created_at":"2018-10-31T00:51:18Z","updated_at":"2018-10-31T00:51:18Z","html_url":"https://github.com/nextcloud/android/pull/3126#discussion_r229535168","pull_request_url":"https://api.github.com/repos/nextcloud/android/pulls/3126","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/nextcloud/android/pulls/comments/229535168"},"html":{"href":"https://github.com/nextcloud/android/pull/3126#discussion_r229535168"},"pull_request":{"href":"https://api.github.com/repos/nextcloud/android/pulls/3126"}}},"pull_request":{"url":"https://api.github.com/repos/nextcloud/android/pulls/3126","id":221710053,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIxNzEwMDUz","html_url":"https://github.com/nextcloud/android/pull/3126","diff_url":"https://github.com/nextcloud/android/pull/3126.diff","patch_url":"https://github.com/nextcloud/android/pull/3126.patch","issue_url":"https://api.github.com/repos/nextcloud/android/issues/3126","number":3126,"state":"open","locked":false,"title":"Add support for richdocuments","user":{"login":"tobiasKaminsky","id":5836855,"node_id":"MDQ6VXNlcjU4MzY4NTU=","avatar_url":"https://avatars3.githubusercontent.com/u/5836855?v=4","gravatar_id":"","url":"https://api.github.com/users/tobiasKaminsky","html_url":"https://github.com/tobiasKaminsky","followers_url":"https://api.github.com/users/tobiasKaminsky/followers","following_url":"https://api.github.com/users/tobiasKaminsky/following{/other_user}","gists_url":"https://api.github.com/users/tobiasKaminsky/gists{/gist_id}","starred_url":"https://api.github.com/users/tobiasKaminsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tobiasKaminsky/subscriptions","organizations_url":"https://api.github.com/users/tobiasKaminsky/orgs","repos_url":"https://api.github.com/users/tobiasKaminsky/repos","events_url":"https://api.github.com/users/tobiasKaminsky/events{/privacy}","received_events_url":"https://api.github.com/users/tobiasKaminsky/received_events","type":"User","site_admin":false},"body":"- open editable documents (text, spreadsheet, presentation) directly in webview \r\n- support sharing within view\r\n- insert local file in document\r\n- insert remote file in document\r\n\r\nTODO\r\n- [ ] @rullzer add brigde call once UI is completely loaded\r\n\r\nSigned-off-by: tobiasKaminsky <tobias@kaminsky.me>","created_at":"2018-10-10T09:03:07Z","updated_at":"2018-10-31T00:51:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"be4cea4caa21f41e50bd4f34b495fb0428b9cd59","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":392413733,"node_id":"MDU6TGFiZWwzOTI0MTM3MzM=","url":"https://api.github.com/repos/nextcloud/android/labels/1.%20developing","name":"1. developing","color":"0052cc","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/nextcloud/android/pulls/3126/commits","review_comments_url":"https://api.github.com/repos/nextcloud/android/pulls/3126/comments","review_comment_url":"https://api.github.com/repos/nextcloud/android/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nextcloud/android/issues/3126/comments","statuses_url":"https://api.github.com/repos/nextcloud/android/statuses/5b7fea4f0e62c88dbf308d0bf5662fd37b86207a","head":{"label":"nextcloud:richDocumentsInWebView","ref":"richDocumentsInWebView","sha":"5b7fea4f0e62c88dbf308d0bf5662fd37b86207a","user":{"login":"nextcloud","id":19211038,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MjExMDM4","avatar_url":"https://avatars1.githubusercontent.com/u/19211038?v=4","gravatar_id":"","url":"https://api.github.com/users/nextcloud","html_url":"https://github.com/nextcloud","followers_url":"https://api.github.com/users/nextcloud/followers","following_url":"https://api.github.com/users/nextcloud/following{/other_user}","gists_url":"https://api.github.com/users/nextcloud/gists{/gist_id}","starred_url":"https://api.github.com/users/nextcloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nextcloud/subscriptions","organizations_url":"https://api.github.com/users/nextcloud/orgs","repos_url":"https://api.github.com/users/nextcloud/repos","events_url":"https://api.github.com/users/nextcloud/events{/privacy}","received_events_url":"https://api.github.com/users/nextcloud/received_events","type":"Organization","site_admin":false},"repo":{"id":60561834,"node_id":"MDEwOlJlcG9zaXRvcnk2MDU2MTgzNA==","name":"android","full_name":"nextcloud/android","private":false,"owner":{"login":"nextcloud","id":19211038,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MjExMDM4","avatar_url":"https://avatars1.githubusercontent.com/u/19211038?v=4","gravatar_id":"","url":"https://api.github.com/users/nextcloud","html_url":"https://github.com/nextcloud","followers_url":"https://api.github.com/users/nextcloud/followers","following_url":"https://api.github.com/users/nextcloud/following{/other_user}","gists_url":"https://api.github.com/users/nextcloud/gists{/gist_id}","starred_url":"https://api.github.com/users/nextcloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nextcloud/subscriptions","organizations_url":"https://api.github.com/users/nextcloud/orgs","repos_url":"https://api.github.com/users/nextcloud/repos","events_url":"https://api.github.com/users/nextcloud/events{/privacy}","received_events_url":"https://api.github.com/users/nextcloud/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/nextcloud/android","description":"📱 Nextcloud Android app","fork":false,"url":"https://api.github.com/repos/nextcloud/android","forks_url":"https://api.github.com/repos/nextcloud/android/forks","keys_url":"https://api.github.com/repos/nextcloud/android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nextcloud/android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nextcloud/android/teams","hooks_url":"https://api.github.com/repos/nextcloud/android/hooks","issue_events_url":"https://api.github.com/repos/nextcloud/android/issues/events{/number}","events_url":"https://api.github.com/repos/nextcloud/android/events","assignees_url":"https://api.github.com/repos/nextcloud/android/assignees{/user}","branches_url":"https://api.github.com/repos/nextcloud/android/branches{/branch}","tags_url":"https://api.github.com/repos/nextcloud/android/tags","blobs_url":"https://api.github.com/repos/nextcloud/android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nextcloud/android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nextcloud/android/git/refs{/sha}","trees_url":"https://api.github.com/repos/nextcloud/android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nextcloud/android/statuses/{sha}","languages_url":"https://api.github.com/repos/nextcloud/android/languages","stargazers_url":"https://api.github.com/repos/nextcloud/android/stargazers","contributors_url":"https://api.github.com/repos/nextcloud/android/contributors","subscribers_url":"https://api.github.com/repos/nextcloud/android/subscribers","subscription_url":"https://api.github.com/repos/nextcloud/android/subscription","commits_url":"https://api.github.com/repos/nextcloud/android/commits{/sha}","git_commits_url":"https://api.github.com/repos/nextcloud/android/git/commits{/sha}","comments_url":"https://api.github.com/repos/nextcloud/android/comments{/number}","issue_comment_url":"https://api.github.com/repos/nextcloud/android/issues/comments{/number}","contents_url":"https://api.github.com/repos/nextcloud/android/contents/{+path}","compare_url":"https://api.github.com/repos/nextcloud/android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nextcloud/android/merges","archive_url":"https://api.github.com/repos/nextcloud/android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nextcloud/android/downloads","issues_url":"https://api.github.com/repos/nextcloud/android/issues{/number}","pulls_url":"https://api.github.com/repos/nextcloud/android/pulls{/number}","milestones_url":"https://api.github.com/repos/nextcloud/android/milestones{/number}","notifications_url":"https://api.github.com/repos/nextcloud/android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nextcloud/android/labels{/name}","releases_url":"https://api.github.com/repos/nextcloud/android/releases{/id}","deployments_url":"https://api.github.com/repos/nextcloud/android/deployments","created_at":"2016-06-06T21:23:36Z","updated_at":"2018-10-30T23:33:14Z","pushed_at":"2018-10-30T23:33:18Z","git_url":"git://github.com/nextcloud/android.git","ssh_url":"git@github.com:nextcloud/android.git","clone_url":"https://github.com/nextcloud/android.git","svn_url":"https://github.com/nextcloud/android","homepage":"https://play.google.com/store/apps/details?id=com.nextcloud.client","size":375723,"stargazers_count":947,"watchers_count":947,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":520,"mirror_url":null,"archived":false,"open_issues_count":689,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":520,"open_issues":689,"watchers":947,"default_branch":"master"}},"base":{"label":"nextcloud:master","ref":"master","sha":"27ea5731bbaa75a9cd1c41a853647048a9269d81","user":{"login":"nextcloud","id":19211038,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MjExMDM4","avatar_url":"https://avatars1.githubusercontent.com/u/19211038?v=4","gravatar_id":"","url":"https://api.github.com/users/nextcloud","html_url":"https://github.com/nextcloud","followers_url":"https://api.github.com/users/nextcloud/followers","following_url":"https://api.github.com/users/nextcloud/following{/other_user}","gists_url":"https://api.github.com/users/nextcloud/gists{/gist_id}","starred_url":"https://api.github.com/users/nextcloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nextcloud/subscriptions","organizations_url":"https://api.github.com/users/nextcloud/orgs","repos_url":"https://api.github.com/users/nextcloud/repos","events_url":"https://api.github.com/users/nextcloud/events{/privacy}","received_events_url":"https://api.github.com/users/nextcloud/received_events","type":"Organization","site_admin":false},"repo":{"id":60561834,"node_id":"MDEwOlJlcG9zaXRvcnk2MDU2MTgzNA==","name":"android","full_name":"nextcloud/android","private":false,"owner":{"login":"nextcloud","id":19211038,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MjExMDM4","avatar_url":"https://avatars1.githubusercontent.com/u/19211038?v=4","gravatar_id":"","url":"https://api.github.com/users/nextcloud","html_url":"https://github.com/nextcloud","followers_url":"https://api.github.com/users/nextcloud/followers","following_url":"https://api.github.com/users/nextcloud/following{/other_user}","gists_url":"https://api.github.com/users/nextcloud/gists{/gist_id}","starred_url":"https://api.github.com/users/nextcloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nextcloud/subscriptions","organizations_url":"https://api.github.com/users/nextcloud/orgs","repos_url":"https://api.github.com/users/nextcloud/repos","events_url":"https://api.github.com/users/nextcloud/events{/privacy}","received_events_url":"https://api.github.com/users/nextcloud/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/nextcloud/android","description":"📱 Nextcloud Android app","fork":false,"url":"https://api.github.com/repos/nextcloud/android","forks_url":"https://api.github.com/repos/nextcloud/android/forks","keys_url":"https://api.github.com/repos/nextcloud/android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nextcloud/android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nextcloud/android/teams","hooks_url":"https://api.github.com/repos/nextcloud/android/hooks","issue_events_url":"https://api.github.com/repos/nextcloud/android/issues/events{/number}","events_url":"https://api.github.com/repos/nextcloud/android/events","assignees_url":"https://api.github.com/repos/nextcloud/android/assignees{/user}","branches_url":"https://api.github.com/repos/nextcloud/android/branches{/branch}","tags_url":"https://api.github.com/repos/nextcloud/android/tags","blobs_url":"https://api.github.com/repos/nextcloud/android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nextcloud/android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nextcloud/android/git/refs{/sha}","trees_url":"https://api.github.com/repos/nextcloud/android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nextcloud/android/statuses/{sha}","languages_url":"https://api.github.com/repos/nextcloud/android/languages","stargazers_url":"https://api.github.com/repos/nextcloud/android/stargazers","contributors_url":"https://api.github.com/repos/nextcloud/android/contributors","subscribers_url":"https://api.github.com/repos/nextcloud/android/subscribers","subscription_url":"https://api.github.com/repos/nextcloud/android/subscription","commits_url":"https://api.github.com/repos/nextcloud/android/commits{/sha}","git_commits_url":"https://api.github.com/repos/nextcloud/android/git/commits{/sha}","comments_url":"https://api.github.com/repos/nextcloud/android/comments{/number}","issue_comment_url":"https://api.github.com/repos/nextcloud/android/issues/comments{/number}","contents_url":"https://api.github.com/repos/nextcloud/android/contents/{+path}","compare_url":"https://api.github.com/repos/nextcloud/android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nextcloud/android/merges","archive_url":"https://api.github.com/repos/nextcloud/android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nextcloud/android/downloads","issues_url":"https://api.github.com/repos/nextcloud/android/issues{/number}","pulls_url":"https://api.github.com/repos/nextcloud/android/pulls{/number}","milestones_url":"https://api.github.com/repos/nextcloud/android/milestones{/number}","notifications_url":"https://api.github.com/repos/nextcloud/android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nextcloud/android/labels{/name}","releases_url":"https://api.github.com/repos/nextcloud/android/releases{/id}","deployments_url":"https://api.github.com/repos/nextcloud/android/deployments","created_at":"2016-06-06T21:23:36Z","updated_at":"2018-10-30T23:33:14Z","pushed_at":"2018-10-30T23:33:18Z","git_url":"git://github.com/nextcloud/android.git","ssh_url":"git@github.com:nextcloud/android.git","clone_url":"https://github.com/nextcloud/android.git","svn_url":"https://github.com/nextcloud/android","homepage":"https://play.google.com/store/apps/details?id=com.nextcloud.client","size":375723,"stargazers_count":947,"watchers_count":947,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":520,"mirror_url":null,"archived":false,"open_issues_count":689,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":520,"open_issues":689,"watchers":947,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nextcloud/android/pulls/3126"},"html":{"href":"https://github.com/nextcloud/android/pull/3126"},"issue":{"href":"https://api.github.com/repos/nextcloud/android/issues/3126"},"comments":{"href":"https://api.github.com/repos/nextcloud/android/issues/3126/comments"},"review_comments":{"href":"https://api.github.com/repos/nextcloud/android/pulls/3126/comments"},"review_comment":{"href":"https://api.github.com/repos/nextcloud/android/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nextcloud/android/pulls/3126/commits"},"statuses":{"href":"https://api.github.com/repos/nextcloud/android/statuses/5b7fea4f0e62c88dbf308d0bf5662fd37b86207a"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"codacy-bot"}}