Skip to content
Snippets Groups Projects
Commit e2d28c3a authored by John's avatar John
Browse files

Merge branch 'develop' into 'develop'

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

See merge request !22
parents 43a81343 744e4dbc
No related branches found
No related tags found
1 merge request!22Fix data and type being set in the intent to open a file
Pipeline #
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