本文整理匯總了Java中com.hippo.unifile.UniFile.getUri方法的典型用法代碼示例。如果您正苦於以下問題:Java UniFile.getUri方法的具體用法?Java UniFile.getUri怎麽用?Java UniFile.getUri使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.hippo.unifile.UniFile
的用法示例。
在下文中一共展示了UniFile.getUri方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: putImageSaveLocation
import com.hippo.unifile.UniFile; //導入方法依賴的package包/類
public static void putImageSaveLocation(@NonNull UniFile location) {
Uri uri = location.getUri();
putString(KEY_IMAGE_SAVE_SCHEME, uri.getScheme());
putString(KEY_IMAGE_SAVE_AUTHORITY, uri.getEncodedAuthority());
putString(KEY_IMAGE_SAVE_PATH, uri.getEncodedPath());
putString(KEY_IMAGE_SAVE_QUERY, uri.getEncodedQuery());
putString(KEY_IMAGE_SAVE_FRAGMENT, uri.getEncodedFragment());
}
示例2: putDownloadLocation
import com.hippo.unifile.UniFile; //導入方法依賴的package包/類
public static void putDownloadLocation(@NonNull UniFile location) {
Uri uri = location.getUri();
putString(KEY_DOWNLOAD_SAVE_SCHEME, uri.getScheme());
putString(KEY_DOWNLOAD_SAVE_AUTHORITY, uri.getEncodedAuthority());
putString(KEY_DOWNLOAD_SAVE_PATH, uri.getEncodedPath());
putString(KEY_DOWNLOAD_SAVE_QUERY, uri.getEncodedQuery());
putString(KEY_DOWNLOAD_SAVE_FRAGMENT, uri.getEncodedFragment());
if (getMediaScan()) {
CommonOperations.removeNoMediaFile(location);
} else {
CommonOperations.ensureNoMediaFile(location);
}
}
示例3: query
import com.hippo.unifile.UniFile; //導入方法依賴的package包/類
@Nullable
@Override
public Cursor query(@NonNull Uri uri, String[] projection,
String selection, String[] selectionArgs, String sortOrder) {
final UniFile file = getFileForUri(uri);
if (file == null) {
return null;
}
if (projection == null) {
projection = COLUMNS;
}
String[] cols = new String[projection.length];
Object[] values = new Object[projection.length];
int i = 0;
for (String col : projection) {
if (OpenableColumns.DISPLAY_NAME.equals(col)) {
cols[i] = OpenableColumns.DISPLAY_NAME;
values[i++] = file.getName();
} else if (OpenableColumns.SIZE.equals(col)) {
cols[i] = OpenableColumns.SIZE;
values[i++] = file.length();
} else if (MediaStore.MediaColumns.DATA.equals(col)) {
Uri originUri = file.getUri();
if (ContentResolver.SCHEME_FILE.equals(originUri.getScheme())) {
cols[i] = MediaStore.MediaColumns.DATA;
values[i++] = file.getUri().getPath();
} else {
// TODO handle document tree url
}
}
}
cols = copyOf(cols, i);
values = copyOf(values, i);
final MatrixCursor cursor = new MatrixCursor(cols, 1);
cursor.addRow(values);
return cursor;
}