FileSystemObject
packages/apps/CMFileManager/src/com/cyanogenmod/filemanager/ui/widgets/
NavigationView.java
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// Open the file (edit or pick)
if (this.mNavigationMode.compareTo(NAVIGATION_MODE.BROWSABLE) == 0) {
// Open the file with the preferred registered app
IntentsActionPolicy.openFileSystemObject(getContext(), fso, false, null, null);
}
}
IntentsActionPolicy.java
openFileSystemObject(){
intent.setAction(android.content.Intent.ACTION_VIEW);
getUriFromFile();
// Resolve the intent
resolveIntent();//选择启动该文件的应用
}
/**
* Method that returns the best Uri for the file (content uri, file uri, ...)
*
* @param ctx The current context
* @param file The file to resolve
*/
private static Uri getUriFromFile(Context ctx, File file) {
Uri uri = MediaHelper.fileToContentUri(ctx, file);
}
packages/apps/CMFileManager/src/com/cyanogenmod/filemanager/util/
MediaHelper.java
fileToContentUri(){
// Check in external and internal storages
Uri uri = fileToContentUri(context, normalizedPath, EXTERNAL_VOLUME);
}
baseUri=content://media/external/images/media