Java Code Examples for android.database.MatrixCursor#setNotificationUri()

The following examples show how to use android.database.MatrixCursor#setNotificationUri() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StickerContentProvider.java    From flutter_whatsapp_stickers with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@NonNull
private MatrixCursor getStickerPackInfo(@NonNull final Uri uri, @NonNull final List<StickerPack> stickerPackList) {
    final MatrixCursor cursor = new MatrixCursor(new String[] { STICKER_PACK_IDENTIFIER_IN_QUERY,
            STICKER_PACK_NAME_IN_QUERY, STICKER_PACK_PUBLISHER_IN_QUERY, STICKER_PACK_ICON_IN_QUERY,
            ANDROID_APP_DOWNLOAD_LINK_IN_QUERY, IOS_APP_DOWNLOAD_LINK_IN_QUERY, PUBLISHER_EMAIL, PUBLISHER_WEBSITE,
            PRIVACY_POLICY_WEBSITE, LICENSE_AGREEMENT_WEBSITE, IMAGE_DATA_VERSION, AVOID_CACHE, });

    for (final StickerPack stickerPack : stickerPackList) {
        final MatrixCursor.RowBuilder builder = cursor.newRow();
        builder.add(stickerPack.identifier);
        builder.add(stickerPack.name);
        builder.add(stickerPack.publisher);
        builder.add(stickerPack.trayImageFile);
        builder.add(stickerPack.androidPlayStoreLink);
        builder.add(stickerPack.iosAppStoreLink);
        builder.add(stickerPack.publisherEmail);
        builder.add(stickerPack.publisherWebsite);
        builder.add(stickerPack.privacyPolicyWebsite);
        builder.add(stickerPack.licenseAgreementWebsite);
        builder.add(stickerPack.imageDataVersion);
        builder.add(stickerPack.avoidCache ? 1 : 0);
    }

    cursor.setNotificationUri(Objects.requireNonNull(getContext()).getContentResolver(), uri);
    return cursor;
}
 
Example 2
Source File: StickerContentProvider.java    From flutter_whatsapp_stickers with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@NonNull
private MatrixCursor getStickersForAStickerPack(@NonNull final Uri uri) {
    final String identifier = uri.getLastPathSegment();
    final MatrixCursor cursor = new MatrixCursor(
            new String[] { STICKER_FILE_NAME_IN_QUERY, STICKER_FILE_EMOJI_IN_QUERY });

    for (final StickerPack stickerPack : getStickerPackList()) {
        if (identifier.equals(stickerPack.identifier)) {
            for (final Sticker sticker : stickerPack.getStickers()) {
                cursor.addRow(new Object[] { sticker.imageFileName, TextUtils.join(",", sticker.emojis) });
            }
        }
    }

    cursor.setNotificationUri(Objects.requireNonNull(getContext()).getContentResolver(), uri);
    return cursor;
}
 
Example 3
Source File: CrossProfileDocumentsProvider.java    From Shelter with Do What The F*ck You Want To Public License 6 votes vote down vote up
@Override
public Cursor queryChildDocuments(String parentDocumentId, String[] projection, String sortOrder) {
    ensureServiceBound();
    List<Map<String, Serializable>> files;
    try {
        files = mService.loadFiles(parentDocumentId);
    } catch (RemoteException e) {
        return null;
    }
    final MatrixCursor result = new MatrixCursor(projection == null ? DEFAULT_DOCUMENT_PROJECTION : projection);
    // Allow receiving notification on create / delete
    result.setNotificationUri(getContext().getContentResolver(),
            DocumentsContract.buildDocumentUri(AUTHORITY, parentDocumentId));

    for (Map<String, Serializable> file : files) {
        includeFile(result, file);
    }
    return result;
}