• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java RowBuilder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中android.database.MatrixCursor.RowBuilder的典型用法代码示例。如果您正苦于以下问题:Java RowBuilder类的具体用法?Java RowBuilder怎么用?Java RowBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: getCheckConnectionCursor

import android.database.MatrixCursor.RowBuilder; //导入依赖的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.RowBuilder; //导入依赖的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.RowBuilder; //导入依赖的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: query

import android.database.MatrixCursor.RowBuilder; //导入依赖的package包/类
@Override
public Cursor query(final Uri uri, final String[] projection, final String selection, final String[] selectionArgs, final String sortOrder)
{
    final File file = new File(uri.getPath());

    if (!file.getAbsolutePath().startsWith(getContext().getCacheDir().getAbsolutePath()))
        throw new IllegalArgumentException("not in cache dir: " + uri);

    final MatrixCursor cursor = new MatrixCursor(projection);
    final RowBuilder row = cursor.newRow();
    for (int i = 0; i < projection.length; i++)
    {
        final String columnName = projection[i];
        if (columnName.equals(MediaStore.MediaColumns.DATA))
            row.add(file.getAbsolutePath());
        else if (columnName.equals(MediaStore.MediaColumns.SIZE))
            row.add(file.length());
        else if (columnName.equals(MediaStore.MediaColumns.DISPLAY_NAME))
            row.add(uri.getLastPathSegment());
        else
            throw new IllegalArgumentException("cannot handle: " + columnName);
    }

    return cursor;
}
 
开发者ID:soapboxsys,项目名称:ombuds-android,代码行数:26,代码来源:FileAttachmentProvider.java


示例5: createPinnedSitesCursor

import android.database.MatrixCursor.RowBuilder; //导入依赖的package包/类
private Cursor createPinnedSitesCursor(Integer[] positions) {
    MatrixCursor c = new MatrixCursor(PINNED_SITES_COLUMNS);

    if (positions == null) {
        return c;
    }

    for (int i = 0; i < positions.length; i++) {
        int position = positions[i];

        RowBuilder row = c.newRow();
        row.add(-1);
        row.add(PINNED_PREFIX + "url" + i);
        row.add(PINNED_PREFIX + "title" + i);
        row.add(position);
    }

    return c;
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:20,代码来源:TestTopSitesCursorWrapper.java


示例6: doRetrieveFileInfo

import android.database.MatrixCursor.RowBuilder; //导入依赖的package包/类
/**
 * Retrieves file information of a single file.
 * 
 * @param uri
 *            the URI pointing to a file.
 * @return the file information. Can be {@code null}, based on the input
 *         parameters.
 */
private MatrixCursor doRetrieveFileInfo(Uri uri) {
    MatrixCursor matrixCursor = BaseFileProviderUtils.newBaseFileCursor();

    File file = extractFile(uri);
    int type = file.isFile() ? BaseFile._FileTypeFile
            : (file.isDirectory() ? BaseFile._FileTypeDirectory : (file
                    .exists() ? BaseFile._FileTypeUnknown
                    : BaseFile._FileTypeNotExisted));
    RowBuilder newRow = matrixCursor.newRow();
    newRow.add(0);// _ID
    newRow.add(BaseFile.genContentIdUriBase(LocalFileContract._Authority)
            .buildUpon().appendPath(Uri.fromFile(file).toString()).build()
            .toString());
    newRow.add(file.getAbsolutePath());
    newRow.add(file.getName());
    newRow.add(file.canRead() ? 1 : 0);
    newRow.add(file.canWrite() ? 1 : 0);
    newRow.add(file.length());
    newRow.add(type);
    newRow.add(file.lastModified());
    newRow.add(FileUtils.getResIcon(type, file.getName()));

    return matrixCursor;
}
 
开发者ID:wcmatthysen,项目名称:android-filechooser,代码行数:33,代码来源:LocalFileProvider.java


示例7: doRetrieveFileInfo

import android.database.MatrixCursor.RowBuilder; //导入依赖的package包/类
/**
 * Retrieves file information of a single file.
 * 
 * @param uri
 *            the URI pointing to a file.
 * @return the file information. Can be {@code null}, based on the input
 *         parameters.
 */
private MatrixCursor doRetrieveFileInfo(Uri uri) {
    MatrixCursor matrixCursor = BaseFileProviderUtils.newBaseFileCursor();

    File file = extractFile(uri);
    int type = file.isFile() ? BaseFile.FILE_TYPE_FILE : (file
            .isDirectory() ? BaseFile.FILE_TYPE_DIRECTORY
            : (file.exists() ? BaseFile.FILE_TYPE_UNKNOWN
                    : BaseFile.FILE_TYPE_NOT_EXISTED));
    RowBuilder newRow = matrixCursor.newRow();
    newRow.add(0);// _ID
    newRow.add(BaseFile
            .genContentIdUriBase(
                    LocalFileContract.getAuthority(getContext()))
            .buildUpon().appendPath(Uri.fromFile(file).toString()).build()
            .toString());
    newRow.add(Uri.fromFile(file).toString());
    newRow.add(file.getName());
    newRow.add(file.canRead() ? 1 : 0);
    newRow.add(file.canWrite() ? 1 : 0);
    newRow.add(file.length());
    newRow.add(type);
    newRow.add(file.lastModified());
    newRow.add(FileUtils.getResIcon(type, file.getName()));

    return matrixCursor;
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:35,代码来源:LocalFileProvider.java


示例8: addRow

import android.database.MatrixCursor.RowBuilder; //导入依赖的package包/类
private void addRow(MatrixCursor c, String url, String title, int type, String data) {
    final RowBuilder row = c.newRow();
    row.add(-1);
    row.add(url);
    row.add(title);
    row.add(type);
    row.add(data);
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:9,代码来源:RecentTabsPanel.java


示例9: createTopSitesCursor

import android.database.MatrixCursor.RowBuilder; //导入依赖的package包/类
private Cursor createTopSitesCursor(int count) {
    MatrixCursor c = new MatrixCursor(TOP_SITES_COLUMNS);

    for (int i = 0; i < count; i++) {
        RowBuilder row = c.newRow();
        row.add(-1);
        row.add(TOP_PREFIX + "url" + i);
        row.add(TOP_PREFIX + "title" + i);
        row.add(i);
        row.add(i);
    }

    return c;
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:15,代码来源:TestTopSitesCursorWrapper.java


示例10: createSuggestedSitesCursor

import android.database.MatrixCursor.RowBuilder; //导入依赖的package包/类
private Cursor createSuggestedSitesCursor(int count) {
    MatrixCursor c = new MatrixCursor(SUGGESTED_SITES_COLUMNS);

    for (int i = 0; i < count; i++) {
        RowBuilder row = c.newRow();
        row.add(-1);
        row.add(SUGGESTED_PREFIX + "url" + i);
        row.add(SUGGESTED_PREFIX + "title" + i);
    }

    return c;
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:13,代码来源:TestTopSitesCursorWrapper.java


示例11: includeDefault

import android.database.MatrixCursor.RowBuilder; //导入依赖的package包/类
public void includeDefault() {
  final ArrayList<String> defaultColumns =
    new ArrayList<>(songsColumns.length + 1);
  defaultColumns.addAll(Arrays.asList(songsColumns));
  defaultColumns.add(BaseColumns._ID);
  final MatrixCursor defaultsCursor = new MatrixCursor(defaultColumns.toArray(
          new String[defaultColumns.size()]));
  RowBuilder row = defaultsCursor.newRow();
  row.add("Default");
  row.add(DEFAULT_TONE_INDEX);
  includeStaticCursor(defaultsCursor);
}
 
开发者ID:CarloRodriguez,项目名称:AlarmOn,代码行数:13,代码来源:MediaSongsView.java


示例12: query

import android.database.MatrixCursor.RowBuilder; //导入依赖的package包/类
public static Cursor query( Context context ) {
	MatrixCursor cursor = new MatrixCursor( new String [] {
		KEY
	}, 1 );
	Status status = Status.from( context );
	RowBuilder row = cursor.newRow();
	row.add( Integer.valueOf( status.value() ) );
	return cursor;
}
 
开发者ID:SilentCircle,项目名称:silent-text-android,代码行数:10,代码来源:StatusProvider.java


示例13: queryRoots

import android.database.MatrixCursor.RowBuilder; //导入依赖的package包/类
@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;
}
 
开发者ID:StoryMaker,项目名称:SecureShareLib,代码行数:13,代码来源:TransferStorageProvider.java


示例14: includeDefaultDocument

import android.database.MatrixCursor.RowBuilder; //导入依赖的package包/类
private void includeDefaultDocument(MatrixCursor result) {
    final RowBuilder row = result.newRow();
    row.add(Document.COLUMN_DOCUMENT_ID, DOC_ID_ROOT);
    row.add(Document.COLUMN_MIME_TYPE, Document.MIME_TYPE_DIR);
    row.add(Document.COLUMN_FLAGS,
            Document.FLAG_DIR_PREFERS_LAST_MODIFIED | Document.FLAG_DIR_SUPPORTS_CREATE);
}
 
开发者ID:StoryMaker,项目名称:SecureShareLib,代码行数:8,代码来源:TransferStorageProvider.java


示例15: appendNameAndRealUri

import android.database.MatrixCursor.RowBuilder; //导入依赖的package包/类
/**
 * Appends file name and real URI into {@code cursor}.
 * 
 * @param cursor
 *            the original cursor. It will be closed when done.
 * @return the new cursor.
 */
private Cursor appendNameAndRealUri(Cursor cursor) {
    if (cursor == null || cursor.getCount() == 0)
        return cursor;

    final int colUri = cursor.getColumnIndex(HistoryContract.COLUMN_URI);
    if (colUri < 0)
        return cursor;

    String[] columns = new String[cursor.getColumnCount()
            + ADDITIONAL_COLUMNS.length];
    System.arraycopy(cursor.getColumnNames(), 0, columns, 0,
            cursor.getColumnCount());
    System.arraycopy(ADDITIONAL_COLUMNS, 0, columns,
            cursor.getColumnCount(), ADDITIONAL_COLUMNS.length);

    MatrixCursor result = new MatrixCursor(columns);
    if (cursor.moveToFirst()) {
        do {
            RowBuilder builder = result.newRow();

            Cursor fileInfo = null;
            for (int i = 0; i < cursor.getColumnCount(); i++) {
                String data = cursor.getString(i);
                builder.add(data);

                if (i == colUri)
                    fileInfo = getContext().getContentResolver().query(
                            Uri.parse(data), null, null, null, null);
            }

            if (fileInfo != null) {
                if (fileInfo.moveToFirst()) {
                    builder.add(BaseFileProviderUtils.getFileName(fileInfo));
                    builder.add(BaseFileProviderUtils.getRealUri(fileInfo)
                            .toString());
                }
                fileInfo.close();
            }
        } while (cursor.moveToNext());
    }// if

    cursor.close();

    return result;
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:53,代码来源:HistoryProvider.java


示例16: get

import android.database.MatrixCursor.RowBuilder; //导入依赖的package包/类
/**
 * Returns a {@code Cursor} with the list of suggested websites.
 *
 * @param limit maximum number of suggested sites.
 * @param locale the target locale.
 * @param excludeUrls list of URLs to be excluded from the list.
 */
public synchronized Cursor get(int limit, Locale locale, List<String> excludeUrls) {
    final MatrixCursor cursor = new MatrixCursor(COLUMNS);

    // Return an empty cursor if suggested sites have been
    // disabled by the user.
    if (!isEnabled()) {
        return cursor;
    }

    final boolean isNewLocale = isNewLocale(context, locale);

    // Force the suggested sites file in profile dir to be re-generated
    // if the locale has changed.
    if (isNewLocale) {
        getFile().delete();
    }

    if (cachedSites == null || isNewLocale) {
        Log.d(LOGTAG, "No cached sites, refreshing.");
        refresh();
    }

    // Return empty cursor if there was an error when
    // loading the suggested sites or the list is empty.
    if (cachedSites == null || cachedSites.isEmpty()) {
        return cursor;
    }

    excludeUrls = includeBlacklist(excludeUrls);

    final int sitesCount = cachedSites.size();
    Log.d(LOGTAG, "Number of suggested sites: " + sitesCount);

    final int maxCount = Math.min(limit, sitesCount);
    for (Site site : cachedSites.values()) {
        if (cursor.getCount() == maxCount) {
            break;
        }

        if (excludeUrls != null && excludeUrls.contains(site.url)) {
            continue;
        }

        final boolean restrictedProfile =  RestrictedProfiles.isRestrictedProfile(context);

        if (restrictedProfile == site.restricted) {
            final RowBuilder row = cursor.newRow();
            row.add(-1);
            row.add(site.url);
            row.add(site.title);
        }
    }

    cursor.setNotificationUri(context.getContentResolver(),
                              BrowserContract.SuggestedSites.CONTENT_URI);

    return cursor;
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:66,代码来源:SuggestedSites.java


示例17: includeTransferFromCursor

import android.database.MatrixCursor.RowBuilder; //导入依赖的package包/类
private void includeTransferFromCursor(MatrixCursor result, Cursor cursor) {
    final long id = cursor.getLong(cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_ID));
    final String docId = String.valueOf(id);

    final String displayName = cursor.getString(
            cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_TITLE));
    String summary = cursor.getString(
            cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_DESCRIPTION));
    String mimeType = cursor.getString(
            cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_MEDIA_TYPE));
    if (mimeType == null) {
        // Provide fake MIME type so it's openable
        mimeType = "vnd.android.document/file";
    }
    Long size = cursor.getLong(
            cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_TOTAL_SIZE_BYTES));
    if (size == -1) {
        size = null;
    }

    final int status = cursor.getInt(
            cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_STATUS));
    switch (status) {
        case DownloadManager.STATUS_SUCCESSFUL:
            break;
        case DownloadManager.STATUS_PAUSED:
            summary = getContext().getString(R.string.download_queued);
            break;
        case DownloadManager.STATUS_PENDING:
            summary = getContext().getString(R.string.download_queued);
            break;
        case DownloadManager.STATUS_RUNNING:
            final long progress = cursor.getLong(cursor.getColumnIndexOrThrow(
                    DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR));
            if (size != null) {
                final long percent = progress * 100 / size;
                summary = getContext().getString(R.string.download_running_percent, percent);
            } else {
                summary = getContext().getString(R.string.download_running);
            }
            break;
        case DownloadManager.STATUS_FAILED:
        default:
            summary = getContext().getString(R.string.download_error);
            break;
    }

    int flags = Document.FLAG_SUPPORTS_DELETE | Document.FLAG_SUPPORTS_WRITE;
    if (mimeType != null && mimeType.startsWith("image/")) {
        flags |= Document.FLAG_SUPPORTS_THUMBNAIL;
    }

    final long lastModified = cursor.getLong(
            cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_LAST_MODIFIED_TIMESTAMP));

    final RowBuilder row = result.newRow();
    row.add(Document.COLUMN_DOCUMENT_ID, docId);
    row.add(Document.COLUMN_DISPLAY_NAME, displayName);
    row.add(Document.COLUMN_SUMMARY, summary);
    row.add(Document.COLUMN_SIZE, size);
    row.add(Document.COLUMN_MIME_TYPE, mimeType);
    row.add(Document.COLUMN_LAST_MODIFIED, lastModified);
    row.add(Document.COLUMN_FLAGS, flags);
}
 
开发者ID:StoryMaker,项目名称:SecureShareLib,代码行数:65,代码来源:TransferStorageProvider.java


示例18: add

import android.database.MatrixCursor.RowBuilder; //导入依赖的package包/类
private static MatrixCursor add( MatrixCursor cursor, UserSearchResult userSearchResult ) {

		RowBuilder row = cursor.newRow();

		row.add( userSearchResult.getUserID() );
		row.add( userSearchResult.getDisplayName() );
		row.add( null );

		return cursor;

	}
 
开发者ID:SilentCircle,项目名称:silent-text-android,代码行数:12,代码来源:RemoteContactRepository.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java InteractEvent类代码示例发布时间:2022-05-22
下一篇:
Java AnalyzerWrapper类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap