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


Java AbstractCursor类代码示例

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


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

示例1: query

import android.database.AbstractCursor; //导入依赖的package包/类
@SuppressLint("NewApi")
@Nullable
@Override
public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) {
    String path = uri.getEncodedPath();
    if (!path.startsWith("/font/")
            || selectionArgs == null ||  selectionArgs[0] == null) {
        return null;
    }

    String name = path.substring("/font/".length());
    String[] w = selectionArgs[0].split(",");
    int[] weight = new int[w.length];
    for (int i = 0; i < w.length; i++) {
        weight[i] = Integer.parseInt(w[i]);
    }

    FontFamily[] families = FontManager.getFontFamily(getContext(), name, weight);

    Bundle bundle = new Bundle();
    bundle.putParcelableArray("data", families);

    AbstractCursor cursor = new SimpleCursor();
    cursor.setExtras(bundle);
    return cursor;
}
 
开发者ID:RikkaApps,项目名称:FontProvider,代码行数:27,代码来源:FontProvider.java

示例2: type

import android.database.AbstractCursor; //导入依赖的package包/类
public static SubjectFactory<AbstractCursor_Subject, AbstractCursor> type() {
  return new SubjectFactory<AbstractCursor_Subject, AbstractCursor>() {
    @Override
    public AbstractCursor_Subject getSubject(FailureStrategy fs, AbstractCursor that) {
      return new AbstractCursor_Subject(fs, that);
    }
  };
}
 
开发者ID:pkware,项目名称:truth-android,代码行数:9,代码来源:AbstractCursor_Subject.java

示例3: getInstanceUncheckedLocked

import android.database.AbstractCursor; //导入依赖的package包/类
private Loader getInstanceUncheckedLocked(String documentId)
        throws FileNotFoundException {
    try {
        final ParsedDocumentId id = ParsedDocumentId.fromDocumentId(documentId, mIdDelimiter);
        if (mArchives.get(id.mArchiveId) != null) {
            return mArchives.get(id.mArchiveId);
        }

        final Cursor cursor = mProvider.queryDocument(id.mArchiveId, new String[]
                { Document.COLUMN_MIME_TYPE, COLUMN_LOCAL_FILE_PATH });
        cursor.moveToFirst();
        final String mimeType = cursor.getString(cursor.getColumnIndex(
                Document.COLUMN_MIME_TYPE));
        Preconditions.checkArgument(isSupportedArchiveType(mimeType),
                "Unsupported archive type.");
        final int columnIndex = cursor.getColumnIndex(COLUMN_LOCAL_FILE_PATH);
        final String localFilePath = columnIndex != -1 ? cursor.getString(columnIndex) : null;
        final File localFile = localFilePath != null ? new File(localFilePath) : null;

        final Uri notificationUri = ((AbstractCursor)cursor).getNotificationUri();
        final Loader loader = new Loader(mProvider, localFile, id, mIdDelimiter,
                notificationUri);

        // Remove the instance from mArchives collection once the archive file changes.
        if (notificationUri != null) {
            final LruCache<String, Loader> finalArchives = mArchives;
            mProvider.getContext().getContentResolver().registerContentObserver(notificationUri,
                    false,
                    new ContentObserver(null) {
                        @Override
                        public void onChange(boolean selfChange, Uri uri) {
                            synchronized (mArchives) {
                                final Loader currentLoader = mArchives.get(id.mArchiveId);
                                if (currentLoader == loader) {
                                    mArchives.remove(id.mArchiveId);
                                }
                            }
                        }
                    });
        }

        mArchives.put(id.mArchiveId, loader);
        return loader;
    } catch (IOException e) {
        // DocumentsProvider doesn't use IOException. For consistency convert it to
        // IllegalStateException.
        throw new IllegalStateException(e);
    }
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:50,代码来源:DocumentArchiveHelper.java

示例4: AbstractCursor_Subject

import android.database.AbstractCursor; //导入依赖的package包/类
protected AbstractCursor_Subject(FailureStrategy failureStrategy, AbstractCursor subject) {
  super(failureStrategy, subject);
}
 
开发者ID:pkware,项目名称:truth-android,代码行数:4,代码来源:AbstractCursor_Subject.java

示例5: AbstractCursor_Assert

import android.database.AbstractCursor; //导入依赖的package包/类
public AbstractCursor_Assert(AbstractCursor actual) {
  super(actual, AbstractCursor_Assert.class);
}
 
开发者ID:square,项目名称:assertj-android,代码行数:4,代码来源:AbstractCursor_Assert.java


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