當前位置: 首頁>>代碼示例>>Java>>正文


Java MatrixCursor類代碼示例

本文整理匯總了Java中android.database.MatrixCursor的典型用法代碼示例。如果您正苦於以下問題:Java MatrixCursor類的具體用法?Java MatrixCursor怎麽用?Java MatrixCursor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MatrixCursor類屬於android.database包,在下文中一共展示了MatrixCursor類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doCheckAncestor

import android.database.MatrixCursor; //導入依賴的package包/類
/**
 * Checks ancestor with {@link BaseFile#CMD_IS_ANCESTOR_OF},
 * {@link BaseFile#PARAM_SOURCE} and {@link BaseFile#PARAM_TARGET}.
 * 
 * @param uri
 *            the original URI from client.
 * @return {@code null} if source is not ancestor of target; or a
 *         <i>non-null but empty</i> cursor if the source is.
 */
private MatrixCursor doCheckAncestor(Uri uri) {
    File source = new File(Uri.parse(
            uri.getQueryParameter(BaseFile.PARAM_SOURCE)).getPath());
    File target = new File(Uri.parse(
            uri.getQueryParameter(BaseFile.PARAM_TARGET)).getPath());
    if (source == null || target == null)
        return null;

    boolean validate = ProviderUtils.getBooleanQueryParam(uri,
            BaseFile.PARAM_VALIDATE, true);
    if (validate) {
        if (!source.isDirectory() || !target.exists())
            return null;
    }

    if (source.equals(target.getParentFile())
            || (target.getParent() != null && target.getParent()
                    .startsWith(source.getAbsolutePath())))
        return BaseFileProviderUtils.newClosedCursor();

    return null;
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:32,代碼來源:LocalFileProvider.java

示例2: 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

示例3: 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

示例4: 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

示例5: getUnarchivedConversationList

import android.database.MatrixCursor; //導入依賴的package包/類
private Cursor getUnarchivedConversationList() {
  List<Cursor> cursorList = new LinkedList<>();
  cursorList.add(DatabaseFactory.getThreadDatabase(context).getConversationList());

  int archivedCount = DatabaseFactory.getThreadDatabase(context)
                                     .getArchivedConversationListCount();

  if (archivedCount > 0) {
    MatrixCursor switchToArchiveCursor = new MatrixCursor(new String[] {
        ThreadDatabase.ID, ThreadDatabase.DATE, ThreadDatabase.MESSAGE_COUNT,
        ThreadDatabase.RECIPIENT_IDS, ThreadDatabase.SNIPPET, ThreadDatabase.READ,
        ThreadDatabase.TYPE, ThreadDatabase.SNIPPET_TYPE, ThreadDatabase.SNIPPET_URI,
        ThreadDatabase.ARCHIVED, ThreadDatabase.STATUS, ThreadDatabase.RECEIPT_COUNT,
        ThreadDatabase.EXPIRES_IN, ThreadDatabase.LAST_SEEN}, 1);

    switchToArchiveCursor.addRow(new Object[] {-1L, System.currentTimeMillis(), archivedCount,
                                               "-1", null, 1, ThreadDatabase.DistributionTypes.ARCHIVE,
                                               0, null, 0, -1, 0, 0, 0});
    
    cursorList.add(switchToArchiveCursor);
  }

  return new MergeCursor(cursorList.toArray(new Cursor[0]));
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:25,代碼來源:ConversationListLoader.java

示例6: createCursorForAccount

import android.database.MatrixCursor; //導入依賴的package包/類
/**
 * Creates a cursor that contains a single row and maps the section to the
 * given value.
 */
private Cursor createCursorForAccount(FilteredProfile fa) {
    MatrixCursor matrixCursor = new MatrixCursor(COLUMN_HEADERS);
    
    
    matrixCursor.addRow(new Object[] {
            fa.account.id,
            fa.account.id,
            fa.account.display_name,
            fa.account.wizard,
            fa.isForceCall ? 1 : 0,
            fa.rewriteNumber(numberToCall),
            fa.getStatusForOutgoing() ? 1 : 0,
            fa.getStatusColor()
    });
    return matrixCursor;
}
 
開發者ID:treasure-lau,項目名稱:CSipSimple,代碼行數:21,代碼來源:AccountsLoader.java

示例7: createContentCursorFor

import android.database.MatrixCursor; //導入依賴的package包/類
/**
 * Creates a cursor that contains contacts group corresponding to an sip
 * account.
 */
private Cursor createContentCursorFor(SipProfile account) {
    Cursor c = null;
    if(!TextUtils.isEmpty(account.android_group)) {
        c = ContactsWrapper.getInstance().getContactsByGroup(getContext(), account.android_group);
    }
    if(c != null) {
        return c;
    }
    MatrixCursor mc = new MatrixCursor (new String[] {
            BaseColumns._ID, 
            ContactsWrapper.FIELD_TYPE
    });
    mc.addRow(new Object[] {account.id, ContactsWrapper.TYPE_CONFIGURE});
    return mc;
}
 
開發者ID:treasure-lau,項目名稱:CSipSimple,代碼行數:20,代碼來源:FavLoader.java

示例8: loadInBackground

import android.database.MatrixCursor; //導入依賴的package包/類
@Override
public Cursor loadInBackground() {
    Cursor albums = super.loadInBackground();
    MatrixCursor allAlbum = new MatrixCursor(COLUMNS);
    int totalCount = 0;
    String allAlbumCoverPath = "";
    if (albums != null) {
        while (albums.moveToNext()) {
            totalCount += albums.getInt(albums.getColumnIndex(COLUMN_COUNT));
        }
        if (albums.moveToFirst()) {
            allAlbumCoverPath = albums.getString(albums.getColumnIndex(MediaStore.MediaColumns.DATA));
        }
    }
    allAlbum.addRow(new String[]{Album.ALBUM_ID_ALL, Album.ALBUM_ID_ALL, Album.ALBUM_NAME_ALL, allAlbumCoverPath,
            String.valueOf(totalCount)});

    return new MergeCursor(new Cursor[]{allAlbum, albums});
}
 
開發者ID:sathishmscict,項目名稱:Matisse-Image-and-Video-Selector,代碼行數:20,代碼來源:AlbumLoader.java

示例9: 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

示例10: 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

示例11: updateCursorForDownloadedFile

import android.database.MatrixCursor; //導入依賴的package包/類
private void updateCursorForDownloadedFile(Context context, Uri uri) {
    synchronized (this) {
        closeCursor();
        MatrixCursor cursor = new MatrixCursor(PROJECTION_MATRIX);
        String title = getValueForDownloadedFile(this, uri, "title");
        cursor.addRow(new Object[]{
                null,
                null,
                null,
                title,
                null,
                null,
                null,
                null
        });
        mCursor = cursor;
        mCursor.moveToFirst();
    }
}
 
開發者ID:Vinetos,項目名稱:Hello-Music-droid,代碼行數:20,代碼來源:MusicService.java

示例12: updateCursorForDownloadedFile

import android.database.MatrixCursor; //導入依賴的package包/類
/**
 * Creates a pseudo cursor for downloaded audio files with minimal info
 *
 * @param context needed to query the download uri
 * @param uri     the uri of the downloaded file
 */
private void updateCursorForDownloadedFile(Context context, Uri uri) {
    synchronized (this) {
        closeCursor();  // clear mCursor
        MatrixCursor cursor = new MatrixCursor(PROJECTION_MATRIX);
        // get title of the downloaded file ; Downloads.Impl.COLUMN_TITLE
        String title = getValueForDownloadedFile(this, uri, "title");
        // populating the cursor with bare minimum info
        cursor.addRow(new Object[]{
                null,
                null,
                null,
                title,
                null,
                null,
                null,
                null
        });
        mCursor = cursor;
        mCursor.moveToFirst();
    }
}
 
開發者ID:komamj,項目名稱:KomaMusic,代碼行數:28,代碼來源:MusicService.java

示例13: 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

示例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, 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

示例15: queryChildDocuments

import android.database.MatrixCursor; //導入依賴的package包/類
@Override
public Cursor queryChildDocuments(final String parentDocumentId, final String[] projection,
                                  final String sortOrder) 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_DOCUMENT_PROJECTION);
    final File parent = new File(parentDocumentId);
    for (File file : parent.listFiles()) {
        // Don't show hidden files/folders
        if (!file.getName().startsWith(".")) {
            // Adds the file's display name, MIME type, size, and so on.
            includeFile(result, file);
        }
    }
    return result;
}
 
開發者ID:Datatellit,項目名稱:xlight_android_native,代碼行數:18,代碼來源:LocalStorageProvider.java


注:本文中的android.database.MatrixCursor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。