mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
Merge pull request #5775 from nextcloud/fallbackIfNoLocal
if no offline editor is available, use OO/Cool/Text
This commit is contained in:
commit
c6be91a096
1 changed files with 20 additions and 9 deletions
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue