File tree Expand file tree Collapse file tree
opencloudApp/src/main/java/eu/opencloud/android/extensions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ import android.net.Uri
3333import android.text.method.LinkMovementMethod
3434import android.util.TypedValue
3535import android.view.inputmethod.InputMethodManager
36+ import android.webkit.MimeTypeMap
3637import android.widget.LinearLayout
3738import android.widget.TextView
3839import android.widget.Toast
@@ -164,8 +165,8 @@ private fun getIntentForSavedMimeType(data: Uri, type: String): Intent {
164165private fun getIntentForGuessedMimeType (storagePath : String , type : String , data : Uri ): Intent ? {
165166 var intentForGuessedMimeType: Intent ? = null
166167 if (storagePath.lastIndexOf(' .' ) >= 0 ) {
167- val guessedMimeType = MimetypeIconUtil .getBestMimeTypeForOpen(type, storagePath)
168- if (guessedMimeType != type) {
168+ val guessedMimeType = MimeTypeMap .getSingleton().getMimeTypeFromExtension( storagePath.substring(storagePath.lastIndexOf( ' . ' ) + 1 ) )
169+ if (guessedMimeType != null && guessedMimeType != type) {
169170 intentForGuessedMimeType = Intent (Intent .ACTION_VIEW )
170171 intentForGuessedMimeType.setDataAndType(data, guessedMimeType)
171172 intentForGuessedMimeType.flags = Intent .FLAG_GRANT_READ_URI_PERMISSION or Intent .FLAG_GRANT_WRITE_URI_PERMISSION
You can’t perform that action at this time.
0 commit comments