Merge pull request #5775 from nextcloud/fallbackIfNoLocal

if no offline editor is available, use OO/Cool/Text
This commit is contained in:
Andy Scherzinger 2020-03-30 20:06:30 +02:00 committed by GitHub
commit c6be91a096
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -49,10 +49,12 @@ import com.evernote.android.job.JobRequest;
import com.nextcloud.client.account.CurrentAccountProvider;
import com.nextcloud.client.account.User;
import com.nextcloud.client.network.ConnectivityService;
import com.nextcloud.java.util.Optional;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.files.FileMenuFilter;
import com.owncloud.android.files.StreamMediaFileOperation;
import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;
import com.owncloud.android.files.services.FileUploader.FileUploaderBinder;
@ -278,6 +280,14 @@ public class FileOperationsHelper {
queryIntentActivities(openFileWithIntent, PackageManager.GET_RESOLVED_FILTER);
if (launchables.isEmpty()) {
Optional<User> optionalUser = fileActivity.getUser();
if (optionalUser.isPresent() && FileMenuFilter.isEditorAvailable(fileActivity.getContentResolver(),
optionalUser.get(),
file.getMimeType()) &&
android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
openFileWithTextEditor(file, fileActivity);
} else {
Account account = fileActivity.getAccount();
OCCapability capability = fileActivity.getStorageManager().getCapability(account.name);
if (capability.getRichDocumentsMimeTypeList().contains(file.getMimeType()) &&
@ -290,6 +300,7 @@ public class FileOperationsHelper {
return;
}
}
}
fileActivity.showLoadingDialog(fileActivity.getResources().getString(R.string.sync_in_progress));
new Thread(new Runnable() {