当前位置: 首页>>代码示例>>Java>>正文


Java MatrixCursor.newRow方法代码示例

本文整理汇总了Java中android.database.MatrixCursor.newRow方法的典型用法代码示例。如果您正苦于以下问题:Java MatrixCursor.newRow方法的具体用法?Java MatrixCursor.newRow怎么用?Java MatrixCursor.newRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.database.MatrixCursor的用法示例。


在下文中一共展示了MatrixCursor.newRow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCheckConnectionCursor

import android.database.MatrixCursor; //导入方法依赖的package包/类
private MatrixCursor getCheckConnectionCursor(Uri uri) {
    try
    {
        checkConnection(uri);
        Log.d("KP2A_FC_P", "checking connection for " + uri + " ok.");
        return null;
    }
    catch (Exception e)
    {
        Log.d("KP2A_FC_P","Check connection failed with: " + e.toString());

        MatrixCursor matrixCursor = new MatrixCursor(BaseFileProviderUtils.CONNECTION_CHECK_CURSOR_COLUMNS);
        RowBuilder newRow = matrixCursor.newRow();
        String message = e.getLocalizedMessage();
        if (message == null)
            message = e.getMessage();
        if (message == null)
            message = e.toString();
        newRow.add(message);
        return matrixCursor;
    }
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:23,代码来源:Kp2aFileProvider.java

示例2: addFileInfo

import android.database.MatrixCursor; //导入方法依赖的package包/类
private RowBuilder addFileInfo(MatrixCursor matrixCursor, int id,
		FileEntry f) {
	int type = !f.isDirectory ? BaseFile.FILE_TYPE_FILE : BaseFile.FILE_TYPE_DIRECTORY;
	RowBuilder newRow = matrixCursor.newRow();
	newRow.add(id);// _ID
	newRow.add(BaseFile
	        .genContentIdUriBase(
	                getAuthority())
	        .buildUpon().appendPath(f.path)
	        .build().toString());
	newRow.add(f.path);
	if (f.displayName == null)
		Log.w("KP2AJ", "displayName is null for " + f.path);
	newRow.add(f.displayName);
	newRow.add(f.canRead ? 1 : 0);
	newRow.add(f.canWrite ? 1 : 0);
	newRow.add(f.sizeInBytes);
	newRow.add(type);
	if (f.lastModifiedTime > 0)
		newRow.add(f.lastModifiedTime);
	else 
		newRow.add(null);
	newRow.add(FileUtils.getResIcon(type, f.displayName));
	return newRow;
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:26,代码来源:Kp2aFileProvider.java

示例3: addDeletedFileInfo

import android.database.MatrixCursor; //导入方法依赖的package包/类
private void addDeletedFileInfo(MatrixCursor matrixCursor, String filename) {
   	int type = BaseFile.FILE_TYPE_NOT_EXISTED;
   	RowBuilder newRow = matrixCursor.newRow();
	newRow.add(0);// _ID
	newRow.add(BaseFile
	        .genContentIdUriBase(
	                getAuthority())
	        .buildUpon().appendPath(filename)
	        .build().toString());
	newRow.add(filename);
	newRow.add(filename);
	newRow.add(0);
	newRow.add(0);
	newRow.add(0);
	newRow.add(type);
	newRow.add(null);
	newRow.add(FileUtils.getResIcon(type, filename));
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:19,代码来源:Kp2aFileProvider.java

示例4: createMatrixCursor

import android.database.MatrixCursor; //导入方法依赖的package包/类
private MatrixCursor createMatrixCursor(Cursor cursor, int cursorOrigin) {
    MatrixCursor matrixCursor = new MatrixCursor(suggestionsColumnNames, cursor.getCount());
    MatrixCursor.RowBuilder builder;
    if (cursor.moveToFirst()) {
        do {
            builder = matrixCursor.newRow();
            if (cursorOrigin == RECENT_SEARCH_ORIGIN) {

                builder.add(FindQuickSearchAdapter.HISTORY_ROW);
                builder.add(cursor.getString(cursor.getColumnIndex(SearchManager.SUGGEST_COLUMN_QUERY)));

            } else {

                builder.add(FindQuickSearchAdapter.DATABASE_ROW);
                builder.add(cursor.getString(cursor.getColumnIndex(DbContract.FarmaciasEntity.NAME)));
            }
        } while (cursor.moveToNext());
    }
    cursor.close();
    return matrixCursor;
}
 
开发者ID:cahergil,项目名称:Farmacias,代码行数:22,代码来源:DbProvider.java

示例5: transformListInToCursor

import android.database.MatrixCursor; //导入方法依赖的package包/类
public MatrixCursor transformListInToCursor(List<Pharmacy> pharmacyList) {
    if (pharmacyList == null) return null;
    String[] columnNames = {DbContract.FarmaciasEntity._ID,
            DbContract.FarmaciasEntity.NAME,
            DbContract.FarmaciasEntity.ADDRESS,
            DbContract.FarmaciasEntity.LOCALITY,
            DbContract.FarmaciasEntity.PROVINCE
    };
    MatrixCursor cursor = new MatrixCursor(columnNames, pharmacyList.size());
    MatrixCursor.RowBuilder builder;
    for (Pharmacy ph : pharmacyList) {
        builder = cursor.newRow();
        builder.add(ph.get_id());
        builder.add(ph.getName());
        builder.add(ph.getAddress());
        builder.add(ph.getLocality());
        builder.add(ph.getProvince());
    }
    return cursor;
}
 
开发者ID:cahergil,项目名称:Farmacias,代码行数:21,代码来源:FindFragment.java

示例6: mergeDates

import android.database.MatrixCursor; //导入方法依赖的package包/类
private MergeCursor mergeDates(long nextId, Map<Long, MatrixCursor> agenda) {
    List<Cursor> allCursors = new ArrayList<>();

    for (long dateMilli: agenda.keySet()) {
        DateTime date = new DateTime(dateMilli);
        MatrixCursor dateCursor = new MatrixCursor(Columns.AGENDA_SEPARATOR_COLS);
        MatrixCursor.RowBuilder dateRow = dateCursor.newRow();
        dateRow.add(nextId++);
        dateRow.add(userTimeFormatter.formatDate(AgendaUtils.buildOrgDateTimeFromDate(date, null)));
        dateRow.add(1); // Separator
        allCursors.add(dateCursor);
        allCursors.add(agenda.get(dateMilli));
    }

    return new MergeCursor(allCursors.toArray(new Cursor[allCursors.size()]));
}
 
开发者ID:orgzly,项目名称:orgzly-android,代码行数:17,代码来源:AgendaFragment.java

示例7: queryRoots

import android.database.MatrixCursor; //导入方法依赖的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;
}
 
开发者ID:Datatellit,项目名称:xlight_android_native,代码行数:24,代码来源:LocalStorageProvider.java

示例8: includeFile

import android.database.MatrixCursor; //导入方法依赖的package包/类
private void includeFile(final MatrixCursor result, final File file)
        throws FileNotFoundException {
    final MatrixCursor.RowBuilder row = result.newRow();
    // These columns are required
    row.add(Document.COLUMN_DOCUMENT_ID, file.getAbsolutePath());
    row.add(Document.COLUMN_DISPLAY_NAME, file.getName());
    String mimeType = getDocumentType(file.getAbsolutePath());
    row.add(Document.COLUMN_MIME_TYPE, mimeType);
    int flags = file.canWrite() ? Document.FLAG_SUPPORTS_DELETE | Document.FLAG_SUPPORTS_WRITE
            : 0;
    // We only show thumbnails for image files - expect a call to
    // openDocumentThumbnail for each file that has
    // this flag set
    if (mimeType.startsWith("image/"))
        flags |= Document.FLAG_SUPPORTS_THUMBNAIL;
    row.add(Document.COLUMN_FLAGS, flags);
    // COLUMN_SIZE is required, but can be null
    row.add(Document.COLUMN_SIZE, file.length());
    // These columns are optional
    row.add(Document.COLUMN_LAST_MODIFIED, file.lastModified());
    // Document.COLUMN_ICON can be a resource id identifying a custom icon.
    // The system provides default icons
    // based on mime type
    // Document.COLUMN_SUMMARY is optional additional information about the
    // file
}
 
开发者ID:Datatellit,项目名称:xlight_android_native,代码行数:27,代码来源:LocalStorageProvider.java

示例9: queryRoots

import android.database.MatrixCursor; //导入方法依赖的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_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;
}
 
开发者ID:goodev,项目名称:droidddle,代码行数:23,代码来源:LocalStorageProvider.java

示例10: includeFile

import android.database.MatrixCursor; //导入方法依赖的package包/类
private void includeFile(final MatrixCursor result, final File file) throws FileNotFoundException {
    final MatrixCursor.RowBuilder row = result.newRow();
    // These columns are required
    row.add(Document.COLUMN_DOCUMENT_ID, file.getAbsolutePath());
    row.add(Document.COLUMN_DISPLAY_NAME, file.getName());
    String mimeType = getDocumentType(file.getAbsolutePath());
    row.add(Document.COLUMN_MIME_TYPE, mimeType);
    int flags = file.canWrite() ? Document.FLAG_SUPPORTS_DELETE | Document.FLAG_SUPPORTS_WRITE : 0;
    // We only show thumbnails for image files - expect a call to
    // openDocumentThumbnail for each file that has
    // this flag set
    if (mimeType.startsWith("image/"))
        flags |= Document.FLAG_SUPPORTS_THUMBNAIL;
    row.add(Document.COLUMN_FLAGS, flags);
    // COLUMN_SIZE is required, but can be null
    row.add(Document.COLUMN_SIZE, file.length());
    // These columns are optional
    row.add(Document.COLUMN_LAST_MODIFIED, file.lastModified());
    // Document.COLUMN_ICON can be a resource id identifying a custom icon.
    // The system provides default icons
    // based on mime type
    // Document.COLUMN_SUMMARY is optional additional information about the
    // file
}
 
开发者ID:goodev,项目名称:droidddle,代码行数:25,代码来源:LocalStorageProvider.java

示例11: queryRoots

import android.database.MatrixCursor; //导入方法依赖的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, "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;
}
 
开发者ID:AppLozic,项目名称:Applozic-Android-Chat-Sample,代码行数:24,代码来源:LocalStorageProvider.java

示例12: queryFile

import android.database.MatrixCursor; //导入方法依赖的package包/类
public MatrixCursor.RowBuilder queryFile(AbstractTransport transport,
                                         MatrixCursor result, String id) {

    FEchoFile file_entry = transport.getFileMeta(id);
    String filename = file_entry.filename;

    if (!filename.contains(".") || !file_entry.existsLocally()) return null;
    else {
        MatrixCursor.RowBuilder row = result.newRow();

        int dotindex = filename.lastIndexOf(".") + 1;
        String extension = filename.substring(dotindex).toLowerCase();
        String mimetype = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);

        row.add(DocumentsContract.Document.COLUMN_DOCUMENT_ID, "idecfile://" + id);
        row.add(DocumentsContract.Document.COLUMN_DISPLAY_NAME, filename);
        row.add(DocumentsContract.Document.COLUMN_FLAGS, null);
        row.add(DocumentsContract.Document.COLUMN_MIME_TYPE, mimetype);
        row.add(DocumentsContract.Document.COLUMN_SIZE, file_entry.serverSize);
        row.add(DocumentsContract.Document.COLUMN_LAST_MODIFIED, null);

    }
    return null;
}
 
开发者ID:vit1-irk,项目名称:idec-mobile,代码行数:25,代码来源:FechoFilesProvider.java

示例13: includeFile

import android.database.MatrixCursor; //导入方法依赖的package包/类
private void includeFile(final MatrixCursor result, final File file) throws FileNotFoundException {
  final MatrixCursor.RowBuilder row = result.newRow();
  // These columns are required
  row.add(Document.COLUMN_DOCUMENT_ID, file.getAbsolutePath());
  row.add(Document.COLUMN_DISPLAY_NAME, file.getName());
  String mimeType = getDocumentType(file.getAbsolutePath());
  row.add(Document.COLUMN_MIME_TYPE, mimeType);
  int flags = file.canWrite()
          ? Document.FLAG_SUPPORTS_DELETE | Document.FLAG_SUPPORTS_WRITE | Document.FLAG_SUPPORTS_RENAME
          | (mimeType.equals(Document.MIME_TYPE_DIR) ? Document.FLAG_DIR_SUPPORTS_CREATE : 0) : 0;
  // We only show thumbnails for image files - expect a call to openDocumentThumbnail for each file that has
  // this flag set
  if (mimeType.startsWith("image/"))
    flags |= Document.FLAG_SUPPORTS_THUMBNAIL;
  row.add(Document.COLUMN_FLAGS, flags);
  // COLUMN_SIZE is required, but can be null
  row.add(Document.COLUMN_SIZE, file.length());
  // These columns are optional
  row.add(Document.COLUMN_LAST_MODIFIED, file.lastModified());
  // Document.COLUMN_ICON can be a resource id identifying a custom icon. The system provides default icons
  // based on mime type
  // Document.COLUMN_SUMMARY is optional additional information about the file
}
 
开发者ID:Nik-Sch,项目名称:ChatApp-Android,代码行数:24,代码来源:LocalStorageProvider.java

示例14: queryRoots

import android.database.MatrixCursor; //导入方法依赖的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, "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;
}
 
开发者ID:IamAlchemist,项目名称:AlchemistAndroidUtil,代码行数:24,代码来源:LocalStorageProvider.java

示例15: includeFile

import android.database.MatrixCursor; //导入方法依赖的package包/类
/**
 * Add a representation of a file to a cursor.
 *
 * @param result the cursor to modify
 * @param file   the File object representing the desired file (may be null if given docID)
 */
private void includeFile(MatrixCursor result, File file) {
    MatrixCursor.RowBuilder row = result.newRow();
    row.add(ImageContract.Columns.DISPLAY_NAME, file.getName());
    row.add(ImageContract.Columns.SIZE, file.length());
    row.add(ImageContract.Columns.ABSOLUTE_PATH, file.getAbsolutePath());
}
 
开发者ID:googlesamples,项目名称:android-ContentProviderPaging,代码行数:13,代码来源:ImageProvider.java


注:本文中的android.database.MatrixCursor.newRow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。