Java 类android.provider.DocumentsContract.Root 实例源码

项目:xlight_android_native    文件:LocalStorageProvider.java   
@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;
}
项目:Applozic-Android-Chat-Sample    文件:LocalStorageProvider.java   
@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, "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;
}
项目:Applozic-Android-Chat-Sample    文件:LocalStorageProvider.java   
@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, "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;
}
项目:AlchemistAndroidUtil    文件:LocalStorageProvider.java   
@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, "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;
}
项目:droidddle    文件:LocalStorageProvider.java   
@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_shot_project);
    // 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;
}
项目:PSD-Android-App    文件:LocalStorageProvider.java   
@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;
}
项目:Applozic-Android-SDK    文件:LocalStorageProvider.java   
@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, "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;
}
项目:sealnote    文件:LocalStorageProvider.java   
@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;
}
项目:AIRShare    文件:LocalStorageProvider.java   
@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;
}
项目:Secrecy_fDroid_DEPRECIATED    文件:LocalStorageProvider.java   
@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;
}
项目:qiniu-lab-android    文件:LocalStorageProvider.java   
@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;
}
项目:XposedMacroExpand    文件:LocalStorageProvider.java   
@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;
}
项目:AlfrescoStorageAccessFramework    文件:AlfrescoStorageAccessProvider.java   
private void addRootRow(ChildrenCursor result, Account account)
{
    ChildrenCursor.RowBuilder row = result.newRow();
    row.add(Root.COLUMN_ROOT_ID, encodeItem(PREFIX_ACCOUNT, account.name));
    row.add(Root.COLUMN_SUMMARY, account.name);
    row.add(Root.COLUMN_FLAGS, Root.FLAG_SUPPORTS_CREATE | Root.FLAG_SUPPORTS_SEARCH | Root.FLAG_SUPPORTS_RECENTS);
    row.add(Root.COLUMN_DOCUMENT_ID, encodeItem(PREFIX_ACCOUNT, account.name));

    // Type & Logo
    accountType = Integer.parseInt(accountManager.getUserData(account, AccountConstants.ACCOUNT_NAME));
    switch (accountType)
    {
        case AccountConstants.ACCOUNT_CLOUD_VALUE:
            row.add(Root.COLUMN_TITLE, getContext().getString(R.string.account_alfresco_cloud));
            row.add(Root.COLUMN_ICON, R.drawable.ic_cloud);
            break;

        case AccountConstants.ACCOUNT_ONPREMISE_VALUE:
            row.add(Root.COLUMN_TITLE, getContext().getString(R.string.account_alfresco_onpremise));
            row.add(Root.COLUMN_ICON, R.drawable.ic_onpremise);
            break;
        default:
            row.add(Root.COLUMN_ICON, R.drawable.ic_launcher);
            break;
    }
}
项目:droid-stealth    文件:LocalStorageProvider.java   
@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;
}
项目:Effects-Pro    文件:LocalStorageProvider.java   
@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;
}
项目:filechooser    文件:LocalStorageProvider.java   
@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;
}
项目:secrecy    文件:LocalStorageProvider.java   
@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;
}
项目:XHangouts    文件:LocalStorageProvider.java   
@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;
}
项目:XposedCustomError    文件:LocalStorageProvider.java   
@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;
}
项目:Readily    文件:LocalStorageProvider.java   
@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;
}
项目:APDE    文件:LocalStorageProvider.java   
@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;
}
项目:nus-soc-print    文件:LocalStorageProvider.java   
@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;
}
项目:samba-documents-provider    文件:SambaDocumentsProvider.java   
@Override
public Cursor queryRoots(String[] projection) throws FileNotFoundException {
  if(BuildConfig.DEBUG) Log.d(TAG, "Querying roots.");
  projection = (projection == null) ? DEFAULT_ROOT_PROJECTION : projection;

  MatrixCursor cursor = new MatrixCursor(projection);

  for (String uri : mShareManager) {
    if (!mShareManager.isShareMounted(uri)) {
      continue;
    }

    final String name;
    final Uri parsedUri = Uri.parse(uri);
    try(CacheResult result = mCache.get(parsedUri)) {
      final DocumentMetadata metadata;
      if (result.getState() == CacheResult.CACHE_MISS) {
        metadata = DocumentMetadata.createShare(parsedUri);
        mCache.put(metadata);
      } else {
        metadata = result.getItem();
      }

      name = metadata.getDisplayName();

      cursor.addRow(new Object[] {
          toRootId(metadata),
          toDocumentId(parsedUri),
          name,
          Root.FLAG_SUPPORTS_CREATE | Root.FLAG_SUPPORTS_IS_CHILD | Root.FLAG_SUPPORTS_EJECT,
          R.drawable.ic_folder_shared
      });
    }

  }
  return cursor;
}
项目:science-journal    文件:ScienceJournalDocsProvider.java   
@Override
public Cursor queryRoots(String[] projection) throws FileNotFoundException {
    // Use a MatrixCursor to build a cursor
    // with either the requested fields, or the default
    // projection if "projection" is null.
    final MatrixCursor result =
            new MatrixCursor(resolveRootProjection(projection));

    final MatrixCursor.RowBuilder row = result.newRow();
    row.add(Root.COLUMN_ROOT_ID, DEFAULT_ROOT_PROJECTION);

    // TODO: Implement Root.FLAG_SUPPORTS_RECENTS and Root.FLAG_SUPPORTS_SEARCH.
    // This will mean documents will show up in the "recents" category and be searchable.

    // COLUMN_TITLE is the root title (e.g. Gallery, Drive).
    row.add(Root.COLUMN_TITLE, getContext().getString(R.string.app_name));

    // This document id cannot change after it's shared.
    row.add(Root.COLUMN_DOCUMENT_ID, ROOT_DIRECTORY_ID);

    // The child MIME types are used to filter the roots and only present to the
    // user those roots that contain the desired type somewhere in their file hierarchy.
    row.add(Root.COLUMN_MIME_TYPES, "image/*");

    row.add(Root.COLUMN_ICON, R.mipmap.ic_launcher);

    return result;
}
项目:Android-NetPowerctrl    文件:AssetDocumentProvider.java   
private void createRowRoot(MatrixCursor result) {
    // It's possible to have multiple roots (e.g. for multiple accounts in the same app) -
    // just add multiple cursor rows.
    // Construct one row for a root called "MyCloud".
    final MatrixCursor.RowBuilder row = result.newRow();

    row.add(Root.COLUMN_ROOT_ID, ROOT);
    row.add(Root.COLUMN_SUMMARY, getContext().getString(R.string.doc_provider_summary));

    // FLAG_SUPPORTS_CREATE means at least one directory under the root supports creating
    // documents.  FLAG_SUPPORTS_RECENTS means your application's most recently used
    // documents will show up in the "Recents" category.  FLAG_SUPPORTS_SEARCH allows users
    // to search all documents the application shares.
    //row.add(Root.COLUMN_FLAGS, Root.FLAG_SUPPORTS_SEARCH);

    // COLUMN_TITLE is the root title (e.g. what will be displayed to identify your provider).
    row.add(Root.COLUMN_TITLE, getContext().getString(R.string.app_name));

    // This document id must be unique within this provider and consistent across time.  The
    // system picker UI may save it and refer to it later.
    row.add(Root.COLUMN_DOCUMENT_ID, ROOT);

    // The child MIME types are used to filter the roots and only present to the user roots
    // that contain the desired type somewhere in their file hierarchy.
    row.add(Root.COLUMN_MIME_TYPES, "image/*");
    row.add(Root.COLUMN_ICON, R.drawable.netpowerctrl);
}
项目:SecureShareLib    文件:TransferStorageProvider.java   
@Override
public Cursor queryRoots(String[] projection) throws FileNotFoundException {
    final MatrixCursor result = new MatrixCursor(resolveRootProjection(projection));
    final RowBuilder row = result.newRow();
    row.add(Root.COLUMN_ROOT_ID, DOC_ID_ROOT);
    row.add(Root.COLUMN_FLAGS,
            Root.FLAG_LOCAL_ONLY | Root.FLAG_SUPPORTS_RECENTS | Root.FLAG_SUPPORTS_CREATE);
    row.add(Root.COLUMN_ICON, R.mipmap.ic_launcher_download);
    row.add(Root.COLUMN_TITLE, getContext().getString(R.string.root_downloads));
    row.add(Root.COLUMN_DOCUMENT_ID, DOC_ID_ROOT);
    return result;
}