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

Java BookmarkColumns类代码示例

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

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



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

示例1: addBookmark

import android.provider.Browser.BookmarkColumns; //导入依赖的package包/类
private long addBookmark(ContentValues values) {
    String url = values.getAsString(Browser.BookmarkColumns.URL);
    String title = values.getAsString(Browser.BookmarkColumns.TITLE);
    boolean isFolder = false;
    if (values.containsKey(BOOKMARK_IS_FOLDER_PARAM)) {
        isFolder = values.getAsBoolean(BOOKMARK_IS_FOLDER_PARAM);
    }
    long parentId = INVALID_BOOKMARK_ID;
    if (values.containsKey(BOOKMARK_PARENT_ID_PARAM)) {
        parentId = values.getAsLong(BOOKMARK_PARENT_ID_PARAM);
    }
    long id = nativeAddBookmark(mNativeChromeBrowserProvider, url, title, isFolder, parentId);
    if (id == INVALID_BOOKMARK_ID) return id;

    if (isFolder) {
        updateLastModifiedBookmarkFolder(id);
    } else {
        updateLastModifiedBookmarkFolder(parentId);
    }
    return id;
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:22,代码来源:ChromeBrowserProvider.java


示例2: getString

import android.provider.Browser.BookmarkColumns; //导入依赖的package包/类
@Override
public String getString(int column) {
    switch (column) {
    case COLUMN_ID:
        return mCursor.getString(mCursor.getColumnIndex(BookmarkColumns._ID));
    case COLUMN_SUGGEST_INTENT_ACTION:
        return Intent.ACTION_VIEW;
    case COLUMN_SUGGEST_INTENT_DATA:
        return mCursor.getString(mCursor.getColumnIndex(BookmarkColumns.URL));
    case COLUMN_SUGGEST_TEXT_1:
        return mCursor.getString(mCursor.getColumnIndex(BookmarkColumns.TITLE));
    case COLUMN_SUGGEST_TEXT_2:
    case COLUMN_SUGGEST_TEXT_2_URL:
        return mCursor.getString(mCursor.getColumnIndex(BookmarkColumns.URL));
    case COLUMN_SUGGEST_ICON_1:
        // This is the icon displayed to the left of the result in QSB.
        return Integer.toString(R.mipmap.app_icon);
    case COLUMN_SUGGEST_LAST_ACCESS_HINT:
        // After clearing history, the Chrome bookmarks database will have a last
        // access time of 0 for all bookmarks. In the Android provider, this will
        // yield a negative last access time. A negative last access time will
        // cause global search to discard the result, so fix it up before
        // we return it.
        long lastAccess = mCursor.getLong(
                mCursor.getColumnIndex(BookmarkColumns.DATE));
        return lastAccess < 0 ? "0" : "" + lastAccess;
    default:
        throw new UnsupportedOperationException();
    }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:31,代码来源:ChromeBrowserProviderSuggestionsCursor.java


示例3: getLong

import android.provider.Browser.BookmarkColumns; //导入依赖的package包/类
@Override
public long getLong(int c) {
    switch (c) {
        case 7:
            // See comments above in getString() re. negative last access times.
            long lastAccess = mCursor.getLong(
                    mCursor.getColumnIndex(BookmarkColumns.DATE));
            return lastAccess < 0 ? 0 : lastAccess;
        default:
            throw new UnsupportedOperationException();
    }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:13,代码来源:ChromeBrowserProviderSuggestionsCursor.java


示例4: insert

import android.provider.Browser.BookmarkColumns; //导入依赖的package包/类
@Override
public Uri insert(Uri uri, ContentValues values) {
    if (!canHandleContentProviderApiCall()) return null;

    int match = mUriMatcher.match(uri);
    Uri res = null;
    long id;
    switch (match) {
        case URI_MATCH_BOOKMARKS:
            id = addBookmark(values);
            if (id == INVALID_BOOKMARK_ID) return null;
            break;
        case URL_MATCH_API_BOOKMARK_CONTENT:
            values.put(BookmarkColumns.BOOKMARK, 1);
            //$FALL-THROUGH$
        case URL_MATCH_API_BOOKMARK:
        case URL_MATCH_API_HISTORY_CONTENT:
            id = addBookmarkFromAPI(values);
            if (id == INVALID_CONTENT_PROVIDER_ID) return null;
            break;
        case URL_MATCH_API_SEARCHES:
            id = addSearchTermFromAPI(values);
            if (id == INVALID_CONTENT_PROVIDER_ID) return null;
            break;
        default:
            throw new IllegalArgumentException(TAG + ": insert - unknown URL " + uri);
    }

    res = ContentUris.withAppendedId(uri, id);
    getContext().getContentResolver().notifyChange(res, null);
    return res;
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:33,代码来源:ChromeBrowserProvider.java


示例5: buildBookmarkWhereClause

import android.provider.Browser.BookmarkColumns; //导入依赖的package包/类
/**
 * @return a SQL where class which is inserted the bookmark condition.
 */
private static String buildBookmarkWhereClause(String selection, boolean is_bookmark) {
    StringBuffer sb = new StringBuffer();
    sb.append(BookmarkColumns.BOOKMARK);
    sb.append(is_bookmark ? " = 1 " : " = 0");
    if (!TextUtils.isEmpty(selection)) {
        sb.append(" AND (");
        sb.append(selection);
        sb.append(")");
    }
    return sb.toString();
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:15,代码来源:ChromeBrowserProvider.java


示例6: fromContentValues

import android.provider.Browser.BookmarkColumns; //导入依赖的package包/类
static BookmarkRow fromContentValues(ContentValues values) {
    BookmarkRow row = new BookmarkRow();
    if (values.containsKey(BookmarkColumns.URL)) {
        row.url = values.getAsString(BookmarkColumns.URL);
    }
    if (values.containsKey(BookmarkColumns.BOOKMARK)) {
        row.isBookmark = values.getAsInteger(BookmarkColumns.BOOKMARK) != 0;
    }
    if (values.containsKey(BookmarkColumns.CREATED)) {
        row.created = values.getAsLong(BookmarkColumns.CREATED);
    }
    if (values.containsKey(BookmarkColumns.DATE)) {
        row.date = values.getAsLong(BookmarkColumns.DATE);
    }
    if (values.containsKey(BookmarkColumns.FAVICON)) {
        row.favicon = values.getAsByteArray(BookmarkColumns.FAVICON);
        // We need to know that the caller set the favicon column.
        if (row.favicon == null) {
            row.favicon = new byte[0];
        }
    }
    if (values.containsKey(BookmarkColumns.TITLE)) {
        row.title = values.getAsString(BookmarkColumns.TITLE);
    }
    if (values.containsKey(BookmarkColumns.VISITS)) {
        row.visits = values.getAsInteger(BookmarkColumns.VISITS);
    }
    if (values.containsKey(BOOKMARK_PARENT_ID_PARAM)) {
        row.parentId = values.getAsLong(BOOKMARK_PARENT_ID_PARAM);
    }
    return row;
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:33,代码来源:ChromeBrowserProvider.java


示例7: update

import android.provider.Browser.BookmarkColumns; //导入依赖的package包/类
@Override
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
    if (!canHandleContentProviderApiCall()) return 0;

    // Check for invalid id values if provided.
    // If it represents a bookmark node then it's the root node and not mutable.
    // Otherwise it represents a SQLite row id, so 0 is invalid.
    long bookmarkId = INVALID_CONTENT_PROVIDER_ID;
    try {
        bookmarkId = ContentUris.parseId(uri);
        if (bookmarkId == INVALID_CONTENT_PROVIDER_ID) return 0;
    } catch (Exception e) {
    }

    int match = mUriMatcher.match(uri);
    int result;
    switch (match) {
        case URI_MATCH_BOOKMARKS_ID:
            String url = null;
            if (values.containsKey(Browser.BookmarkColumns.URL)) {
                url = values.getAsString(Browser.BookmarkColumns.URL);
            }
            String title = values.getAsString(Browser.BookmarkColumns.TITLE);
            long parentId = INVALID_BOOKMARK_ID;
            if (values.containsKey(BOOKMARK_PARENT_ID_PARAM)) {
                parentId = values.getAsLong(BOOKMARK_PARENT_ID_PARAM);
            }
            result = nativeUpdateBookmark(mNativeChromeBrowserProvider, bookmarkId, url, title,
                    parentId);
            updateLastModifiedBookmarkFolder(parentId);
            break;
        case URL_MATCH_API_BOOKMARK_ID:
            result = updateBookmarkFromAPI(values, buildWhereClause(bookmarkId, selection),
                    selectionArgs);
            break;
        case URL_MATCH_API_BOOKMARK:
            result = updateBookmarkFromAPI(values, selection, selectionArgs);
            break;
        case URL_MATCH_API_SEARCHES_ID:
            result = updateSearchTermFromAPI(values, buildWhereClause(bookmarkId, selection),
                    selectionArgs);
            break;
        case URL_MATCH_API_SEARCHES:
            result = updateSearchTermFromAPI(values, selection, selectionArgs);
            break;
        case URL_MATCH_API_HISTORY_CONTENT:
            result = updateBookmarkFromAPI(values, buildHistoryWhereClause(selection),
                    selectionArgs);
            break;
        case URL_MATCH_API_HISTORY_CONTENT_ID:
            result = updateBookmarkFromAPI(values,
                    buildHistoryWhereClause(bookmarkId, selection), selectionArgs);
            break;
        case URL_MATCH_API_BOOKMARK_CONTENT:
            result = updateBookmarkFromAPI(values, buildBookmarkWhereClause(selection),
                    selectionArgs);
            break;
        case URL_MATCH_API_BOOKMARK_CONTENT_ID:
            result = updateBookmarkFromAPI(values,
                    buildBookmarkWhereClause(bookmarkId, selection), selectionArgs);
            break;
        default:
            throw new IllegalArgumentException(TAG + ": update - unknown URL " + uri);
    }
    if (result != 0) {
        getContext().getContentResolver().notifyChange(uri, null);
    }
    return result;
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:70,代码来源:ChromeBrowserProvider.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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