Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix after rebase
  • Loading branch information
AndyScherzinger committed Nov 2, 2016
commit 9579e0626dca0bb44363bd095baaecade905808a
18 changes: 9 additions & 9 deletions src/com/owncloud/android/ui/helpers/FileOperationsHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;
import com.owncloud.android.files.services.FileUploader.FileUploaderBinder;
import com.owncloud.android.lib.common.network.WebdavUtils;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.shares.OCShare;
import com.owncloud.android.lib.resources.shares.ShareType;
Expand Down Expand Up @@ -100,7 +99,6 @@ private String getUrlFromFile(String storagePath, Pattern pattern) {
}
} catch (IOException e) {
Log_OC.d(TAG, e.getMessage());
return null;
} finally {
if (br != null) {
try {
Expand Down Expand Up @@ -145,7 +143,6 @@ private Intent createIntentFromFile(String storagePath) {
public void openFile(OCFile file) {
if (file != null) {
String storagePath = file.getStoragePath();
Uri uri = Uri.parse("file://" + encodedStoragePath);

Intent openFileWithIntent = null;
int lastIndexOfDot = storagePath.lastIndexOf('.');
Expand All @@ -154,7 +151,10 @@ public void openFile(OCFile file) {
String guessedMimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(fileExt);
if (guessedMimeType != null) {
openFileWithIntent = new Intent(Intent.ACTION_VIEW);
openFileWithIntent.setDataAndType(uri, guessedMimeType);
openFileWithIntent.setDataAndType(
file.getExposedFileUri(mFileActivity),
guessedMimeType
);
}
}

Expand All @@ -164,13 +164,13 @@ public void openFile(OCFile file) {

if (openFileWithIntent == null) {
openFileWithIntent = new Intent(Intent.ACTION_VIEW);
openFileWithIntent.setDataAndType(uri, file.getMimetype());
openFileWithIntent.setDataAndType(
file.getExposedFileUri(mFileActivity),
file.getMimetype()
);
}

openFileWithIntent.setFlags(
Intent.FLAG_GRANT_READ_URI_PERMISSION |
Intent.FLAG_GRANT_WRITE_URI_PERMISSION
);
openFileWithIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);

List<ResolveInfo> launchables = mFileActivity.getPackageManager().
queryIntentActivities(openFileWithIntent, PackageManager.GET_INTENT_FILTERS);
Expand Down