Skip to content
Snippets Groups Projects
Commit 744e4dbc authored by Kamran Ahmed Ansari's avatar Kamran Ahmed Ansari
Browse files

Fix data and type being set in the intent to open a file

The files were being downloaded in the downlaods directory, but none of the plain text editors
were able to open files with the intent being made.

Tested on Solid Explorer and Droid Edit
parent 43a81343
No related branches found
No related tags found
1 merge request!22Fix data and type being set in the intent to open a file
Loading
Loading
@@ -282,11 +282,12 @@ class FileActivity : BaseActivity() {
 
val intent = Intent(Intent.ACTION_VIEW)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
intent.data = Uri.fromFile(file)
 
val extension = fileExtension(file.name)
if (extension != null) {
intent.setTypeAndNormalize(MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension))
intent.setDataAndType(Uri.fromFile(file), MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension))
} else {
intent.data = Uri.fromFile(file)
}
 
try {
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment