From 12a6cdfcea860d0c859dc170516b4b5307d40b84 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Mon, 30 Mar 2020 14:13:09 +0200 Subject: [PATCH] edit downloaded md/text file is working now Signed-off-by: tobiasKaminsky --- .../android/ui/preview/PreviewTextFileFragment.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/com/owncloud/android/ui/preview/PreviewTextFileFragment.java b/src/main/java/com/owncloud/android/ui/preview/PreviewTextFileFragment.java index cb899fb76b..dd2b2bfb4a 100644 --- a/src/main/java/com/owncloud/android/ui/preview/PreviewTextFileFragment.java +++ b/src/main/java/com/owncloud/android/ui/preview/PreviewTextFileFragment.java @@ -24,6 +24,7 @@ package com.owncloud.android.ui.preview; import android.accounts.Account; import android.os.AsyncTask; +import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.view.Menu; @@ -292,6 +293,10 @@ public class PreviewTextFileFragment extends PreviewTextFragment { ); } + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { + FileMenuFilter.hideMenuItem(menu.findItem(R.id.action_edit)); + } + if (getFile().isSharedWithMe() && !getFile().canReshare()) { FileMenuFilter.hideMenuItem(menu.findItem(R.id.action_send_share_file)); } @@ -329,6 +334,13 @@ public class PreviewTextFileFragment extends PreviewTextFragment { return true; } + case R.id.action_edit: + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + containerActivity.getFileOperationsHelper().openFileWithTextEditor(getFile(), getContext()); + return true; + } + return false; + default: return super.onOptionsItemSelected(item); }