本文整理汇总了Java中com.ipaulpro.afilechooser.R类的典型用法代码示例。如果您正苦于以下问题:Java R类的具体用法?Java R怎么用?Java R使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
R类属于com.ipaulpro.afilechooser包,在下文中一共展示了R类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: queryRoots
import com.ipaulpro.afilechooser.R; //导入依赖的package包/类
@Override
public Cursor queryRoots(final String[] projection) throws FileNotFoundException {
// Create a cursor with either the requested fields, or the default
// projection if "projection" is null.
final MatrixCursor result = new MatrixCursor(projection != null ? projection
: DEFAULT_ROOT_PROJECTION);
// Add Home directory
File homeDir = Environment.getExternalStorageDirectory();
final MatrixCursor.RowBuilder row = result.newRow();
// These columns are required
row.add(Root.COLUMN_ROOT_ID, homeDir.getAbsolutePath());
row.add(Root.COLUMN_DOCUMENT_ID, homeDir.getAbsolutePath());
row.add(Root.COLUMN_TITLE, getContext().getString(R.string.internal_storage));
row.add(Root.COLUMN_FLAGS, Root.FLAG_LOCAL_ONLY | Root.FLAG_SUPPORTS_CREATE);
row.add(Root.COLUMN_ICON, R.drawable.ic_provider);
// These columns are optional
row.add(Root.COLUMN_AVAILABLE_BYTES, homeDir.getFreeSpace());
// Root.COLUMN_MIME_TYPE is another optional column and useful if you
// have multiple roots with different
// types of mime types (roots that don't match the requested mime type
// are automatically hidden)
return result;
}
示例2: queryRoots
import com.ipaulpro.afilechooser.R; //导入依赖的package包/类
@Override
public Cursor queryRoots(final String[] projection) throws FileNotFoundException {
// Create a cursor with either the requested fields, or the default
// projection if "projection" is null.
final MatrixCursor result = new MatrixCursor(projection != null ? projection
: DEFAULT_ROOT_PROJECTION);
// Add Home directory
File homeDir = Environment.getExternalStorageDirectory();
final MatrixCursor.RowBuilder row = result.newRow();
// These columns are required
row.add(Root.COLUMN_ROOT_ID, homeDir.getParent());
row.add(Root.COLUMN_DOCUMENT_ID, homeDir.getParent());
row.add(Root.COLUMN_TITLE, getContext().getString(R.string.all_storage));
row.add(Root.COLUMN_FLAGS, Root.FLAG_LOCAL_ONLY | Root.FLAG_SUPPORTS_CREATE);
row.add(Root.COLUMN_ICON, R.drawable.ic_provider);
// These columns are optional
row.add(Root.COLUMN_AVAILABLE_BYTES, homeDir.getFreeSpace());
// Root.COLUMN_MIME_TYPE is another optional column and useful if you
// have multiple roots with different
// types of mime types (ro`ots that don't match the requested mime type
// are automatically hidden)
return result;
}
示例3: getMimeTypes
import com.ipaulpro.afilechooser.R; //导入依赖的package包/类
/**
* Load MIME types from XML
*
* @param context
* @return
*/
private static MimeTypes getMimeTypes(Context context) {
MimeTypes mimeTypes = null;
final MimeTypeParser mtp = new MimeTypeParser();
final XmlResourceParser in = context.getResources().getXml(R.xml.mimetypes);
try {
mimeTypes = mtp.fromXmlResource(in);
} catch (Exception e) {
if(DEBUG) Log.e(TAG, "getMimeTypes", e);
}
return mimeTypes;
}