Merge pull request #5773 from nextcloud/fixEditText

edit downloaded md/text file is working now
This commit is contained in:
Andy Scherzinger 2020-03-30 17:18:57 +02:00 committed by GitHub
commit b130690bd8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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