當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。