mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-05 10:15:34 +08:00
Added: Basic MIME type recognition in ContentProvider
This commit is contained in:
committed by
Fredrik Fornwall
parent
6c00f1fc61
commit
245158ceb9
@@ -172,6 +172,13 @@ public class TermuxOpenReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public String getType(@NonNull Uri uri) {
|
||||
String path = uri.getLastPathSegment();
|
||||
int extIndex = path.lastIndexOf('.') + 1;
|
||||
if (extIndex > 0) {
|
||||
MimeTypeMap mimeMap = MimeTypeMap.getSingleton();
|
||||
String ext = path.substring(extIndex).toLowerCase();
|
||||
return mimeMap.getMimeTypeFromExtension(ext);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user