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); }