android.content.ContentValues

Here are the examples of the java api class android.content.ContentValues taken from open source projects.

1. SipProfile#getDbContentValues()

Project: CSipSimple
Source File: SipProfile.java
View license
/**
     * Transform pjsua_acc_config into ContentValues that can be insert into
     * database. <br/>
     * Take care that if your SipProfile is incomplete this content value may
     * also be uncomplete and lead to override unwanted values of the existing
     * database. <br/>
     * So if updating, take care on what you actually want to update instead of
     * using this utility method.
     * 
     * @return Complete content values from the current wrapper around sip
     *         profile.
     */
public ContentValues getDbContentValues() {
    ContentValues args = new ContentValues();
    if (id != INVALID_ID) {
        args.put(FIELD_ID, id);
    }
    // TODO : ensure of non nullity of some params
    args.put(FIELD_ACTIVE, active ? 1 : 0);
    args.put(FIELD_WIZARD, wizard);
    args.put(FIELD_DISPLAY_NAME, display_name);
    args.put(FIELD_TRANSPORT, transport);
    args.put(FIELD_DEFAULT_URI_SCHEME, default_uri_scheme);
    args.put(FIELD_WIZARD_DATA, wizard_data);
    args.put(FIELD_PRIORITY, priority);
    args.put(FIELD_ACC_ID, acc_id);
    args.put(FIELD_REG_URI, reg_uri);
    args.put(FIELD_PUBLISH_ENABLED, publish_enabled);
    args.put(FIELD_REG_TIMEOUT, reg_timeout);
    args.put(FIELD_KA_INTERVAL, ka_interval);
    args.put(FIELD_PIDF_TUPLE_ID, pidf_tuple_id);
    args.put(FIELD_FORCE_CONTACT, force_contact);
    args.put(FIELD_ALLOW_CONTACT_REWRITE, allow_contact_rewrite ? 1 : 0);
    args.put(FIELD_ALLOW_VIA_REWRITE, allow_via_rewrite ? 1 : 0);
    args.put(FIELD_ALLOW_SDP_NAT_REWRITE, allow_sdp_nat_rewrite ? 1 : 0);
    args.put(FIELD_CONTACT_REWRITE_METHOD, contact_rewrite_method);
    args.put(FIELD_USE_SRTP, use_srtp);
    args.put(FIELD_USE_ZRTP, use_zrtp);
    if (proxies != null) {
        args.put(FIELD_PROXY, TextUtils.join(PROXIES_SEPARATOR, proxies));
    } else {
        args.put(FIELD_PROXY, "");
    }
    args.put(FIELD_REG_USE_PROXY, reg_use_proxy);
    // Assume we have an unique credential
    args.put(FIELD_REALM, realm);
    args.put(FIELD_SCHEME, scheme);
    args.put(FIELD_USERNAME, username);
    args.put(FIELD_DATATYPE, datatype);
    if (!TextUtils.isEmpty(data)) {
        args.put(FIELD_DATA, data);
    }
    args.put(FIELD_AUTH_INITIAL_AUTH, initial_auth ? 1 : 0);
    if (!TextUtils.isEmpty(auth_algo)) {
        args.put(FIELD_AUTH_ALGO, auth_algo);
    }
    args.put(FIELD_SIP_STACK, sip_stack);
    args.put(FIELD_MWI_ENABLED, mwi_enabled);
    args.put(FIELD_VOICE_MAIL_NBR, vm_nbr);
    args.put(FIELD_REG_DELAY_BEFORE_REFRESH, reg_delay_before_refresh);
    args.put(FIELD_TRY_CLEAN_REGISTERS, try_clean_registers);
    args.put(FIELD_RTP_BOUND_ADDR, rtp_bound_addr);
    args.put(FIELD_RTP_ENABLE_QOS, rtp_enable_qos);
    args.put(FIELD_RTP_PORT, rtp_port);
    args.put(FIELD_RTP_PUBLIC_ADDR, rtp_public_addr);
    args.put(FIELD_RTP_QOS_DSCP, rtp_qos_dscp);
    args.put(FIELD_VID_IN_AUTO_SHOW, vid_in_auto_show);
    args.put(FIELD_VID_OUT_AUTO_TRANSMIT, vid_out_auto_transmit);
    args.put(FIELD_RFC5626_INSTANCE_ID, rfc5626_instance_id);
    args.put(FIELD_RFC5626_REG_ID, rfc5626_reg_id);
    args.put(FIELD_USE_RFC5626, use_rfc5626 ? 1 : 0);
    args.put(FIELD_ANDROID_GROUP, android_group);
    args.put(FIELD_SIP_STUN_USE, sip_stun_use);
    args.put(FIELD_MEDIA_STUN_USE, media_stun_use);
    args.put(FIELD_ICE_CFG_USE, ice_cfg_use);
    args.put(FIELD_ICE_CFG_ENABLE, ice_cfg_enable);
    args.put(FIELD_TURN_CFG_USE, turn_cfg_use);
    args.put(FIELD_TURN_CFG_ENABLE, turn_cfg_enable);
    args.put(FIELD_TURN_CFG_SERVER, turn_cfg_server);
    args.put(FIELD_TURN_CFG_USER, turn_cfg_user);
    args.put(FIELD_TURN_CFG_PASSWORD, turn_cfg_password);
    args.put(FIELD_IPV6_MEDIA_USE, ipv6_media_use);
    return args;
}

2. ContentAdapter#createAdmobContentValues()

Project: andlytics
Source File: ContentAdapter.java
View license
private ContentValues createAdmobContentValues(AdmobStats admob) {
    ContentValues values = new ContentValues();
    values.put(AdmobTable.KEY_CLICKS, admob.getClicks());
    values.put(AdmobTable.KEY_CPC_REVENUE, admob.getCpcRevenue());
    values.put(AdmobTable.KEY_CPM_REVENUE, admob.getCpmRevenue());
    values.put(AdmobTable.KEY_CTR, admob.getCtr());
    values.put(AdmobTable.KEY_DATE, Utils.formatDbDate(admob.getDate()));
    values.put(AdmobTable.KEY_ECPM, admob.getEcpm());
    values.put(AdmobTable.KEY_EXCHANGE_DOWNLOADS, admob.getExchangeDownloads());
    values.put(AdmobTable.KEY_FILL_RATE, admob.getFillRate());
    values.put(AdmobTable.KEY_HOUSEAD_CLICKS, admob.getHouseAdClicks());
    values.put(AdmobTable.KEY_HOUSEAD_FILL_RATE, admob.getHouseadFillRate());
    values.put(AdmobTable.KEY_HOUSEAD_REQUESTS, admob.getHouseadRequests());
    values.put(AdmobTable.KEY_IMPRESSIONS, admob.getImpressions());
    values.put(AdmobTable.KEY_INTERSTITIAL_REQUESTS, admob.getInterstitialRequests());
    values.put(AdmobTable.KEY_OVERALL_FILL_RATE, admob.getOverallFillRate());
    values.put(AdmobTable.KEY_REQUESTS, admob.getRequests());
    values.put(AdmobTable.KEY_REVENUE, admob.getRevenue());
    values.put(AdmobTable.KEY_SITE_ID, admob.getSiteId());
    values.put(AdmobTable.KEY_CURRENCY, admob.getCurrencyCode());
    return values;
}

3. AccountTable#save()

Project: WordPress-Android
Source File: AccountTable.java
View license
public static void save(Account account, SQLiteDatabase database) {
    ContentValues values = new ContentValues();
    // we only support one wpcom user at the moment: local_id is always 0
    values.put("local_id", 0);
    values.put("user_name", account.getUserName());
    values.put("user_id", account.getUserId());
    values.put("display_name", account.getDisplayName());
    values.put("profile_url", account.getProfileUrl());
    values.put("avatar_url", account.getAvatarUrl());
    values.put("primary_blog_id", account.getPrimaryBlogId());
    values.put("site_count", account.getSiteCount());
    values.put("visible_site_count", account.getVisibleSiteCount());
    values.put("access_token", account.getAccessToken());
    values.put("email", account.getEmail());
    values.put("first_name", account.getFirstName());
    values.put("last_name", account.getLastName());
    values.put("about_me", account.getAboutMe());
    values.put("date", DateTimeUtils.javaDateToIso8601(account.getDateCreated()));
    values.put("new_email", account.getNewEmail());
    values.put("pending_email_change", account.getPendingEmailChange());
    values.put("web_address", account.getWebAddress());
    database.insertWithOnConflict(ACCOUNT_TABLE, null, values, SQLiteDatabase.CONFLICT_REPLACE);
}

4. SyncUtils#contentValuesFromTVShow()

Project: Kore
Source File: SyncUtils.java
View license
/**
     * Returns {@link android.content.ContentValues} from a {@link VideoType.DetailsTVShow} show
     * @param hostId Host id for this tvshow
     * @param tvshow {@link org.xbmc.kore.jsonrpc.type.VideoType.DetailsTVShow}
     * @return {@link android.content.ContentValues} with the tvshow values
     */
public static ContentValues contentValuesFromTVShow(int hostId, VideoType.DetailsTVShow tvshow) {
    ContentValues tvshowValues = new ContentValues();
    tvshowValues.put(MediaContract.TVShowsColumns.HOST_ID, hostId);
    tvshowValues.put(MediaContract.TVShowsColumns.TVSHOWID, tvshow.tvshowid);
    tvshowValues.put(MediaContract.TVShowsColumns.FANART, tvshow.fanart);
    tvshowValues.put(MediaContract.TVShowsColumns.THUMBNAIL, tvshow.thumbnail);
    tvshowValues.put(MediaContract.TVShowsColumns.PLAYCOUNT, tvshow.playcount);
    tvshowValues.put(MediaContract.TVShowsColumns.TITLE, tvshow.title);
    tvshowValues.put(MediaContract.TVShowsColumns.DATEADDED, tvshow.dateadded);
    tvshowValues.put(MediaContract.TVShowsColumns.FILE, tvshow.file);
    tvshowValues.put(MediaContract.TVShowsColumns.PLOT, tvshow.plot);
    tvshowValues.put(MediaContract.TVShowsColumns.EPISODE, tvshow.episode);
    tvshowValues.put(MediaContract.TVShowsColumns.IMDBNUMBER, tvshow.imdbnumber);
    tvshowValues.put(MediaContract.TVShowsColumns.MPAA, tvshow.mpaa);
    tvshowValues.put(MediaContract.TVShowsColumns.PREMIERED, tvshow.premiered);
    tvshowValues.put(MediaContract.TVShowsColumns.RATING, tvshow.rating);
    tvshowValues.put(MediaContract.TVShowsColumns.STUDIO, Utils.listStringConcat(tvshow.studio, LIST_DELIMETER));
    tvshowValues.put(MediaContract.TVShowsColumns.WATCHEDEPISODES, tvshow.watchedepisodes);
    tvshowValues.put(MediaContract.TVShowsColumns.GENRES, Utils.listStringConcat(tvshow.genre, LIST_DELIMETER));
    return tvshowValues;
}

5. OnlineEventDetailsDBHandler#insertRow()

View license
public void insertRow(OnlineEventDetails event) {
    ContentValues values = new ContentValues();
    values.put(COLUMN_TIME_STAMP, event.get_TimeStamp());
    values.put(COLUMN_EEVEE_ID, event.get_eeVeeID());
    values.put(COLUMN_NAME, event.get_EventName());
    values.put(COLUMN_PLACE, event.get_EventPlace());
    values.put(COLUMN_START_DATE_TIME, event.get_StartDateTime());
    values.put(COLUMN_END_DATE_TIME, event.get_EndDateTime());
    values.put(COLUMN_REPETITION, event.get_Repetition());
    values.put(COLUMN_TYPE, event.get_Type());
    values.put(COLUMN_REGN_PLACE, event.get_Regn_Place());
    values.put(COLUMN_WEBSITE, event.get_Website());
    values.put(COLUMN_DEADLINE_DATE_TIME, event.get_DeadlineDateTime());
    values.put(COLUMN_COMMENTS, event.get_Comments());
    values.put(COLUMN_STARTS_FROM, event.get_StartsFromDailyOrWeekly());
    values.put(COLUMN_ENDS_ON, event.get_EndsFromDailyOrWeekly());
    values.put(COLUMN_STATUS, event.get_Status());
    values.put(COLUMN_CLUBNAME, event.get_ClubName());
    values.put(COLUMN_APPROVAL, event.get_Approval());
    SQLiteDatabase db = getWritableDatabase();
    db.insert(TABLE_NAME, null, values);
    db.close();
}

6. DataStore#storeIntoDatabase()

Project: cgeo
Source File: DataStore.java
View license
private static boolean storeIntoDatabase(final Geocache cache) {
    cache.addStorageLocation(StorageLocation.DATABASE);
    cacheCache.putCacheInCache(cache);
    Log.d("Saving " + cache.toString() + " (" + cache.getLists() + ") to DB");
    final ContentValues values = new ContentValues();
    if (cache.getUpdated() == 0) {
        values.put("updated", System.currentTimeMillis());
    } else {
        values.put("updated", cache.getUpdated());
    }
    values.put("reason", StoredList.STANDARD_LIST_ID);
    values.put("detailed", cache.isDetailed() ? 1 : 0);
    values.put("detailedupdate", cache.getDetailedUpdate());
    values.put("visiteddate", cache.getVisitedDate());
    values.put("geocode", cache.getGeocode());
    values.put("cacheid", cache.getCacheId());
    values.put("guid", cache.getGuid());
    values.put("type", cache.getType().id);
    values.put("name", cache.getName());
    values.put("owner", cache.getOwnerDisplayName());
    values.put("owner_real", cache.getOwnerUserId());
    final Date hiddenDate = cache.getHiddenDate();
    if (hiddenDate == null) {
        values.put("hidden", 0);
    } else {
        values.put("hidden", hiddenDate.getTime());
    }
    values.put("hint", cache.getHint());
    values.put("size", cache.getSize().id);
    values.put("difficulty", cache.getDifficulty());
    values.put("terrain", cache.getTerrain());
    values.put("location", cache.getLocation());
    values.put("distance", cache.getDistance());
    values.put("direction", cache.getDirection());
    putCoords(values, cache.getCoords());
    values.put("reliable_latlon", cache.isReliableLatLon() ? 1 : 0);
    values.put("shortdesc", cache.getShortDescription());
    values.put("personal_note", cache.getPersonalNote());
    values.put("description", cache.getDescription());
    values.put("favourite_cnt", cache.getFavoritePoints());
    values.put("rating", cache.getRating());
    values.put("votes", cache.getVotes());
    values.put("myvote", cache.getMyVote());
    values.put("disabled", cache.isDisabled() ? 1 : 0);
    values.put("archived", cache.isArchived() ? 1 : 0);
    values.put("members", cache.isPremiumMembersOnly() ? 1 : 0);
    values.put("found", cache.isFound() ? 1 : 0);
    values.put("favourite", cache.isFavorite() ? 1 : 0);
    values.put("inventoryunknown", cache.getInventoryItems());
    values.put("onWatchlist", cache.isOnWatchlist() ? 1 : 0);
    values.put("coordsChanged", cache.hasUserModifiedCoords() ? 1 : 0);
    values.put("finalDefined", cache.hasFinalDefined() ? 1 : 0);
    values.put("logPasswordRequired", cache.isLogPasswordRequired() ? 1 : 0);
    values.put("watchlistCount", cache.getWatchlistCount());
    init();
    // try to update record else insert fresh..
    database.beginTransaction();
    try {
        saveAttributesWithoutTransaction(cache);
        saveWaypointsWithoutTransaction(cache);
        saveSpoilersWithoutTransaction(cache);
        saveLogCountsWithoutTransaction(cache);
        saveInventoryWithoutTransaction(cache.getGeocode(), cache.getInventory());
        saveListsWithoutTransaction(cache);
        final int rows = database.update(dbTableCaches, values, "geocode = ?", new String[] { cache.getGeocode() });
        if (rows == 0) {
            // cache is not in the DB, insert it
            /* long id = */
            database.insert(dbTableCaches, null, values);
        }
        database.setTransactionSuccessful();
        return true;
    } catch (final Exception e) {
        Log.e("SaveCache", e);
    } finally {
        database.endTransaction();
    }
    return false;
}

7. WebEventDetailsDBHandler#insertRow()

View license
public void insertRow(WebEventDetails event) {
    ContentValues values = new ContentValues();
    values.put(COLUMN_TIME_STAMP, event.get_TimeStamp());
    values.put(COLUMN_EEVEE_ID, event.get_eeVeeID());
    values.put(COLUMN_NAME, event.get_EventName());
    values.put(COLUMN_PLACE, event.get_EventPlace());
    values.put(COLUMN_START_DATE_TIME, event.get_StartDateTime());
    values.put(COLUMN_END_DATE_TIME, event.get_EndDateTime());
    values.put(COLUMN_REPETITION, event.get_Repetition());
    values.put(COLUMN_TYPE, event.get_Type());
    values.put(COLUMN_REGN_PLACE, event.get_Regn_Place());
    values.put(COLUMN_WEBSITE, event.get_Website());
    values.put(COLUMN_DEADLINE_DATE_TIME, event.get_DeadlineDateTime());
    values.put(COLUMN_COMMENTS, event.get_Comments());
    values.put(COLUMN_STARTS_FROM, event.get_StartsFromDailyOrWeekly());
    values.put(COLUMN_ENDS_ON, event.get_EndsFromDailyOrWeekly());
    values.put(COLUMN_STATUS, event.get_Status());
    values.put(COLUMN_CLUBNAME, event.get_ClubName());
    SQLiteDatabase db = getWritableDatabase();
    db.insert(TABLE_NAME, null, values);
    db.close();
}

8. DbAdapterMovies#createContentValues()

Project: Mizuu
Source File: DbAdapterMovies.java
View license
private ContentValues createContentValues(String tmdbid, String title, String plot, String imdbid, String rating, String tagline, String release, String certification, String runtime, String trailer, String genres, String favourite, String actors, String collectionId, String toWatch, String hasWatched, String date, boolean includeTmdbId) {
    ContentValues values = new ContentValues();
    values.put(KEY_TITLE, title);
    values.put(KEY_PLOT, plot);
    if (includeTmdbId)
        values.put(KEY_TMDB_ID, tmdbid);
    values.put(KEY_IMDB_ID, imdbid);
    values.put(KEY_RATING, rating);
    values.put(KEY_TAGLINE, tagline);
    values.put(KEY_RELEASEDATE, release);
    values.put(KEY_CERTIFICATION, certification);
    values.put(KEY_RUNTIME, runtime);
    values.put(KEY_TRAILER, trailer);
    values.put(KEY_GENRES, genres);
    values.put(KEY_FAVOURITE, favourite);
    values.put(KEY_ACTORS, actors);
    values.put(KEY_COLLECTION_ID, collectionId);
    values.put(KEY_TO_WATCH, toWatch);
    values.put(KEY_HAS_WATCHED, hasWatched);
    values.put(KEY_DATE_ADDED, date);
    return values;
}

9. DatabaseManager#saveSrsDistribution()

View license
public void saveSrsDistribution(SRSDistribution distribution) {
    deleteSrsDistribution();
    ContentValues values = new ContentValues();
    values.put(SRSDistributionTable.COLUMN_NAME_APPRENTICE_RADICALS, distribution.getAprentice().getRadicalsCount());
    values.put(SRSDistributionTable.COLUMN_NAME_APPRENTICE_KANJI, distribution.getAprentice().getKanjiCount());
    values.put(SRSDistributionTable.COLUMN_NAME_APPRENTICE_VOCABULARY, distribution.getAprentice().getVocabularyCount());
    values.put(SRSDistributionTable.COLUMN_NAME_GURU_RADICALS, distribution.getGuru().getRadicalsCount());
    values.put(SRSDistributionTable.COLUMN_NAME_GURU_KANJI, distribution.getGuru().getKanjiCount());
    values.put(SRSDistributionTable.COLUMN_NAME_GURU_VOCABULARY, distribution.getGuru().getVocabularyCount());
    values.put(SRSDistributionTable.COLUMN_NAME_MASTER_RADICALS, distribution.getMaster().getRadicalsCount());
    values.put(SRSDistributionTable.COLUMN_NAME_MASTER_KANJI, distribution.getMaster().getKanjiCount());
    values.put(SRSDistributionTable.COLUMN_NAME_MASTER_VOCABULARY, distribution.getMaster().getVocabularyCount());
    values.put(SRSDistributionTable.COLUMN_NAME_ENLIGHTENED_RADICALS, distribution.getEnlighten().getRadicalsCount());
    values.put(SRSDistributionTable.COLUMN_NAME_ENLIGHTENED_KANJI, distribution.getEnlighten().getKanjiCount());
    values.put(SRSDistributionTable.COLUMN_NAME_ENLIGHTENED_VOCABULARY, distribution.getEnlighten().getVocabularyCount());
    values.put(SRSDistributionTable.COLUMN_NAME_BURNED_RADICALS, distribution.getBurned().getRadicalsCount());
    values.put(SRSDistributionTable.COLUMN_NAME_BURNED_KANJI, distribution.getBurned().getKanjiCount());
    values.put(SRSDistributionTable.COLUMN_NAME_BURNED_VOCABULARY, distribution.getBurned().getVocabularyCount());
    db.insert(SRSDistributionTable.TABLE_NAME, SRSDistributionTable.COLUMN_NAME_NULLABLE, values);
}

10. NewestNodeDataHelper#getContentValues()

View license
protected ContentValues getContentValues(TopicModel topic) {
    ContentValues values = new ContentValues();
    values.put(NewestNodeDBInfo.TOPIC_ID, topic.id);
    values.put(NewestNodeDBInfo.TITLE, topic.title);
    values.put(NewestNodeDBInfo.URL, topic.url);
    values.put(NewestNodeDBInfo.CONTENT, topic.content);
    values.put(NewestNodeDBInfo.CONTENT_RENDERED, topic.contentRendered);
    values.put(NewestNodeDBInfo.REPLIES, topic.replies);
    values.put(NewestNodeDBInfo.MEMBER_ID, topic.member.id);
    values.put(NewestNodeDBInfo.MEMBER_USERNAME, topic.member.username);
    values.put(NewestNodeDBInfo.MEMBER_TAGLINE, topic.member.tagline);
    values.put(NewestNodeDBInfo.MEMBER_AVATAR, topic.member.avatar);
    values.put(NewestNodeDBInfo.NODE_ID, topic.node.id);
    values.put(NewestNodeDBInfo.CREATED, topic.created);
    values.put(NewestNodeDBInfo.LAST_MODIFIED, topic.lastModified);
    values.put(NewestNodeDBInfo.LAST_TOUCHED, topic.lastTouched);
    return values;
}

11. DbAdapterMovies#createUpdateContentValues()

Project: Mizuu
Source File: DbAdapterMovies.java
View license
private ContentValues createUpdateContentValues(String title, String plot, String imdbid, String rating, String tagline, String release, String certification, String runtime, String trailer, String genres, String actors, String collectionId, String date) {
    ContentValues values = new ContentValues();
    values.put(KEY_TITLE, title);
    values.put(KEY_PLOT, plot);
    values.put(KEY_IMDB_ID, imdbid);
    values.put(KEY_RATING, rating);
    values.put(KEY_TAGLINE, tagline);
    values.put(KEY_RELEASEDATE, release);
    values.put(KEY_CERTIFICATION, certification);
    values.put(KEY_RUNTIME, runtime);
    values.put(KEY_TRAILER, trailer);
    values.put(KEY_GENRES, genres);
    values.put(KEY_ACTORS, actors);
    values.put(KEY_COLLECTION_ID, collectionId);
    values.put(KEY_DATE_ADDED, date);
    return values;
}

12. User#toSimpleContentValues()

Project: fanfouapp-opensource
Source File: User.java
View license
public ContentValues toSimpleContentValues() {
    final User u = this;
    final ContentValues cv = new ContentValues();
    cv.put(UserInfo.SCREEN_NAME, u.screenName);
    cv.put(UserInfo.LOCATION, u.location);
    cv.put(UserInfo.GENDER, u.gender);
    cv.put(UserInfo.BIRTHDAY, u.birthday);
    cv.put(UserInfo.DESCRIPTION, u.description);
    cv.put(UserInfo.PROFILE_IMAGE_URL, u.profileImageUrl);
    cv.put(UserInfo.URL, u.url);
    cv.put(UserInfo.PROTECTED, u.protect);
    cv.put(UserInfo.FOLLOWERS_COUNT, u.followersCount);
    cv.put(UserInfo.FRIENDS_COUNT, u.friendsCount);
    cv.put(UserInfo.FAVORITES_COUNT, u.favouritesCount);
    cv.put(UserInfo.STATUSES_COUNT, u.statusesCount);
    cv.put(UserInfo.FOLLOWING, u.following);
    return cv;
}

13. Memo#toUpdateContentValues()

Project: EverMemo
Source File: Memo.java
View license
public ContentValues toUpdateContentValues() {
    ContentValues values = new ContentValues();
    values.put("guid", mGuid);
    values.put("enid", mEnid);
    values.put("wallid", mWallId);
    values.put("orderid", mOrder);
    values.put("lastsynctime", mLastSyncTime);
    values.put("createdtime", mCreatedTime);
    values.put("updatedtime", mUpdatedTime);
    values.put("status", mStatus);
    values.put("attributes", mAttributes);
    values.put("content", mContent);
    values.put("hash", mHash);
    values.put("cursorposition", mCursorPosition);
    values.put("syncstatus", mSyncStatus);
    return values;
}

14. Memo#toInsertContentValues()

Project: EverMemo
Source File: Memo.java
View license
public ContentValues toInsertContentValues() {
    ContentValues values = new ContentValues();
    values.put("guid", mGuid);
    values.put("enid", mEnid);
    values.put("wallid", mWallId);
    values.put("orderid", mOrder);
    values.put("lastsynctime", mLastSyncTime);
    values.put("createdtime", mCreatedTime);
    values.put("updatedtime", mUpdatedTime);
    values.put("status", mStatus);
    values.put("attributes", mAttributes);
    values.put("content", mContent);
    values.put("hash", mHash);
    values.put("cursorposition", mCursorPosition);
    values.put("syncstatus", mSyncStatus);
    return values;
}

15. EventDetailsDBHandler#updateRow()

View license
public void updateRow(EventDetails event, int id) {
    ContentValues values = new ContentValues();
    values.put(COLUMN_TIME_STAMP, event.get_TimeStamp());
    values.put(COLUMN_NAME, event.get_EventName());
    values.put(COLUMN_PLACE, event.get_EventPlace());
    values.put(COLUMN_START_DATE_TIME, event.get_StartDateTime());
    values.put(COLUMN_END_DATE_TIME, event.get_EndDateTime());
    values.put(COLUMN_REPETITION, event.get_Repetition());
    values.put(COLUMN_TYPE, event.get_Type());
    values.put(COLUMN_REGN_PLACE, event.get_Regn_Place());
    values.put(COLUMN_WEBSITE, event.get_Website());
    values.put(COLUMN_DEADLINE_DATE_TIME, event.get_DeadlineDateTime());
    values.put(COLUMN_COMMENTS, event.get_Comments());
    values.put(COLUMN_STARTS_FROM, event.get_StartsFromDailyOrWeekly());
    values.put(COLUMN_ENDS_ON, event.get_EndsFromDailyOrWeekly());
    SQLiteDatabase db = getWritableDatabase();
    String where = COLUMN_ID + "='" + id + "'";
    db.update(TABLE_NAME, values, where, null);
    db.close();
}

16. EventDetailsDBHandler#insertRow()

View license
public void insertRow(EventDetails event) {
    ContentValues values = new ContentValues();
    values.put(COLUMN_TIME_STAMP, event.get_TimeStamp());
    values.put(COLUMN_NAME, event.get_EventName());
    values.put(COLUMN_PLACE, event.get_EventPlace());
    values.put(COLUMN_START_DATE_TIME, event.get_StartDateTime());
    values.put(COLUMN_END_DATE_TIME, event.get_EndDateTime());
    values.put(COLUMN_REPETITION, event.get_Repetition());
    values.put(COLUMN_TYPE, event.get_Type());
    values.put(COLUMN_REGN_PLACE, event.get_Regn_Place());
    values.put(COLUMN_WEBSITE, event.get_Website());
    values.put(COLUMN_DEADLINE_DATE_TIME, event.get_DeadlineDateTime());
    values.put(COLUMN_COMMENTS, event.get_Comments());
    values.put(COLUMN_STARTS_FROM, event.get_StartsFromDailyOrWeekly());
    values.put(COLUMN_ENDS_ON, event.get_EndsFromDailyOrWeekly());
    SQLiteDatabase db = getWritableDatabase();
    db.insert(TABLE_NAME, null, values);
    db.close();
}

17. Account#getContentValues()

Project: Conversations
Source File: Account.java
View license
@Override
public ContentValues getContentValues() {
    final ContentValues values = new ContentValues();
    values.put(UUID, uuid);
    values.put(USERNAME, jid.getLocalpart());
    values.put(SERVER, jid.getDomainpart());
    values.put(PASSWORD, password);
    values.put(OPTIONS, options);
    values.put(KEYS, this.keys.toString());
    values.put(ROSTERVERSION, rosterVersion);
    values.put(AVATAR, avatar);
    values.put(DISPLAY_NAME, displayName);
    values.put(HOSTNAME, hostname);
    values.put(PORT, port);
    values.put(STATUS, presenceStatus.toShowString());
    values.put(STATUS_MESSAGE, presenceStatusMessage);
    return values;
}

18. DataAction#addDataRecord()

Project: Tweetin
Source File: DataAction.java
View license
public void addDataRecord(DataRecord record, String targetTable) {
    ContentValues values = new ContentValues();
    values.put(DataUnit.AVATAR_URL, record.getAvatarURL());
    values.put(DataUnit.NAME, record.getName());
    values.put(DataUnit.SCREEN_NAME, record.getScreenName());
    values.put(DataUnit.CREATED_AT, record.getCreatedAt());
    values.put(DataUnit.CHECK_IN, record.getCheckIn());
    values.put(DataUnit.PROTECT, String.valueOf(record.isProtect()));
    values.put(DataUnit.PICTURE_URL, record.getPictureURL());
    values.put(DataUnit.TEXT, record.getText());
    values.put(DataUnit.RETWEETED_BY_NAME, record.getRetweetedByName());
    values.put(DataUnit.FAVORITE, String.valueOf(record.isFavorite()));
    values.put(DataUnit.STATUS_ID, record.getStatusId());
    values.put(DataUnit.IN_REPLY_TO_STATUS_ID, record.getInReplyToStatusId());
    values.put(DataUnit.RETWEETED_BY_SCREEN_NAME, record.getRetweetedByScreenName());
    database.insert(targetTable, null, values);
}

19. MediaDatabase#addMedia()

Project: VCL-Android
Source File: MediaDatabase.java
View license
/**
     * Add a new media to the database. The picture can only added by update.
     * @param media which you like to add to the database
     */
public synchronized void addMedia(MediaWrapper media) {
    ContentValues values = new ContentValues();
    values.put(MEDIA_LOCATION, media.getUri().toString());
    values.put(MEDIA_TIME, media.getTime());
    values.put(MEDIA_LENGTH, media.getLength());
    values.put(MEDIA_TYPE, media.getType());
    values.put(MEDIA_TITLE, media.getTitle());
    safePut(values, MEDIA_ARTIST, media.getArtist());
    safePut(values, MEDIA_GENRE, media.getGenre());
    safePut(values, MEDIA_ALBUM, media.getAlbum());
    safePut(values, MEDIA_ALBUMARTIST, media.getAlbumArtist());
    values.put(MEDIA_WIDTH, media.getWidth());
    values.put(MEDIA_HEIGHT, media.getHeight());
    values.put(MEDIA_ARTWORKURL, media.getArtworkURL());
    values.put(MEDIA_AUDIOTRACK, media.getAudioTrack());
    values.put(MEDIA_SPUTRACK, media.getSpuTrack());
    values.put(MEDIA_TRACKNUMBER, media.getTrackNumber());
    values.put(MEDIA_DISCNUMBER, media.getDiscNumber());
    values.put(MEDIA_LAST_MODIFIED, media.getLastModified());
    mDb.replace(MEDIA_TABLE_NAME, "NULL", values);
}

20. BookmarkManager#AddBookmark()

Project: PinDroid
Source File: BookmarkManager.java
View license
public static void AddBookmark(Bookmark bookmark, String account, Context context) {
    final String url = bookmark.getUrl();
    String hash = "";
    if (bookmark.getHash() == null || bookmark.getHash() == "") {
        hash = Md5Hash.md5(url);
    } else
        hash = bookmark.getHash();
    final ContentValues values = new ContentValues();
    values.put(Bookmark.Description, bookmark.getDescription());
    values.put(Bookmark.Url, url);
    values.put(Bookmark.Notes, bookmark.getNotes());
    values.put(Bookmark.Tags, bookmark.getTagString());
    values.put(Bookmark.Hash, hash);
    values.put(Bookmark.Meta, bookmark.getMeta());
    values.put(Bookmark.Time, bookmark.getTime());
    values.put(Bookmark.Account, account);
    values.put(Bookmark.ToRead, bookmark.getToRead() ? 1 : 0);
    values.put(Bookmark.Shared, bookmark.getShared() ? 1 : 0);
    values.put(Bookmark.Synced, 0);
    values.put(Bookmark.Deleted, 0);
    context.getContentResolver().insert(Bookmark.CONTENT_URI, values);
}

21. ImageFileUtil#addPicutureToResolver()

Project: bither-android
Source File: ImageFileUtil.java
View license
private static void addPicutureToResolver(File file, String pictureName, int orientation, long timeInMillis) {
    ContentValues v = new ContentValues();
    v.put(MediaStore.MediaColumns.TITLE, pictureName);
    v.put(MediaStore.MediaColumns.DISPLAY_NAME, pictureName);
    v.put(MediaStore.Images.ImageColumns.DESCRIPTION, "Taken with Picamera.");
    v.put(MediaStore.MediaColumns.DATE_ADDED, timeInMillis);
    v.put(MediaStore.Images.ImageColumns.DATE_TAKEN, timeInMillis);
    v.put(MediaStore.MediaColumns.DATE_MODIFIED, timeInMillis);
    v.put(MediaStore.MediaColumns.MIME_TYPE, "image/jpeg");
    v.put(MediaStore.Images.ImageColumns.ORIENTATION, orientation);
    v.put(MediaStore.MediaColumns.DATA, file.getAbsolutePath());
    File parent = file.getParentFile();
    String path = parent.toString().toLowerCase();
    String name = parent.getName().toLowerCase();
    v.put(MediaStore.Images.ImageColumns.BUCKET_ID, path.hashCode());
    v.put(MediaStore.Images.ImageColumns.BUCKET_DISPLAY_NAME, name);
    v.put(MediaStore.MediaColumns.SIZE, file.length());
    ContentResolver c = BitherApplication.mContext.getContentResolver();
    if (c != null) {
        c.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, v);
    }
}

22. KontalkGroupCommands#leaveGroup()

View license
public static Uri leaveGroup(Context context, long threadId, String groupJid, String msgId, boolean encrypted, boolean fakeSend) {
    ContentValues values = new ContentValues();
    values.put(MyMessages.Messages.THREAD_ID, threadId);
    values.put(MyMessages.Messages.MESSAGE_ID, msgId);
    values.put(MyMessages.Messages.PEER, groupJid);
    values.put(MyMessages.Messages.BODY_MIME, GroupCommandComponent.MIME_TYPE);
    values.put(MyMessages.Messages.BODY_CONTENT, GroupCommandComponent.getLeaveCommandBodyContent().getBytes());
    values.put(MyMessages.Messages.BODY_LENGTH, 0);
    values.put(MyMessages.Messages.UNREAD, false);
    values.put(MyMessages.Messages.DIRECTION, MyMessages.Messages.DIRECTION_OUT);
    values.put(MyMessages.Messages.TIMESTAMP, System.currentTimeMillis());
    values.put(MyMessages.Messages.STATUS, fakeSend ? MyMessages.Messages.STATUS_SENT : MyMessages.Messages.STATUS_SENDING);
    // of course outgoing messages are not encrypted in database
    values.put(MyMessages.Messages.ENCRYPTED, false);
    values.put(MyMessages.Messages.SECURITY_FLAGS, encrypted ? Coder.SECURITY_BASIC : Coder.SECURITY_CLEARTEXT);
    return context.getContentResolver().insert(MyMessages.Messages.CONTENT_URI, values);
}

23. KontalkGroupCommands#setGroupSubject()

View license
public static Uri setGroupSubject(Context context, long threadId, String groupJid, String subject, String msgId, boolean encrypted, boolean fakeSend) {
    ContentValues values = new ContentValues();
    values.put(MyMessages.Messages.THREAD_ID, threadId);
    values.put(MyMessages.Messages.MESSAGE_ID, msgId);
    values.put(MyMessages.Messages.PEER, groupJid);
    values.put(MyMessages.Messages.BODY_MIME, GroupCommandComponent.MIME_TYPE);
    values.put(MyMessages.Messages.BODY_CONTENT, GroupCommandComponent.getSetSubjectCommandBodyContent(subject).getBytes());
    values.put(MyMessages.Messages.BODY_LENGTH, 0);
    values.put(MyMessages.Messages.UNREAD, false);
    values.put(MyMessages.Messages.DIRECTION, MyMessages.Messages.DIRECTION_OUT);
    values.put(MyMessages.Messages.TIMESTAMP, System.currentTimeMillis());
    values.put(MyMessages.Messages.STATUS, fakeSend ? MyMessages.Messages.STATUS_SENT : MyMessages.Messages.STATUS_SENDING);
    // of course outgoing messages are not encrypted in database
    values.put(MyMessages.Messages.ENCRYPTED, false);
    values.put(MyMessages.Messages.SECURITY_FLAGS, encrypted ? Coder.SECURITY_BASIC : Coder.SECURITY_CLEARTEXT);
    return context.getContentResolver().insert(MyMessages.Messages.CONTENT_URI, values);
}

24. KontalkGroupCommands#removeGroupMembers()

View license
public static Uri removeGroupMembers(Context context, long threadId, String groupJid, String[] members, String msgId, boolean encrypted) {
    ContentValues values = new ContentValues();
    values.put(MyMessages.Messages.THREAD_ID, threadId);
    values.put(MyMessages.Messages.MESSAGE_ID, msgId);
    values.put(MyMessages.Messages.PEER, groupJid);
    values.put(MyMessages.Messages.BODY_MIME, GroupCommandComponent.MIME_TYPE);
    values.put(MyMessages.Messages.BODY_CONTENT, GroupCommandComponent.getRemoveMembersBodyContent(members).getBytes());
    values.put(MyMessages.Messages.BODY_LENGTH, 0);
    values.put(MyMessages.Messages.UNREAD, false);
    values.put(MyMessages.Messages.DIRECTION, MyMessages.Messages.DIRECTION_OUT);
    values.put(MyMessages.Messages.TIMESTAMP, System.currentTimeMillis());
    values.put(MyMessages.Messages.STATUS, MyMessages.Messages.STATUS_SENDING);
    // of course outgoing messages are not encrypted in database
    values.put(MyMessages.Messages.ENCRYPTED, false);
    values.put(MyMessages.Messages.SECURITY_FLAGS, encrypted ? Coder.SECURITY_BASIC : Coder.SECURITY_CLEARTEXT);
    return context.getContentResolver().insert(MyMessages.Messages.CONTENT_URI, values);
}

25. KontalkGroupCommands#addGroupMembers()

View license
public static Uri addGroupMembers(Context context, long threadId, String groupJid, String[] members, String msgId, boolean encrypted) {
    ContentValues values = new ContentValues();
    values.put(MyMessages.Messages.THREAD_ID, threadId);
    values.put(MyMessages.Messages.MESSAGE_ID, msgId);
    values.put(MyMessages.Messages.PEER, groupJid);
    values.put(MyMessages.Messages.BODY_MIME, GroupCommandComponent.MIME_TYPE);
    values.put(MyMessages.Messages.BODY_CONTENT, GroupCommandComponent.getAddMembersBodyContent(members).getBytes());
    values.put(MyMessages.Messages.BODY_LENGTH, 0);
    values.put(MyMessages.Messages.UNREAD, false);
    values.put(MyMessages.Messages.DIRECTION, MyMessages.Messages.DIRECTION_OUT);
    values.put(MyMessages.Messages.TIMESTAMP, System.currentTimeMillis());
    values.put(MyMessages.Messages.STATUS, MyMessages.Messages.STATUS_SENDING);
    // of course outgoing messages are not encrypted in database
    values.put(MyMessages.Messages.ENCRYPTED, false);
    values.put(MyMessages.Messages.SECURITY_FLAGS, encrypted ? Coder.SECURITY_BASIC : Coder.SECURITY_CLEARTEXT);
    return context.getContentResolver().insert(MyMessages.Messages.CONTENT_URI, values);
}

26. KontalkGroupCommands#createGroup()

View license
public static Uri createGroup(Context context, long threadId, String groupJid, String[] members, String msgId, boolean encrypted) {
    ContentValues values = new ContentValues();
    values.put(MyMessages.Messages.THREAD_ID, threadId);
    values.put(MyMessages.Messages.MESSAGE_ID, msgId);
    values.put(MyMessages.Messages.PEER, groupJid);
    values.put(MyMessages.Messages.BODY_MIME, GroupCommandComponent.MIME_TYPE);
    values.put(MyMessages.Messages.BODY_CONTENT, GroupCommandComponent.getCreateBodyContent(members).getBytes());
    values.put(MyMessages.Messages.BODY_LENGTH, 0);
    values.put(MyMessages.Messages.UNREAD, false);
    values.put(MyMessages.Messages.DIRECTION, MyMessages.Messages.DIRECTION_OUT);
    values.put(MyMessages.Messages.TIMESTAMP, System.currentTimeMillis());
    values.put(MyMessages.Messages.STATUS, MyMessages.Messages.STATUS_SENDING);
    // of course outgoing messages are not encrypted in database
    values.put(MyMessages.Messages.ENCRYPTED, false);
    values.put(MyMessages.Messages.SECURITY_FLAGS, encrypted ? Coder.SECURITY_BASIC : Coder.SECURITY_CLEARTEXT);
    return context.getContentResolver().insert(MyMessages.Messages.CONTENT_URI, values);
}

27. HostFactory#updateHost()

Project: android-xbmcremote
Source File: HostFactory.java
View license
/**
	 * Updates a host
	 * @param context Reference to context
	 * @param host Host to update
	 */
public static void updateHost(Context context, Host host) {
    ContentValues values = new ContentValues();
    values.put(HostProvider.Hosts.NAME, host.name);
    values.put(HostProvider.Hosts.ADDR, host.addr);
    values.put(HostProvider.Hosts.PORT, host.port);
    values.put(HostProvider.Hosts.USER, host.user);
    values.put(HostProvider.Hosts.PASS, host.pass);
    values.put(HostProvider.Hosts.ESPORT, host.esPort);
    values.put(HostProvider.Hosts.TIMEOUT, host.timeout);
    values.put(HostProvider.Hosts.WIFI_ONLY, host.wifi_only ? 1 : 0);
    values.put(HostProvider.Hosts.MAC_ADDR, host.mac_addr);
    values.put(HostProvider.Hosts.ACCESS_POINT, host.access_point);
    values.put(HostProvider.Hosts.WOL_PORT, host.wol_port);
    values.put(HostProvider.Hosts.WOL_WAIT, host.wol_wait);
    context.getContentResolver().update(HostProvider.Hosts.CONTENT_URI, values, HostProvider.Hosts._ID + "=" + host.id, null);
}

28. HostFactory#addHost()

Project: android-xbmcremote
Source File: HostFactory.java
View license
/**
	 * Adds a host to the database.
	 * @param context Reference to context
	 * @param host Host to add
	 */
public static void addHost(Context context, Host host) {
    ContentValues values = new ContentValues();
    values.put(HostProvider.Hosts.NAME, host.name);
    values.put(HostProvider.Hosts.ADDR, host.addr);
    values.put(HostProvider.Hosts.PORT, host.port);
    values.put(HostProvider.Hosts.USER, host.user);
    values.put(HostProvider.Hosts.PASS, host.pass);
    values.put(HostProvider.Hosts.ESPORT, host.esPort);
    values.put(HostProvider.Hosts.TIMEOUT, host.timeout);
    values.put(HostProvider.Hosts.WIFI_ONLY, host.wifi_only ? 1 : 0);
    values.put(HostProvider.Hosts.MAC_ADDR, host.mac_addr);
    values.put(HostProvider.Hosts.ACCESS_POINT, host.access_point);
    values.put(HostProvider.Hosts.WOL_PORT, host.wol_port);
    values.put(HostProvider.Hosts.WOL_WAIT, host.wol_wait);
    context.getContentResolver().insert(HostProvider.Hosts.CONTENT_URI, values);
}

29. DbAdapterTvShowEpisodes#createContentValues()

Project: Mizuu
Source File: DbAdapterTvShowEpisodes.java
View license
private ContentValues createContentValues(String season, String episode, String showId, String episodeTitle, String episodePlot, String episodeAirdate, String episodeRating, String episodeDirector, String episodeWriter, String episodeGuestStars, String hasWatched, String favorite) {
    ContentValues values = new ContentValues();
    values.put(KEY_SEASON, season);
    values.put(KEY_EPISODE, episode);
    values.put(KEY_SHOW_ID, showId);
    values.put(KEY_EPISODE_TITLE, episodeTitle);
    values.put(KEY_EPISODE_PLOT, episodePlot);
    values.put(KEY_EPISODE_AIRDATE, episodeAirdate);
    values.put(KEY_EPISODE_RATING, episodeRating);
    values.put(KEY_EPISODE_DIRECTOR, episodeDirector);
    values.put(KEY_EPISODE_WRITER, episodeWriter);
    values.put(KEY_EPISODE_GUESTSTARS, episodeGuestStars);
    values.put(KEY_HAS_WATCHED, hasWatched);
    values.put(KEY_FAVOURITE, favorite);
    return values;
}

30. SyncUtils#contentValuesFromAlbum()

Project: Kore
Source File: SyncUtils.java
View license
/**
     * Returns {@link android.content.ContentValues} from a {@link AudioType.DetailsAlbum} album
     * @param hostId Host id for the album
     * @param album {@link AudioType.DetailsAlbum}
     * @return {@link android.content.ContentValues} with the album values
     */
public static ContentValues contentValuesFromAlbum(int hostId, AudioType.DetailsAlbum album) {
    ContentValues castValues = new ContentValues();
    castValues.put(MediaContract.Albums.HOST_ID, hostId);
    castValues.put(MediaContract.Albums.ALBUMID, album.albumid);
    castValues.put(MediaContract.Albums.FANART, album.fanart);
    castValues.put(MediaContract.Albums.THUMBNAIL, album.thumbnail);
    castValues.put(MediaContract.Albums.DISPLAYARTIST, album.displayartist);
    castValues.put(MediaContract.Albums.RATING, album.rating);
    castValues.put(MediaContract.Albums.TITLE, album.title);
    castValues.put(MediaContract.Albums.YEAR, album.year);
    castValues.put(MediaContract.Albums.ALBUMLABEL, album.albumlabel);
    castValues.put(MediaContract.Albums.DESCRIPTION, album.description);
    castValues.put(MediaContract.Albums.PLAYCOUNT, album.playcount);
    castValues.put(MediaContract.Albums.GENRE, Utils.listStringConcat(album.genre, LIST_DELIMETER));
    return castValues;
}

31. DatabaseManager#addUserInfo()

View license
/**?????????????
     * @param info ???????????
     */
public static void addUserInfo(UserInfo info) {
    SQLiteDatabase db = DatabaseHelper.getInstance(YouJoinApplication.getAppContext());
    ContentValues contentValues = new ContentValues();
    contentValues.put(DatabaseHelper.USER_ID, info.getId());
    contentValues.put(DatabaseHelper.USER_NAME, info.getUsername());
    contentValues.put(DatabaseHelper.USER_EMAIL, info.getEmail());
    contentValues.put(DatabaseHelper.USER_SEX, info.getSex());
    contentValues.put(DatabaseHelper.USER_BIRTH, info.getBirth());
    contentValues.put(DatabaseHelper.USER_LOCATION, info.getLocation());
    contentValues.put(DatabaseHelper.USER_PHOTO, StringUtils.getPicUrlList(info.getImg_url()).get(0));
    contentValues.put(DatabaseHelper.USER_SIGN, info.getUsersign());
    contentValues.put(DatabaseHelper.USER_WORK, info.getWork());
    contentValues.put(DatabaseHelper.USER_NICKNAME, info.getNickname());
    contentValues.put(DatabaseHelper.FOCUS_NUM, info.getFocus_num());
    contentValues.put(DatabaseHelper.FOLLOW_NUM, info.getFollow_num());
    if (getUserInfoById(info.getId()).getResult().equals(NetworkManager.SUCCESS)) {
        db.update(DatabaseHelper.TABLE_USER_INFO, contentValues, DatabaseHelper.USER_ID + " = ?", new String[] { Integer.toString(info.getId()) });
    } else {
        db.insert(DatabaseHelper.TABLE_USER_INFO, null, contentValues);
    }
}

32. SQLiteUsersConnectionRepositoryTest#insertFacebookConnectionSameFacebookUser()

View license
private void insertFacebookConnectionSameFacebookUser() {
    ContentValues values = new ContentValues();
    values.put("userId", "2");
    values.put("providerId", "facebook");
    values.put("providerUserId", "9");
    values.put("rank", 1);
    values.putNull("displayName");
    values.putNull("profileUrl");
    values.putNull("imageUrl");
    values.put("accessToken", encrypt("234567890"));
    values.putNull("secret");
    values.put("refreshToken", encrypt("345678901"));
    values.put("expireTime", System.currentTimeMillis() + 3600000);
    insertConnection(values);
}

33. SQLiteUsersConnectionRepositoryTest#insertFacebookConnection3()

View license
private void insertFacebookConnection3() {
    ContentValues values = new ContentValues();
    values.put("userId", "2");
    values.put("providerId", "facebook");
    values.put("providerUserId", "11");
    values.put("rank", 2);
    values.putNull("displayName");
    values.putNull("profileUrl");
    values.putNull("imageUrl");
    values.put("accessToken", encrypt("456789012"));
    values.putNull("secret");
    values.put("refreshToken", encrypt("56789012"));
    values.put("expireTime", System.currentTimeMillis() + 3600000);
    insertConnection(values);
}

34. SQLiteUsersConnectionRepositoryTest#insertFacebookConnection2()

View license
private void insertFacebookConnection2() {
    ContentValues values = new ContentValues();
    values.put("userId", "1");
    values.put("providerId", "facebook");
    values.put("providerUserId", "10");
    values.put("rank", 2);
    values.putNull("displayName");
    values.putNull("profileUrl");
    values.putNull("imageUrl");
    values.put("accessToken", encrypt("456789012"));
    values.putNull("secret");
    values.put("refreshToken", encrypt("56789012"));
    values.put("expireTime", System.currentTimeMillis() + 3600000);
    insertConnection(values);
}

35. SQLiteUsersConnectionRepositoryTest#insertFacebookConnection()

View license
private void insertFacebookConnection() {
    ContentValues values = new ContentValues();
    values.put("userId", "1");
    values.put("providerId", "facebook");
    values.put("providerUserId", "9");
    values.put("rank", 1);
    values.putNull("displayName");
    values.putNull("profileUrl");
    values.putNull("imageUrl");
    values.put("accessToken", encrypt("234567890"));
    values.putNull("secret");
    values.put("refreshToken", encrypt("345678901"));
    values.put("expireTime", System.currentTimeMillis() + 3600000);
    insertConnection(values);
}

36. SQLiteUsersConnectionRepositoryTest#insertTwitterConnection()

View license
// helpers
private void insertTwitterConnection() {
    ContentValues values = new ContentValues();
    values.put("userId", "1");
    values.put("providerId", "twitter");
    values.put("providerUserId", "1");
    values.put("rank", 1);
    values.put("displayName", "@kdonald");
    values.put("profileUrl", "http://twitter.com/kdonald");
    values.put("imageUrl", "http://twitter.com/kdonald/picture");
    values.put("accessToken", encrypt("123456789"));
    values.put("secret", encrypt("987654321"));
    values.putNull("refreshToken");
    values.putNull("expireTime");
    insertConnection(values);
}

37. Database#addServer()

Project: Yaaic
Source File: Database.java
View license
/**
     * Add a new server to the database
     * 
     * @param server     The server to add.
     * @param identityId The id of the assigned identity
     */
public long addServer(Server server, int identityId) {
    ContentValues values = new ContentValues();
    values.put(ServerConstants.TITLE, server.getTitle());
    values.put(ServerConstants.HOST, server.getHost());
    values.put(ServerConstants.PORT, server.getPort());
    values.put(ServerConstants.PASSWORD, server.getPassword());
    values.put(ServerConstants.AUTOCONNECT, false);
    values.put(ServerConstants.USE_SSL, server.useSSL());
    values.put(ServerConstants.IDENTITY, identityId);
    values.put(ServerConstants.CHARSET, server.getCharset());
    Authentication authentication = server.getAuthentication();
    values.put(ServerConstants.NICKSERV_PASSWORD, authentication.getNickservPassword());
    values.put(ServerConstants.SASL_USERNAME, authentication.getSaslUsername());
    values.put(ServerConstants.SASL_PASSWORD, authentication.getSaslPassword());
    return this.getWritableDatabase().insert(ServerConstants.TABLE_NAME, null, values);
}

38. SiteSettingsModel#serializeToDatabase()

View license
/**
     * Creates the {@link ContentValues} object to store this category data in a local database.
     */
public ContentValues serializeToDatabase() {
    ContentValues values = new ContentValues();
    values.put(ID_COLUMN_NAME, localTableId);
    values.put(ADDRESS_COLUMN_NAME, address);
    values.put(USERNAME_COLUMN_NAME, username);
    values.put(PASSWORD_COLUMN_NAME, password);
    values.put(TITLE_COLUMN_NAME, title);
    values.put(TAGLINE_COLUMN_NAME, tagline);
    values.put(PRIVACY_COLUMN_NAME, privacy);
    values.put(LANGUAGE_COLUMN_NAME, languageId);
    values.put(LOCATION_COLUMN_NAME, location);
    values.put(DEF_CATEGORY_COLUMN_NAME, defaultCategory);
    values.put(CATEGORIES_COLUMN_NAME, categoryIdList(categories));
    values.put(DEF_POST_FORMAT_COLUMN_NAME, defaultPostFormat);
    values.put(POST_FORMATS_COLUMN_NAME, postFormatList(postFormats));
    values.put(CREDS_VERIFIED_COLUMN_NAME, hasVerifiedCredentials);
    values.put(RELATED_POSTS_COLUMN_NAME, getRelatedPostsFlags());
    values.put(ALLOW_COMMENTS_COLUMN_NAME, allowComments);
    values.put(SEND_PINGBACKS_COLUMN_NAME, sendPingbacks);
    values.put(RECEIVE_PINGBACKS_COLUMN_NAME, receivePingbacks);
    values.put(SHOULD_CLOSE_AFTER_COLUMN_NAME, shouldCloseAfter);
    values.put(CLOSE_AFTER_COLUMN_NAME, closeCommentAfter);
    values.put(SORT_BY_COLUMN_NAME, sortCommentsBy);
    values.put(SHOULD_THREAD_COLUMN_NAME, shouldThreadComments);
    values.put(THREADING_COLUMN_NAME, threadingLevels);
    values.put(SHOULD_PAGE_COLUMN_NAME, shouldPageComments);
    values.put(PAGING_COLUMN_NAME, commentsPerPage);
    values.put(MANUAL_APPROVAL_COLUMN_NAME, commentApprovalRequired);
    values.put(IDENTITY_REQUIRED_COLUMN_NAME, commentsRequireIdentity);
    values.put(USER_ACCOUNT_REQUIRED_COLUMN_NAME, commentsRequireUserAccount);
    values.put(WHITELIST_COLUMN_NAME, commentAutoApprovalKnownUsers);
    String moderationKeys = "";
    if (holdForModeration != null) {
        for (String key : holdForModeration) {
            moderationKeys += key + "\n";
        }
    }
    String blacklistKeys = "";
    if (blacklist != null) {
        for (String key : blacklist) {
            blacklistKeys += key + "\n";
        }
    }
    values.put(MODERATION_KEYS_COLUMN_NAME, moderationKeys);
    values.put(BLACKLIST_KEYS_COLUMN_NAME, blacklistKeys);
    return values;
}

39. CommentTable#addComment()

Project: WordPress-Android
Source File: CommentTable.java
View license
/**
     * add a single comment - will update existing comment with same IDs
     * @param localBlogId - unique id in account table for the blog the comment is from
     * @param comment - comment object to store
     */
public static void addComment(int localBlogId, final Comment comment) {
    if (comment == null)
        return;
    ContentValues values = new ContentValues();
    values.put("blog_id", localBlogId);
    values.put("post_id", comment.postID);
    values.put("comment_id", comment.commentID);
    values.put("author_name", comment.getAuthorName());
    values.put("author_url", comment.getAuthorUrl());
    values.put("comment", SqlUtils.maxSQLiteText(comment.getCommentText()));
    values.put("status", comment.getStatus());
    values.put("author_email", comment.getAuthorEmail());
    values.put("post_title", comment.getPostTitle());
    values.put("published", comment.getPublished());
    values.put("profile_image_url", comment.getProfileImageUrl());
    getWritableDb().insertWithOnConflict(COMMENTS_TABLE, null, values, SQLiteDatabase.CONFLICT_REPLACE);
}

40. DatabaseManager#addUser()

View license
private void addUser(User user) {
    ContentValues values = new ContentValues();
    values.put(UsersTable.COLUMN_NAME_USERNAME, user.getUsername());
    values.put(UsersTable.COLUMN_NAME_GRAVATAR, user.getGravatar());
    values.put(UsersTable.COLUMN_NAME_LEVEL, user.getLevel());
    values.put(UsersTable.COLUMN_NAME_TITLE, user.getTitle());
    values.put(UsersTable.COLUMN_NAME_ABOUT, user.getAbout());
    values.put(UsersTable.COLUMN_NAME_WEBSITE, user.getWebsite());
    values.put(UsersTable.COLUMN_NAME_TWITTER, user.getTwitter());
    values.put(UsersTable.COLUMN_NAME_TOPICS_COUNT, user.getTopicsCount());
    values.put(UsersTable.COLUMN_NAME_POSTS_COUNT, user.getPostsCount());
    values.put(UsersTable.COLUMN_NAME_CREATION_DATE, user.getCreationDateInSeconds());
    values.put(UsersTable.COLUMN_NAME_VACATION_DATE, user.getVacationDateInSeconds());
    db.insert(UsersTable.TABLE_NAME, UsersTable.COLUMN_NAME_NULLABLE, values);
}

41. Transaction#asContentValues()

Project: financius-public
Source File: Transaction.java
View license
@Override
public ContentValues asContentValues() {
    final ContentValues values = super.asContentValues();
    values.put(Tables.Transactions.ACCOUNT_FROM_ID.getName(), accountFrom == null ? null : accountFrom.getId());
    values.put(Tables.Transactions.ACCOUNT_TO_ID.getName(), accountTo == null ? null : accountTo.getId());
    values.put(Tables.Transactions.CATEGORY_ID.getName(), category == null ? null : category.getId());
    values.put(Tables.Transactions.DATE.getName(), date);
    values.put(Tables.Transactions.AMOUNT.getName(), amount);
    values.put(Tables.Transactions.EXCHANGE_RATE.getName(), exchangeRate);
    values.put(Tables.Transactions.NOTE.getName(), note);
    values.put(Tables.Transactions.STATE.getName(), transactionState.asInt());
    values.put(Tables.Transactions.TYPE.getName(), transactionType.asInt());
    values.put(Tables.Transactions.INCLUDE_IN_REPORTS.getName(), includeInReports);
    final StringBuilder sb = new StringBuilder();
    for (Tag tag : tags) {
        if (sb.length() > 0) {
            sb.append(Tables.CONCAT_SEPARATOR);
        }
        sb.append(tag.getId());
    }
    values.put(Tables.Tags.ID.getName(), sb.toString());
    return values;
}

42. SipProfileState#getAsContentValue()

Project: CSipSimple
Source File: SipProfileState.java
View license
/**
     * Should not be used for external use of the API.
     * Produce content value from the wrapper.
     * 
     * @return Complete content values from the current wrapper around sip
     *         profile state.
     */
public ContentValues getAsContentValue() {
    ContentValues cv = new ContentValues();
    cv.put(ACCOUNT_ID, databaseId);
    cv.put(ACTIVE, active);
    cv.put(ADDED_STATUS, addedStatus);
    cv.put(DISPLAY_NAME, displayName);
    cv.put(EXPIRES, expires);
    cv.put(PJSUA_ID, pjsuaId);
    cv.put(PRIORITY, priority);
    cv.put(REG_URI, regUri);
    cv.put(STATUS_CODE, statusCode);
    cv.put(STATUS_TEXT, statusText);
    cv.put(WIZARD, wizard);
    return cv;
}

43. MessagesProviderUtils#newOutgoingMessage()

View license
/** Inserts a new outgoing text message. */
public static Uri newOutgoingMessage(Context context, String msgId, String userId, String text, boolean encrypted) {
    byte[] bytes = text.getBytes();
    ContentValues values = new ContentValues(11);
    // must supply a message ID...
    values.put(Messages.MESSAGE_ID, msgId);
    values.put(Messages.PEER, userId);
    values.put(Messages.BODY_MIME, TextComponent.MIME_TYPE);
    values.put(Messages.BODY_CONTENT, bytes);
    values.put(Messages.BODY_LENGTH, bytes.length);
    values.put(Messages.UNREAD, false);
    values.put(Messages.DIRECTION, Messages.DIRECTION_OUT);
    values.put(Messages.TIMESTAMP, System.currentTimeMillis());
    values.put(Messages.STATUS, Messages.STATUS_SENDING);
    // of course outgoing messages are not encrypted in database
    values.put(Messages.ENCRYPTED, false);
    values.put(Messages.SECURITY_FLAGS, encrypted ? Coder.SECURITY_BASIC : Coder.SECURITY_CLEARTEXT);
    return context.getContentResolver().insert(Messages.CONTENT_URI, values);
}

44. Task#convertToContentValues()

View license
public ContentValues convertToContentValues() {
    ContentValues contentValues = new ContentValues();
    if (id != 0)
        contentValues.put(TASKS.COLUMN_ID, id);
    contentValues.put(TASKS.COLUMN_NAME, name);
    contentValues.put(TASKS.COLUMN_SIZE, size);
    contentValues.put(TASKS.COLUMN_STATE, state);
    contentValues.put(TASKS.COLUMN_URL, url);
    contentValues.put(TASKS.COLUMN_PERCENT, percent);
    contentValues.put(TASKS.COLUMN_CHUNKS, chunks);
    contentValues.put(TASKS.COLUMN_NOTIFY, notify);
    contentValues.put(TASKS.COLUMN_RESUMABLE, resumable);
    contentValues.put(TASKS.COLUMN_SAVE_ADDRESS, save_address);
    contentValues.put(TASKS.COLUMN_EXTENSION, extension);
    contentValues.put(TASKS.COLUMN_PRIORITY, priority);
    return contentValues;
}

45. JsonImportTask#addMovieToDatabase()

Project: SeriesGuide
Source File: JsonImportTask.java
View license
private void addMovieToDatabase(Movie movie) {
    ContentValues values = new ContentValues();
    values.put(Movies.TMDB_ID, movie.tmdbId);
    values.put(Movies.IMDB_ID, movie.imdbId);
    values.put(Movies.TITLE, movie.title);
    values.put(Movies.TITLE_NOARTICLE, DBUtils.trimLeadingArticle(movie.title));
    values.put(Movies.RELEASED_UTC_MS, movie.releasedUtcMs);
    values.put(Movies.RUNTIME_MIN, movie.runtimeMin);
    values.put(Movies.POSTER, movie.poster);
    values.put(Movies.IN_COLLECTION, movie.inCollection);
    values.put(Movies.IN_WATCHLIST, movie.inWatchlist);
    values.put(Movies.WATCHED, movie.watched);
    // full dump values
    values.put(Movies.OVERVIEW, movie.overview);
    context.getContentResolver().insert(Movies.CONTENT_URI, values);
}

46. RemoteTask#getContent()

Project: NotePad
Source File: RemoteTask.java
View license
@Override
public ContentValues getContent() {
    final ContentValues values = new ContentValues();
    values.put(Columns.DBID, dbid);
    values.put(Columns.LISTDBID, listdbid);
    values.put(Columns.REMOTEID, remoteId);
    values.put(Columns.UPDATED, updated);
    values.put(Columns.ACCOUNT, account);
    values.put(Columns.SERVICE, service);
    values.put(Columns.DELETED, deleted);
    values.put(Columns.FIELD2, field2);
    values.put(Columns.FIELD3, field3);
    values.put(Columns.FIELD4, field4);
    values.put(Columns.FIELD5, field5);
    return values;
}

47. UserDao#save()

Project: YiBo
Source File: UserDao.java
View license
void save(SQLiteDatabase sqLiteDatabase, BaseUser user) {
    if (isNull(user)) {
        return;
    }
    if (Logger.isDebug()) {
        Log.d("Save User:", user.toString());
    }
    ContentValues values = new ContentValues();
    values.put("Service_Provider", user.getServiceProvider().getSpNo());
    values.put("User_Id", user.getUserId());
    values.put("Screen_Name", user.getScreenName());
    values.put("Name", user.getName());
    values.put("Gender", user.getGender() == null ? Gender.Unkown.getGenderNo() : user.getGender().getGenderNo());
    values.put("Location", user.getLocation());
    values.put("Description", user.getDescription());
    values.put("Verified", user.isVerified());
    values.put("Profile_Image_Url", user.getProfileImageUrl());
    values.put("Created_At", user.getCreatedAt() == null ? 0 : user.getCreatedAt().getTime());
    sqLiteDatabase.replace(TABLE, null, values);
}

48. ForumDbHelper#forumToContentValues()

Project: XDA-One
Source File: ForumDbHelper.java
View license
private static ContentValues forumToContentValues(final ResponseForum forum) {
    final ContentValues values = new ContentValues();
    values.put(ForumEntry.COLUMN_NAME_TITLE, forum.getTitle());
    values.put(ForumEntry.COLUMN_NAME_FORUMID, forum.getForumId());
    values.put(ForumEntry.COLUMN_NAME_PARENTID, forum.getParentId());
    values.put(ForumEntry.COLUMN_NAME_FORUMSLUG, forum.getForumSlug());
    values.put(ForumEntry.COLUMN_NAME_SUBSCRIBED, forum.isSubscribed());
    values.put(ForumEntry.COLUMN_NAME_IMAGE, forum.getImageUrl());
    values.put(ForumEntry.COLUMN_NAME_SEARCHABLE, forum.getSearchable());
    values.put(ForumEntry.COLUMN_NAME_CAN_CONTAIN_THREADS, forum.canContainThreads());
    values.put(ForumEntry.COLUMN_NAME_WEB_URI, forum.getWebUri());
    values.put(ForumEntry.COLUMN_NAME_CHILDREN_COUNT, forum.getChildren().size());
    return values;
}

49. SqlDBOperate#updateUserInfo()

Project: WifiChat
Source File: SqlDBOperate.java
View license
/*
     * ???userInfo? ???????????
     */
public void updateUserInfo(UserInfo user) {
    // db=helper.getWritableDatabase();
    ContentValues values = new ContentValues();
    values.put("name", user.getName());
    values.put("sex", user.getSex());
    values.put("age", user.getAge());
    values.put("IMEI", user.getIMEI());
    values.put("ip", user.getIPAddr());
    values.put("status", user.getIsOnline());
    values.put("avater", user.getAvater());
    values.put("lastdate", user.getLastDate());
    values.put("device", user.getDevice());
    values.put("constellation", user.getConstellation());
    userDataBase.update(userSQLHelper.getTableName(), values, "id = ?", new String[] { String.valueOf(user.getId()) });
}

50. SqlDBOperate#addUserInfo()

Project: WifiChat
Source File: SqlDBOperate.java
View license
/* ??????????,??????(0) */
public void addUserInfo(Users people) {
    ContentValues values = new ContentValues();
    values.put("name", people.getNickname());
    values.put("sex", people.getGender());
    values.put("age", people.getAge());
    values.put("IMEI", people.getIMEI());
    values.put("ip", people.getIpaddress());
    values.put("status", people.getOnlineStateInt());
    values.put("avater", people.getAvatar());
    values.put("lastdate", people.getLogintime());
    values.put("device", people.getDevice());
    values.put("constellation", people.getConstellation());
    int id = getIDByIMEI(people.getIMEI());
    if (id != 0) {
        userDataBase.update(userSQLHelper.getTableName(), values, "id = ?", new String[] { String.valueOf(id) });
    } else
        userDataBase.insert(userSQLHelper.getTableName(), "id", values);
}

51. SqlDBOperate#addUserInfo()

Project: WifiChat
Source File: SqlDBOperate.java
View license
/*
     * ???userInfo? ???????????
     */
public void addUserInfo(UserInfo user) {
    ContentValues values = new ContentValues();
    values.put("name", user.getName());
    values.put("sex", user.getSex());
    values.put("age", user.getAge());
    values.put("IMEI", user.getIMEI());
    values.put("ip", user.getIPAddr());
    values.put("status", user.getIsOnline());
    values.put("avater", user.getAvater());
    values.put("lastdate", user.getLastDate());
    values.put("device", user.getDevice());
    values.put("constellation", user.getConstellation());
    int id = getIDByIMEI(user.getIMEI());
    if (id != 0) {
        user.setId(id);
        updateUserInfo(user);
    } else
        userDataBase.insert(userSQLHelper.getTableName(), "id", values);
}

52. TestUtilities#createWeatherValues()

View license
/*
        Students: Use this to create some default weather values for your database tests.
     */
static ContentValues createWeatherValues(long locationRowId) {
    ContentValues weatherValues = new ContentValues();
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_LOC_KEY, locationRowId);
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_DATE, TEST_DATE);
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_DEGREES, 1.1);
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_HUMIDITY, 1.2);
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_PRESSURE, 1.3);
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_MAX_TEMP, 75);
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_MIN_TEMP, 65);
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_SHORT_DESC, "Asteroids");
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_WIND_SPEED, 5.5);
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_WEATHER_ID, 321);
    return weatherValues;
}

53. TestUtilities#createWeatherValues()

View license
/*
        Students: Use this to create some default weather values for your database tests.
     */
static ContentValues createWeatherValues(long locationRowId) {
    ContentValues weatherValues = new ContentValues();
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_LOC_KEY, locationRowId);
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_DATE, TEST_DATE);
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_DEGREES, 1.1);
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_HUMIDITY, 1.2);
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_PRESSURE, 1.3);
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_MAX_TEMP, 75);
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_MIN_TEMP, 65);
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_SHORT_DESC, "Asteroids");
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_WIND_SPEED, 5.5);
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_WEATHER_ID, 321);
    return weatherValues;
}

54. ScrobblesDatabase#insertTrack()

Project: sls
Source File: ScrobblesDatabase.java
View license
/**
	 * Return the new rowId for that scrobble, otherwise return a -1 to indicate
	 * failure.
	 * 
	 * @return rowId or -1 if failed
	 */
public long insertTrack(Track track) {
    ContentValues vals = new ContentValues();
    vals.put("musicapp", track.getMusicAPI().getId());
    vals.put("artist", track.getArtist());
    vals.put("album", track.getAlbum());
    vals.put("track", track.getTrack());
    vals.put("whenplayed", track.getWhen());
    vals.put("duration", track.getDuration());
    vals.put("tracknr", track.getTrackNr());
    vals.put("mbid", track.getMbid());
    vals.put("source", track.getSource());
    vals.put("rating", track.getRating());
    return mDb.insert(TABLENAME_SCROBBLES, null, vals);
}

55. TestUtilities#createWeatherValues()

View license
/*
        Students: Use this to create some default weather values for your database tests.
     */
static ContentValues createWeatherValues(long locationRowId) {
    ContentValues weatherValues = new ContentValues();
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_LOC_KEY, locationRowId);
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_DATE, TEST_DATE);
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_DEGREES, 1.1);
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_HUMIDITY, 1.2);
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_PRESSURE, 1.3);
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_MAX_TEMP, 75);
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_MIN_TEMP, 65);
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_SHORT_DESC, "Asteroids");
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_WIND_SPEED, 5.5);
    weatherValues.put(WeatherContract.WeatherEntry.COLUMN_WEATHER_ID, 321);
    return weatherValues;
}

56. ReadingListPageTable#toContentValues()

View license
@Override
protected ContentValues toContentValues(ReadingListPageRow row) {
    ContentValues contentValues = new ContentValues();
    contentValues.put(PageCol.KEY.getName(), row.key());
    PageCol.LIST_KEYS.put(contentValues, row.listKeys());
    contentValues.put(PageCol.SITE.getName(), row.site().authority());
    contentValues.put(PageCol.LANG.getName(), row.site().languageCode());
    contentValues.put(PageCol.NAMESPACE.getName(), row.namespace().code());
    contentValues.put(PageCol.TITLE.getName(), row.title());
    contentValues.put(PageCol.DISK_PAGE_REV.getName(), row.diskPageRevision());
    contentValues.put(PageCol.MTIME.getName(), row.mtime());
    contentValues.put(PageCol.ATIME.getName(), row.atime());
    contentValues.put(PageCol.THUMBNAIL_URL.getName(), row.thumbnailUrl());
    contentValues.put(PageCol.DESCRIPTION.getName(), row.description());
    return contentValues;
}

57. TestUtilities#createWeatherValues()

Project: Angani
Source File: TestUtilities.java
View license
/*
        Students: Use this to create some default weather values for your database tests.
     */
static ContentValues createWeatherValues(long locationRowId) {
    ContentValues weatherValues = new ContentValues();
    weatherValues.put(WeatherDbHelper.WeatherContract.WeatherEntry.COLUMN_LOC_KEY, locationRowId);
    weatherValues.put(WeatherDbHelper.WeatherContract.WeatherEntry.COLUMN_DATE, TEST_DATE);
    weatherValues.put(WeatherDbHelper.WeatherContract.WeatherEntry.COLUMN_DEGREES, 1.1);
    weatherValues.put(WeatherDbHelper.WeatherContract.WeatherEntry.COLUMN_HUMIDITY, 1.2);
    weatherValues.put(WeatherDbHelper.WeatherContract.WeatherEntry.COLUMN_PRESSURE, 1.3);
    weatherValues.put(WeatherDbHelper.WeatherContract.WeatherEntry.COLUMN_MAX_TEMP, 75);
    weatherValues.put(WeatherDbHelper.WeatherContract.WeatherEntry.COLUMN_MIN_TEMP, 65);
    weatherValues.put(WeatherDbHelper.WeatherContract.WeatherEntry.COLUMN_SHORT_DESC, "Asteroids");
    weatherValues.put(WeatherDbHelper.WeatherContract.WeatherEntry.COLUMN_WIND_SPEED, 5.5);
    weatherValues.put(WeatherDbHelper.WeatherContract.WeatherEntry.COLUMN_WEATHER_ID, 321);
    return weatherValues;
}

58. DbAdapterTvShows#createContentValues()

Project: Mizuu
Source File: DbAdapterTvShows.java
View license
private ContentValues createContentValues(String showId, String showTitle, String showPlot, String showActors, String showGenres, String showRating, String showCertification, String showRuntime, String showFirstAirdate, String isFavorite) {
    ContentValues values = new ContentValues();
    values.put(KEY_SHOW_ID, showId);
    values.put(KEY_SHOW_TITLE, showTitle);
    values.put(KEY_SHOW_PLOT, showPlot);
    values.put(KEY_SHOW_ACTORS, showActors);
    values.put(KEY_SHOW_GENRES, showGenres);
    values.put(KEY_SHOW_RATING, showRating);
    values.put(KEY_SHOW_CERTIFICATION, showCertification);
    values.put(KEY_SHOW_RUNTIME, showRuntime);
    values.put(KEY_SHOW_FIRST_AIRDATE, showFirstAirdate);
    values.put(KEY_SHOW_FAVOURITE, isFavorite);
    return values;
}

59. TestUtilities#createWeatherValues()

Project: forecast
Source File: TestUtilities.java
View license
/*
        Students: Use this to create some default weather values for your database tests.
     */
static ContentValues createWeatherValues(long locationRowId) {
    ContentValues weatherValues = new ContentValues();
    weatherValues.put(ForecastContract.WeatherEntry.COLUMN_LOC_KEY, locationRowId);
    weatherValues.put(ForecastContract.WeatherEntry.COLUMN_DATE, TEST_DATE);
    weatherValues.put(ForecastContract.WeatherEntry.COLUMN_DEGREES, 1.1);
    weatherValues.put(ForecastContract.WeatherEntry.COLUMN_HUMIDITY, 1.2);
    weatherValues.put(ForecastContract.WeatherEntry.COLUMN_PRESSURE, 1.3);
    weatherValues.put(ForecastContract.WeatherEntry.COLUMN_MAX_TEMP, 75);
    weatherValues.put(ForecastContract.WeatherEntry.COLUMN_MIN_TEMP, 65);
    weatherValues.put(ForecastContract.WeatherEntry.COLUMN_SHORT_DESC, "Asteroids");
    weatherValues.put(ForecastContract.WeatherEntry.COLUMN_WIND_SPEED, 5.5);
    weatherValues.put(ForecastContract.WeatherEntry.COLUMN_WEATHER_ID, 321);
    return weatherValues;
}

60. Database#onCreate()

Project: SedekahOnline
Source File: Database.java
View license
@Override
public void onCreate(SQLiteDatabase db) {
    String sql = "CREATE TABLE IF NOT EXISTS prog(_id INTEGER PRIMARY KEY AUTOINCREMENT, nama TEXT, tujuan TEXT, keterangan TEXT, img BLOB)";
    db.execSQL(sql);
    ContentValues values = new ContentValues();
    values.put("_id", "1");
    values.put("nama", "Rumah Madani");
    values.put("tujuan", "Pelatihan Ketrampilan dan wawasan Ke-Islaman");
    values.put("keterangan", "Program pendidikan dengan konsep bimbingan belajar plus");
    values.put("img", R.drawable.slide2);
    db.insert("prog", "_id", values);
    values.put("_id", "2");
    values.put("nama", "URCD");
    values.put("tujuan", "Unit Reaksi Cepat Dhuafa");
    values.put("keterangan", "Unit Reaksi Cepat Dhuafa bersifat AD-HOC dan mempunyai tugas khusus dalam pengelolaan bantuan dari para donatur untuk korban bencana alam");
    values.put("img", R.drawable.slide14);
    db.insert("prog", "_id", values);
    values.put("_id", "3");
    values.put("nama", "Panti Asuhan Nurul Huffazh ");
    values.put("tujuan", "Memberikan Pendidikan Islami dan Ketrampilan");
    values.put("keterangan", "Didirikan pertengahan tahun 2013 di Jl. Kadudampit KM.4 Kp. Kadudampit Kec. Kadudampit, Sukabumi. dengan konsep kurikulum pendidikan berbasis Tahfidz Quran dan Enterperneur");
    values.put("img", R.drawable.slide9);
    db.insert("prog", "_id", values);
    values.put("_id", "4");
    values.put("nama", "BeSMART");
    values.put("tujuan", "Memberikan Beasiswa Pendidikan");
    values.put("keterangan", "Memberikan Beasiswa Pendidikan kepada Siswa Siswi Sekolah dasar sampai dengan Sekolah Menengah Atas dari kalangan Yatim dan Dhuafa yang Berprestasi");
    values.put("img", R.drawable.slide13);
    db.insert("prog", "_id", values);
    values.put("_id", "5");
    values.put("nama", "NASAFA");
    values.put("tujuan", "Nasi Dari Sahabat Untuk Dhuafa");
    values.put("keterangan", "NASAFA adalah program sosial dari SAHABAT DHUAFA yaitu Nasi dari Sahabat Untuk Dhuafa. Program pembagian sebungkus nasi secara cuma-cuma kepada kaum Dhuafa yang bisa langsung dirasakan manfaatnya.");
    values.put("img", R.drawable.slide3);
    db.insert("prog", "_id", values);
    values.put("_id", "6");
    values.put("nama", "ASSYFA");
    values.put("tujuan", "Advokasi Pasien Dhuafa");
    values.put("keterangan", "Program pendampingan pasien yang memiliki tujuan memberikan edukasi, pendampingan kepada pasien maupun keluarga pasien dalam berobat. Agar pasien maupun keluarga pasien mampu menjalani pengobatan sesuai dengan prosedur yang ada dan mendapatkan fasilitas berobat sesuai dengan hak nya sebagai pasien");
    values.put("img", R.drawable.slide11);
    db.insert("prog", "_id", values);
}

61. PageDbManager#update()

Project: PanicButton
Source File: PageDbManager.java
View license
public static long update(SQLiteDatabase db, Page page) throws SQLException {
    ContentValues cv = new ContentValues();
    cv.put(PAGE_TYPE, page.getType());
    cv.put(PAGE_TITLE, page.getTitle());
    cv.put(PAGE_INTRODUCTION, page.getIntroduction());
    cv.put(PAGE_WARNING, page.getWarning());
    cv.put(PAGE_COMPONENT, page.getComponent());
    cv.put(PAGE_CONTENT, page.getContent());
    cv.put(PAGE_SUCCESS_ID, page.getSuccessId());
    cv.put(PAGE_FAILED_ID, page.getFailedId());
    cv.put(PAGE_HEADING, page.getHeading());
    cv.put(PAGE_SECTION_ORDER, page.getSectionOrder());
    return db.update(TABLE_PAGE, cv, PAGE_ID + "=? AND " + PAGE_LANGUAGE + "=?", new String[] { page.getId(), page.getLang() });
}

62. ProviderHelper#buildUserIdOperations()

Project: open-keychain
Source File: ProviderHelper.java
View license
/**
     * Build ContentProviderOperation to add PublicUserIds to database corresponding to a keyRing
     */
private ContentProviderOperation buildUserIdOperations(long masterKeyId, UserPacketItem item, int rank) {
    ContentValues values = new ContentValues();
    values.put(UserPackets.MASTER_KEY_ID, masterKeyId);
    values.put(UserPackets.TYPE, item.type);
    values.put(UserPackets.USER_ID, item.userId);
    values.put(UserPackets.NAME, item.name);
    values.put(UserPackets.EMAIL, item.email);
    values.put(UserPackets.COMMENT, item.comment);
    values.put(UserPackets.ATTRIBUTE_DATA, item.attributeData);
    values.put(UserPackets.IS_PRIMARY, item.isPrimary);
    values.put(UserPackets.IS_REVOKED, item.selfRevocation != null);
    values.put(UserPackets.RANK, rank);
    Uri uri = UserPackets.buildUserIdsUri(masterKeyId);
    return ContentProviderOperation.newInsert(uri).withValues(values).build();
}

63. RemoteTaskList#getContent()

Project: NotePad
Source File: RemoteTaskList.java
View license
@Override
public ContentValues getContent() {
    final ContentValues values = new ContentValues();
    values.put(Columns.DBID, dbid);
    values.put(Columns.REMOTEID, remoteId);
    values.put(Columns.UPDATED, updated);
    values.put(Columns.ACCOUNT, account);
    values.put(Columns.SERVICE, service);
    values.put(Columns.DELETED, deleted);
    values.put(Columns.FIELD2, field2);
    values.put(Columns.FIELD3, field3);
    values.put(Columns.FIELD4, field4);
    values.put(Columns.FIELD5, field5);
    return values;
}

64. SipMessage#getContentValues()

Project: CSipSimple
Source File: SipMessage.java
View license
/**
     * Pack the object content value to store
     * 
     * @return The content value representing the message
     */
public ContentValues getContentValues() {
    ContentValues cv = new ContentValues();
    cv.put(FIELD_FROM, from);
    cv.put(FIELD_TO, to);
    cv.put(FIELD_CONTACT, contact);
    cv.put(FIELD_BODY, body);
    cv.put(FIELD_MIME_TYPE, mimeType);
    cv.put(FIELD_TYPE, type);
    cv.put(FIELD_DATE, date);
    cv.put(FIELD_STATUS, status);
    cv.put(FIELD_READ, read);
    cv.put(FIELD_FROM_FULL, fullFrom);
    return cv;
}

65. DataPersister#addBookmark()

Project: yahnac
Source File: DataPersister.java
View license
public void addBookmark(Story story) {
    ContentValues bookmarkValues = new ContentValues();
    bookmarkValues.put(HNewsContract.BookmarkEntry.ITEM_ID, story.getId());
    bookmarkValues.put(HNewsContract.BookmarkEntry.BY, story.getSubmitter());
    bookmarkValues.put(HNewsContract.BookmarkEntry.TYPE, story.getType());
    bookmarkValues.put(HNewsContract.BookmarkEntry.URL, story.getUrl());
    bookmarkValues.put(HNewsContract.BookmarkEntry.TITLE, story.getTitle());
    bookmarkValues.put(HNewsContract.BookmarkEntry.TIMESTAMP, System.currentTimeMillis());
    bookmarkValues.put(HNewsContract.BookmarkEntry.FILTER, story.getFilter());
    contentResolver.insert(HNewsContract.BookmarkEntry.CONTENT_BOOKMARKS_URI, bookmarkValues);
    ContentValues storyValues = new ContentValues();
    storyValues.put(HNewsContract.StoryEntry.BOOKMARK, HNewsContract.TRUE_BOOLEAN);
    contentResolver.update(HNewsContract.StoryEntry.CONTENT_STORY_URI, storyValues, HNewsContract.StoryEntry.ITEM_ID + " = ?", new String[] { String.valueOf(story.getId()) });
}

66. PeopleTable#save()

Project: WordPress-Android
Source File: PeopleTable.java
View license
public static void save(Person person, SQLiteDatabase database) {
    ContentValues values = new ContentValues();
    values.put("person_id", person.getPersonID());
    values.put("blog_id", person.getBlogId());
    values.put("local_blog_id", person.getLocalTableBlogId());
    values.put("user_name", person.getUsername());
    values.put("first_name", person.getFirstName());
    values.put("last_name", person.getLastName());
    values.put("display_name", person.getDisplayName());
    values.put("avatar_url", person.getAvatarUrl());
    values.put("role", person.getRole());
    database.insertWithOnConflict(PEOPLE_TABLE, null, values, SQLiteDatabase.CONFLICT_REPLACE);
}

67. OrgNode#getContentValues()

Project: mobileorg-android
Source File: OrgNode.java
View license
private ContentValues getContentValues() {
    ContentValues values = new ContentValues();
    values.put(OrgData.NAME, name);
    values.put(OrgData.TODO, todo);
    values.put(OrgData.FILE_ID, fileId);
    values.put(OrgData.LEVEL, level);
    values.put(OrgData.PARENT_ID, parentId);
    values.put(OrgData.PAYLOAD, payload);
    values.put(OrgData.PRIORITY, priority);
    values.put(OrgData.TAGS, tags);
    values.put(OrgData.TAGS_INHERITED, tags_inherited);
    return values;
}

68. FavoriteManagerTest#setUp()

View license
@Before
public void setUp() {
    callbacks = mock(FavoriteManager.OperationCallbacks.class);
    resolver = shadowOf(RuntimeEnvironment.application.getContentResolver());
    ContentValues cv = new ContentValues();
    cv.put("itemid", "1");
    cv.put("title", "title");
    cv.put("url", "http://example.com");
    cv.put("time", String.valueOf(System.currentTimeMillis()));
    resolver.insert(MaterialisticProvider.URI_FAVORITE, cv);
    cv = new ContentValues();
    cv.put("itemid", "2");
    cv.put("title", "ask HN");
    cv.put("url", "http://example.com");
    cv.put("time", String.valueOf(System.currentTimeMillis()));
    resolver.insert(MaterialisticProvider.URI_FAVORITE, cv);
    manager = new FavoriteManager();
}

69. SyncUtils#contentValuesFromSeason()

Project: Kore
Source File: SyncUtils.java
View license
/**
     * Returns {@link android.content.ContentValues} from a {@link VideoType.DetailsSeason} tv
     * show season
     * @param hostId Host id for this season
     * @param season {@link org.xbmc.kore.jsonrpc.type.VideoType.DetailsSeason}
     * @return {@link android.content.ContentValues} with the season values
     */
public static ContentValues contentValuesFromSeason(int hostId, VideoType.DetailsSeason season) {
    ContentValues seasonValues = new ContentValues();
    seasonValues.put(MediaContract.SeasonsColumns.HOST_ID, hostId);
    seasonValues.put(MediaContract.SeasonsColumns.TVSHOWID, season.tvshowid);
    seasonValues.put(MediaContract.SeasonsColumns.SEASON, season.season);
    seasonValues.put(MediaContract.SeasonsColumns.LABEL, season.label);
    seasonValues.put(MediaContract.SeasonsColumns.FANART, season.fanart);
    seasonValues.put(MediaContract.SeasonsColumns.THUMBNAIL, season.thumbnail);
    seasonValues.put(MediaContract.SeasonsColumns.EPISODE, season.episode);
    seasonValues.put(MediaContract.SeasonsColumns.SHOWTITLE, season.showtitle);
    seasonValues.put(MediaContract.SeasonsColumns.WATCHEDEPISODES, season.watchedepisodes);
    return seasonValues;
}

70. AudioUtils#saveAudio()

Project: android-utils
Source File: AudioUtils.java
View license
/**
	 * 
	 * @param ctx
	 * @return The media content Uri to the newly created audio, or null if failed for any reason.
	 */
private static Uri saveAudio(Context ctx) {
    File audioFile = new File(mFileName);
    ContentValues values = new ContentValues();
    values.put(MediaStore.MediaColumns.DATA, audioFile.getAbsolutePath());
    values.put(MediaStore.MediaColumns.TITLE, "");
    values.put(MediaStore.MediaColumns.MIME_TYPE, "audio/mpeg");
    values.put(MediaStore.MediaColumns.SIZE, audioFile.length());
    values.put(MediaStore.Audio.Media.ARTIST, "");
    values.put(MediaStore.Audio.Media.IS_RINGTONE, false);
    // Now set some extra features it depend on you
    values.put(MediaStore.Audio.Media.IS_NOTIFICATION, false);
    values.put(MediaStore.Audio.Media.IS_ALARM, false);
    values.put(MediaStore.Audio.Media.IS_MUSIC, false);
    Uri uri = MediaStore.Audio.Media.getContentUriForPath(audioFile.getAbsolutePath());
    Uri uri2 = ctx.getContentResolver().insert(uri, values);
    if (uri2 == null || TextUtils.isEmpty(uri2.toString())) {
        Log.w(TAG, "Something went wrong while inserting data to content resolver");
    }
    return uri2;
}

71. AudioUtils#writeAudioToMedia()

Project: android-utils
Source File: AudioUtils.java
View license
/**
	 * 
	 * @deprecated
	 * <br/>
	 * Use {@link nl.changer.android.opensource.AudioUtils#saveAudio(android.content.Context)}
	 * Insert an audio into {@link android.provider.MediaStore.Images.Media} content provider of the device.
	 * 
	 * @return The media content Uri to the newly created audio, or null if failed for any reason.
	 * ***/
public static Uri writeAudioToMedia(Context ctx, File audioFile) {
    ContentValues values = new ContentValues();
    values.put(MediaStore.MediaColumns.DATA, audioFile.getAbsolutePath());
    values.put(MediaStore.MediaColumns.TITLE, "");
    values.put(MediaStore.MediaColumns.MIME_TYPE, "audio/mpeg");
    values.put(MediaStore.MediaColumns.SIZE, audioFile.length());
    values.put(MediaStore.Audio.Media.ARTIST, "");
    values.put(MediaStore.Audio.Media.IS_RINGTONE, false);
    // Now set some extra features it depend on you
    values.put(MediaStore.Audio.Media.IS_NOTIFICATION, false);
    values.put(MediaStore.Audio.Media.IS_ALARM, false);
    values.put(MediaStore.Audio.Media.IS_MUSIC, false);
    Uri uri = MediaStore.Audio.Media.getContentUriForPath(audioFile.getAbsolutePath());
    Uri uri2 = ctx.getContentResolver().insert(uri, values);
    if (uri2 == null || TextUtils.isEmpty(uri2.toString())) {
        Log.w(TAG, "Something went wrong while inserting data to content resolver");
    }
    return uri2;
}

72. ImageHelper#storePicture()

View license
/**
     * Store a picture that has just been saved to disk in the MediaStore.
     * 
     * @param imageFile
     *            The File of the picture
     * @return The Uri provided by the MediaStore.
     */
public static Uri storePicture(final Context ctx, final File imageFile, String imageName) {
    final ContentResolver cr = ctx.getContentResolver();
    imageName = imageName.substring(imageName.lastIndexOf('/') + 1);
    final ContentValues values = new ContentValues(7);
    values.put(MediaColumns.TITLE, imageName);
    values.put(MediaColumns.DISPLAY_NAME, imageName);
    values.put(ImageColumns.DESCRIPTION, "");
    values.put(ImageColumns.DATE_TAKEN, System.currentTimeMillis());
    values.put(MediaColumns.MIME_TYPE, "image/jpeg");
    values.put(ImageColumns.ORIENTATION, 0);
    final File parentFile = imageFile.getParentFile();
    final String path = parentFile.toString().toLowerCase();
    final String name = parentFile.getName().toLowerCase();
    values.put(Images.ImageColumns.BUCKET_ID, path.hashCode());
    values.put(Images.ImageColumns.BUCKET_DISPLAY_NAME, name);
    values.put("_data", imageFile.toString());
    final Uri uri = cr.insert(Images.Media.EXTERNAL_CONTENT_URI, values);
    return uri;
}

73. TaskDetailsDBHandler#updateRow()

View license
public void updateRow(TaskDetails task, int id) {
    ContentValues values = new ContentValues();
    values.put(COLUMN_TIME_STAMP, task.get_TimeStamp());
    values.put(COLUMN_DESCRIPTION, task.get_TaskDescription());
    values.put(COLUMN_TAG, task.get_TaskTag());
    values.put(COLUMN_START_DATE_TIME, task.get_StartDateTime());
    values.put(COLUMN_END_DATE_TIME, task.get_EndDateTime());
    values.put(COLUMN_REPETITION, task.get_Repetition());
    values.put(COLUMN_TYPE, task.get_Type());
    values.put(COLUMN_STARTS_FROM, task.get_StartsFromDailyOrWeekly());
    values.put(COLUMN_ENDS_ON, task.get_EndsFromDailyOrWeekly());
    SQLiteDatabase db = getWritableDatabase();
    String where = COLUMN_ID + "='" + id + "'";
    db.update(TABLE_NAME, values, where, null);
    db.close();
}

74. TaskDetailsDBHandler#insertRow()

View license
public void insertRow(TaskDetails task) {
    ContentValues values = new ContentValues();
    values.put(COLUMN_TIME_STAMP, task.get_TimeStamp());
    values.put(COLUMN_DESCRIPTION, task.get_TaskDescription());
    values.put(COLUMN_TAG, task.get_TaskTag());
    values.put(COLUMN_START_DATE_TIME, task.get_StartDateTime());
    values.put(COLUMN_END_DATE_TIME, task.get_EndDateTime());
    values.put(COLUMN_REPETITION, task.get_Repetition());
    values.put(COLUMN_TYPE, task.get_Type());
    values.put(COLUMN_STARTS_FROM, task.get_StartsFromDailyOrWeekly());
    values.put(COLUMN_ENDS_ON, task.get_EndsFromDailyOrWeekly());
    SQLiteDatabase db = getWritableDatabase();
    db.insert(TABLE_NAME, null, values);
    db.close();
}

75. Conversation#getContentValues()

Project: Conversations
Source File: Conversation.java
View license
public ContentValues getContentValues() {
    ContentValues values = new ContentValues();
    values.put(UUID, uuid);
    values.put(NAME, name);
    values.put(CONTACT, contactUuid);
    values.put(ACCOUNT, accountUuid);
    values.put(CONTACTJID, contactJid.toString());
    values.put(CREATED, created);
    values.put(STATUS, status);
    values.put(MODE, mode);
    values.put(ATTRIBUTES, attributes.toString());
    return values;
}

76. LabelProviderClient#buildContentValuesForLabel()

Project: talkback
Source File: LabelProviderClient.java
View license
/**
     * Builds content values for the fields of a label.
     *
     * @param label The source of the values.
     * @return A set of values representing the label.
     */
private static ContentValues buildContentValuesForLabel(Label label) {
    final ContentValues values = new ContentValues();
    values.put(LabelsTable.KEY_PACKAGE_NAME, label.getPackageName());
    values.put(LabelsTable.KEY_PACKAGE_SIGNATURE, label.getPackageSignature());
    values.put(LabelsTable.KEY_VIEW_NAME, label.getViewName());
    values.put(LabelsTable.KEY_TEXT, label.getText());
    values.put(LabelsTable.KEY_LOCALE, label.getLocale());
    values.put(LabelsTable.KEY_PACKAGE_VERSION, label.getPackageVersion());
    values.put(LabelsTable.KEY_SCREENSHOT_PATH, label.getScreenshotPath());
    values.put(LabelsTable.KEY_TIMESTAMP, label.getTimestamp());
    return values;
}

77. FileDownloadModel#toContentValues()

View license
public ContentValues toContentValues() {
    ContentValues cv = new ContentValues();
    cv.put(ID, id);
    cv.put(URL, url);
    cv.put(PATH, path);
    cv.put(STATUS, status);
    cv.put(SOFAR, soFar);
    cv.put(TOTAL, total);
    cv.put(ERR_MSG, errMsg);
    cv.put(ETAG, eTag);
    return cv;
}

78. RecordDao#createOrUpdate()

Project: digitalocean-swimmer
Source File: RecordDao.java
View license
public void createOrUpdate(Record record) {
    boolean update = findById(record.getId()) != null;
    ContentValues values = new ContentValues();
    values.put(RecordTable.ID, record.getId());
    values.put(RecordTable.NAME, record.getName());
    values.put(RecordTable.DOMAIN_NAME, record.getDomain().getName());
    values.put(RecordTable.RECORD_TYPE, record.getRecordType());
    values.put(RecordTable.DATA, record.getData());
    values.put(RecordTable.PORT, record.getPort());
    values.put(RecordTable.PRIORITY, record.getPriority());
    values.put(RecordTable.WEIGHT, record.getWeight());
    if (update) {
        db.updateWithOnConflict(getTableHelper().TABLE_NAME, values, DropletTable.ID + "= ?", new String[] { record.getId() + "" }, SQLiteDatabase.CONFLICT_REPLACE);
    } else {
        db.insertWithOnConflict(getTableHelper().TABLE_NAME, null, values, SQLiteDatabase.CONFLICT_REPLACE);
    }
}

79. ImageDao#create()

Project: digitalocean-swimmer
Source File: ImageDao.java
View license
public long create(Image image) {
    ContentValues values = new ContentValues();
    values.put(ImageTable.ID, image.getId());
    values.put(ImageTable.NAME, image.getName());
    values.put(ImageTable.DISTRIBUTION, image.getDistribution());
    values.put(ImageTable.SLUG, image.getSlug());
    values.put(ImageTable.IS_IN_USE, image.isInUse());
    values.put(ImageTable.PUBLIC, image.isPublic() ? 1 : 0);
    values.put(ImageTable.REGIONS, image.getRegions());
    values.put(ImageTable.MINDISKSIZE, image.getMinDiskSize());
    return db.insertWithOnConflict(getTableHelper().TABLE_NAME, null, values, SQLiteDatabase.CONFLICT_REPLACE);
}

80. TestDb#insertRow()

Project: cursor-utils
Source File: TestDb.java
View license
/** (int i, long l, float f, double d, short s, boolean b, byte[] bytes, ( */
public void insertRow(int i, long l, float f, double d, short s, boolean b, byte[] bytes, String str) {
    ContentValues cv = new ContentValues();
    cv.put("some_str", str);
    cv.put("some_int", i);
    cv.put("some_long", l);
    cv.put("some_boolean", b);
    cv.put("some_float", f);
    cv.put("some_double", d);
    cv.put("some_short", s);
    cv.put("some_byte_array", bytes);
    getWritableDatabase().insert("TEST", null, cv);
}

81. DailyModel#saveDailyGsonDB()

Project: BuildingBlocks
Source File: DailyModel.java
View license
private void saveDailyGsonDB(DailyGson daily) {
    SQLiteDatabase database = mSQLiteHelper.getWritableDatabase();
    ContentValues values = new ContentValues();
    values.put("id", daily.id);
    values.put("title", daily.title);
    values.put("type", daily.type);
    values.put("image_source", daily.image_source);
    values.put("image", daily.image);
    values.put("share_url", daily.share_url);
    values.put("ga_prefix", daily.ga_prefix);
    values.put("body", daily.body);
    database.insertWithOnConflict("daily", null, values, SQLiteDatabase.CONFLICT_IGNORE);
    database.close();
}

82. LabelProviderClient#buildContentValuesForLabel()

View license
/**
     * Builds content values for the fields of a label.
     *
     * @param label The source of the values.
     * @return A set of values representing the label.
     */
private static ContentValues buildContentValuesForLabel(Label label) {
    final ContentValues values = new ContentValues();
    values.put(LabelsTable.KEY_PACKAGE_NAME, label.getPackageName());
    values.put(LabelsTable.KEY_PACKAGE_SIGNATURE, label.getPackageSignature());
    values.put(LabelsTable.KEY_VIEW_NAME, label.getViewName());
    values.put(LabelsTable.KEY_TEXT, label.getText());
    values.put(LabelsTable.KEY_LOCALE, label.getLocale().toString());
    values.put(LabelsTable.KEY_PACKAGE_VERSION, label.getPackageVersion());
    values.put(LabelsTable.KEY_SCREENSHOT_PATH, label.getScreenshotPath());
    values.put(LabelsTable.KEY_TIMESTAMP, label.getTimestamp());
    return values;
}

83. RAction#addRepo()

Project: Bitocle
Source File: RAction.java
View license
public void addRepo(Repo repo) {
    ContentValues contentValues = new ContentValues();
    contentValues.put(Repo.NAME, repo.getName());
    contentValues.put(Repo.DATE, repo.getDate());
    contentValues.put(Repo.DESCRIPTION, repo.getDescription());
    contentValues.put(Repo.LANG, repo.getLang());
    contentValues.put(Repo.STAR, repo.getStar());
    contentValues.put(Repo.FORK, repo.getFork());
    contentValues.put(Repo.OWNER, repo.getOwner());
    contentValues.put(Repo.GIT, repo.getGit());
    sqLiteDatabase.insert(Repo.TABLE, null, contentValues);
}

84. RAction#addRepo()

Project: Bitocle
Source File: RAction.java
View license
public void addRepo(Repo repo) {
    ContentValues contentValues = new ContentValues();
    contentValues.put(Repo.NAME, repo.getName());
    contentValues.put(Repo.DATE, repo.getDate());
    contentValues.put(Repo.DESCRIPTION, repo.getDescription());
    contentValues.put(Repo.LANG, repo.getLang());
    contentValues.put(Repo.STAR, repo.getStar());
    contentValues.put(Repo.FORK, repo.getFork());
    contentValues.put(Repo.OWNER, repo.getOwner());
    contentValues.put(Repo.GIT, repo.getGit());
    sqLiteDatabase.insert(Repo.TABLE, null, contentValues);
}

85. BAction#addBookmark()

Project: Bitocle
Source File: BAction.java
View license
public void addBookmark(Bookmark bookmark) {
    ContentValues contentValues = new ContentValues();
    contentValues.put(Bookmark.TITLE, bookmark.getTitle());
    contentValues.put(Bookmark.DATE, bookmark.getDate());
    contentValues.put(Bookmark.TYPE, bookmark.getType());
    contentValues.put(Bookmark.REPO_OWNER, bookmark.getRepoOwner());
    contentValues.put(Bookmark.REPO_NAME, bookmark.getRepoName());
    contentValues.put(Bookmark.REPO_PATH, bookmark.getRepoPath());
    contentValues.put(Bookmark.SHA, bookmark.getSha());
    contentValues.put(Bookmark.KEY, bookmark.getKey());
    sqLiteDatabase.insert(Bookmark.TABLE, null, contentValues);
}

86. MessagesProviderUtils#insertEmptyThread()

View license
/** Inserts an empty thread (that is, with no messages). */
public static long insertEmptyThread(Context context, String peer, String draft) {
    ContentValues msgValues = new ContentValues(9);
    // must supply a message ID...
    msgValues.put(Messages.MESSAGE_ID, "draft" + (new Random().nextInt()));
    // use group id as the peer
    msgValues.put(Messages.PEER, peer);
    msgValues.put(Messages.BODY_CONTENT, new byte[0]);
    msgValues.put(Messages.BODY_LENGTH, 0);
    msgValues.put(Messages.BODY_MIME, TextComponent.MIME_TYPE);
    msgValues.put(Messages.DIRECTION, Messages.DIRECTION_OUT);
    msgValues.put(Messages.TIMESTAMP, System.currentTimeMillis());
    msgValues.put(Messages.ENCRYPTED, false);
    if (draft != null)
        msgValues.put(Threads.DRAFT, draft);
    Uri newThread = context.getContentResolver().insert(Messages.CONTENT_URI, msgValues);
    return newThread != null ? ContentUris.parseId(newThread) : Messages.NO_THREAD;
}

87. TracksDBHelper#asContentValues()

View license
public static ContentValues asContentValues(Track track) {
    final ContentValues contentValues = new ContentValues();
    contentValues.put(TableInfo.COLUMN_PLAYER_PACKAGE_NAME, track.getPlayerPackageName());
    contentValues.put(TableInfo.COLUMN_TRACK, track.getTrack());
    contentValues.put(TableInfo.COLUMN_ARTIST, track.getArtist());
    contentValues.put(TableInfo.COLUMN_ALBUM, track.getAlbum());
    contentValues.put(TableInfo.COLUMN_DURATION, track.getDuration());
    contentValues.put(TableInfo.COLUMN_TIMESTAMP, track.getTimestamp());
    contentValues.put(TableInfo.COLUMN_STATE, track.getState());
    contentValues.put(TableInfo.COLUMN_STATE_TIMESTAMP, track.getStateTimestamp());
    return contentValues;
}

88. Notification#getContent()

Project: NotePad
Source File: Notification.java
View license
@Override
public ContentValues getContent() {
    final ContentValues values = new ContentValues();
    values.put(Columns.TIME, time);
    values.put(Columns.TASKID, taskID);
    values.put(Columns.PERMANENT, permanent ? 1 : 0);
    values.put(Columns.REPEATS, repeats);
    values.put(Columns.LOCATIONNAME, locationName);
    values.put(Columns.LATITUDE, latitude);
    values.put(Columns.LONGITUDE, longitude);
    values.put(Columns.RADIUS, radius);
    return values;
}

89. Artwork#toContentValues()

Project: muzei
Source File: Artwork.java
View license
/**
     * Serializes this artwork object to a {@link ContentValues} representation.
     */
public ContentValues toContentValues() {
    ContentValues values = new ContentValues();
    values.put(MuzeiContract.Artwork.COLUMN_NAME_SOURCE_COMPONENT_NAME, (mComponentName != null) ? mComponentName.flattenToShortString() : null);
    values.put(MuzeiContract.Artwork.COLUMN_NAME_IMAGE_URI, (mImageUri != null) ? mImageUri.toString() : null);
    values.put(MuzeiContract.Artwork.COLUMN_NAME_TITLE, mTitle);
    values.put(MuzeiContract.Artwork.COLUMN_NAME_BYLINE, mByline);
    values.put(MuzeiContract.Artwork.COLUMN_NAME_ATTRIBUTION, mAttribution);
    values.put(MuzeiContract.Artwork.COLUMN_NAME_TOKEN, mToken);
    values.put(MuzeiContract.Artwork.COLUMN_NAME_VIEW_INTENT, (mViewIntent != null) ? mViewIntent.toUri(Intent.URI_INTENT_SCHEME) : null);
    values.put(MuzeiContract.Artwork.COLUMN_NAME_META_FONT, mMetaFont);
    return values;
}

90. DbAdapterMovies#editMovie()

Project: Mizuu
Source File: DbAdapterMovies.java
View license
public boolean editMovie(String movieId, String title, String tagline, String description, String genres, String runtime, String rating, String releaseDate, String certification) {
    ContentValues cv = new ContentValues();
    cv.put(KEY_TITLE, title);
    cv.put(KEY_PLOT, description);
    cv.put(KEY_RATING, rating);
    cv.put(KEY_TAGLINE, tagline);
    cv.put(KEY_RELEASEDATE, releaseDate);
    cv.put(KEY_CERTIFICATION, certification);
    cv.put(KEY_RUNTIME, runtime);
    cv.put(KEY_GENRES, genres);
    return mDatabase.update(DATABASE_TABLE, cv, KEY_TMDB_ID + " = ?", new String[] { movieId }) > 0;
}

91. DbUtils#getLyricContentValue()

Project: LyricHere
Source File: DbUtils.java
View license
public static ContentValues getLyricContentValue(Lyric lyric, String path, Long time, String encoding, String unknownTag) {
    ContentValues values = new ContentValues();
    values.put(Constants.Column.TITLE, TextUtils.isEmpty(lyric.title) ? unknownTag : lyric.title);
    values.put(Constants.Column.ARTIST, TextUtils.isEmpty(lyric.artist) ? unknownTag : lyric.artist);
    values.put(Constants.Column.ALBUM, TextUtils.isEmpty(lyric.album) ? unknownTag : lyric.album);
    values.put(Constants.Column.LENGTH, lyric.length);
    values.put(Constants.Column.PATH, path);
    values.put(Constants.Column.ENCODING, encoding);
    values.put(Constants.Column.LAST_VISITED_AT, time);
    values.put(Constants.Column.ENCODING_CHANGED, 0);
    return values;
}

92. DbUtils#getLyricContentValue()

Project: LyricHere
Source File: DbUtils.java
View license
public static ContentValues getLyricContentValue(Lyric lyric, String path, Long time, String encoding) {
    ContentValues values = new ContentValues();
    values.put(Constants.Column.TITLE, lyric.title);
    values.put(Constants.Column.ARTIST, lyric.artist);
    values.put(Constants.Column.ALBUM, lyric.album);
    values.put(Constants.Column.LENGTH, lyric.length);
    values.put(Constants.Column.PATH, path);
    values.put(Constants.Column.ENCODING, encoding);
    values.put(Constants.Column.LAST_VISITED_AT, time);
    values.put(Constants.Column.ENCODING_CHANGED, 0);
    return values;
}

93. SyncUtils#contentValuesFromSong()

Project: Kore
Source File: SyncUtils.java
View license
/**
     * Returns {@link android.content.ContentValues} from a {@link AudioType.DetailsSong} song
     * @param hostId Host id for the song
     * @param song {@link AudioType.DetailsSong}
     * @return {@link android.content.ContentValues} with the song values
     */
public static ContentValues contentValuesFromSong(int hostId, AudioType.DetailsSong song) {
    ContentValues songValues = new ContentValues();
    songValues.put(MediaContract.Songs.HOST_ID, hostId);
    songValues.put(MediaContract.Songs.ALBUMID, song.albumid);
    songValues.put(MediaContract.Songs.SONGID, song.songid);
    songValues.put(MediaContract.Songs.DURATION, song.duration);
    songValues.put(MediaContract.Songs.THUMBNAIL, song.thumbnail);
    songValues.put(MediaContract.Songs.FILE, song.file);
    songValues.put(MediaContract.Songs.TRACK, song.track);
    songValues.put(MediaContract.Songs.TITLE, song.title);
    return songValues;
}

94. ApiDatabase#saveGuide()

Project: iFixitAndroid
Source File: ApiDatabase.java
View license
public void saveGuide(Site site, User user, ApiEvent<Guide> guideEvent, GuideInfo guideInfo, int imagesTotal, int imagesDownloaded) {
    if (guideEvent == null) {
        throw new IllegalArgumentException("ApiEvent<Guide> guideEvent");
    }
    SQLiteDatabase db = getWritableDatabase();
    ContentValues values = new ContentValues();
    Guide guide = guideEvent.getResult();
    values.put(KEY_SITEID, site.mSiteid);
    values.put(KEY_USERID, user.getUserid());
    values.put(KEY_GUIDEID, guide.getGuideid());
    values.put(KEY_MODIFIED_DATE, guide.getAbsoluteModifiedDate());
    values.put(KEY_MEDIA_TOTAL, imagesTotal);
    values.put(KEY_MEDIA_DOWNLOADED, imagesDownloaded);
    values.put(KEY_GUIDE_INFO_JSON, new Gson().toJson(guideInfo));
    values.put(KEY_GUIDE_JSON, guideEvent.getResponse());
    db.insertWithOnConflict(TABLE_OFFLINE_GUIDES, null, values, SQLiteDatabase.CONFLICT_REPLACE);
}

95. DBUtils#insertDevice()

Project: RoMote
Source File: DBUtils.java
View license
public static long insertDevice(Context context, Device device) {
    long id = -1;
    if (deviceExists(context, device.getSerialNumber())) {
        return -1;
    }
    DeviceDatabase deviceDatabase = new DeviceDatabase(context);
    SQLiteDatabase db = deviceDatabase.getWritableDatabase();
    ContentValues values = new ContentValues();
    values.put(DeviceDatabase.HOST, device.getHost());
    values.put(DeviceDatabase.UDN, device.getUdn());
    values.put(DeviceDatabase.SERIAL_NUMBER, device.getSerialNumber());
    values.put(DeviceDatabase.DEVICE_ID, device.getDeviceId());
    values.put(DeviceDatabase.VENDOR_NAME, device.getVendorName());
    values.put(DeviceDatabase.MODEL_NUMBER, device.getModelNumber());
    values.put(DeviceDatabase.MODEL_NAME, device.getModelName());
    values.put(DeviceDatabase.WIFI_MAC, device.getWifiMac());
    values.put(DeviceDatabase.ETHERNET_MAC, device.getEthernetMac());
    values.put(DeviceDatabase.NETWORK_TYPE, device.getNetworkType());
    values.put(DeviceDatabase.USER_DEVICE_NAME, device.getUserDeviceName());
    values.put(DeviceDatabase.SOFTWARE_VERSION, device.getSoftwareVersion());
    values.put(DeviceDatabase.SOFTWARE_BUILD, device.getSoftwareBuild());
    values.put(DeviceDatabase.SECURE_DEVICE, device.getSecureDevice());
    values.put(DeviceDatabase.LANGUAGE, device.getLanguage());
    values.put(DeviceDatabase.COUNTY, device.getCountry());
    values.put(DeviceDatabase.LOCALE, device.getLocale());
    values.put(DeviceDatabase.TIME_ZONE, device.getTimeZone());
    values.put(DeviceDatabase.TIME_ZONE_OFFSET, device.getTimeZoneOffset());
    values.put(DeviceDatabase.POWER_MODE, device.getPowerMode());
    values.put(DeviceDatabase.DEVELOPER_ENABLED, device.getDeveloperEnabled());
    values.put(DeviceDatabase.KEYED_DEVELOPER_ID, device.getKeyedDeveloperId());
    values.put(DeviceDatabase.SEARCH_ENABLED, device.getSearchEnabled());
    values.put(DeviceDatabase.VOICE_SEARCH_ENABLED, device.getVoiceSearchEnabled());
    values.put(DeviceDatabase.NOTIFICATIONS_ENABLED, device.getNotificationsEnabled());
    values.put(DeviceDatabase.NOTIFICATIONS_FIRST_USE, device.getNotificationsFirstUse());
    values.put(DeviceDatabase.HEADPHONES_CONNECTED, device.getHeadphonesConnected());
    id = db.insert(DeviceDatabase.DEVICES_TABLE_NAME, null, values);
    db.close();
    deviceDatabase.close();
    return id;
}

96. ReminderDatabase#updateReminder()

Project: Remindly
Source File: ReminderDatabase.java
View license
// Updating single Reminder
public int updateReminder(Reminder reminder) {
    SQLiteDatabase db = this.getWritableDatabase();
    ContentValues values = new ContentValues();
    values.put(KEY_TITLE, reminder.getTitle());
    values.put(KEY_DATE, reminder.getDate());
    values.put(KEY_TIME, reminder.getTime());
    values.put(KEY_REPEAT, reminder.getRepeat());
    values.put(KEY_REPEAT_NO, reminder.getRepeatNo());
    values.put(KEY_REPEAT_TYPE, reminder.getRepeatType());
    values.put(KEY_ACTIVE, reminder.getActive());
    // Updating row
    return db.update(TABLE_REMINDERS, values, KEY_ID + "=?", new String[] { String.valueOf(reminder.getID()) });
}

97. ReminderDatabase#addReminder()

Project: Remindly
Source File: ReminderDatabase.java
View license
// Adding new Reminder
public int addReminder(Reminder reminder) {
    SQLiteDatabase db = this.getWritableDatabase();
    ContentValues values = new ContentValues();
    values.put(KEY_TITLE, reminder.getTitle());
    values.put(KEY_DATE, reminder.getDate());
    values.put(KEY_TIME, reminder.getTime());
    values.put(KEY_REPEAT, reminder.getRepeat());
    values.put(KEY_REPEAT_NO, reminder.getRepeatNo());
    values.put(KEY_REPEAT_TYPE, reminder.getRepeatType());
    values.put(KEY_ACTIVE, reminder.getActive());
    // Inserting Row
    long ID = db.insert(TABLE_REMINDERS, null, values);
    db.close();
    return (int) ID;
}

98. CacheDbManager#newEntry()

Project: RedReader
Source File: CacheDbManager.java
View license
synchronized long newEntry(final CacheRequest request, final UUID session, final String mimetype) throws IOException {
    if (session == null) {
        throw new RuntimeException("No session to write");
    }
    final SQLiteDatabase db = this.getWritableDatabase();
    final ContentValues row = new ContentValues();
    row.put(FIELD_URL, request.url.toString());
    row.put(FIELD_USER, request.user.username);
    row.put(FIELD_SESSION, session.toString());
    row.put(FIELD_TYPE, request.fileType);
    row.put(FIELD_STATUS, STATUS_MOVING);
    row.put(FIELD_TIMESTAMP, RRTime.utcCurrentTimeMillis());
    row.put(FIELD_MIMETYPE, mimetype);
    final long result = db.insert(TABLE, null, row);
    if (result < 0)
        throw new IOException("DB insert failed");
    return result;
}

99. NoteManager#UpdateNote()

Project: PinDroid
Source File: NoteManager.java
View license
public static void UpdateNote(Note note, String account, Context context) {
    final String selection = Note.Pid + "=? AND " + Note.Account + "=?";
    final String[] selectionargs = new String[] { note.getPid(), account };
    final ContentValues values = new ContentValues();
    values.put(Note.Title, note.getTitle());
    values.put(Note.Hash, note.getHash());
    values.put(Note.Text, note.getText());
    values.put(Note.Pid, note.getPid());
    values.put(Note.Added, note.getAdded());
    values.put(Note.Updated, note.getUpdated());
    values.put(Note.Account, note.getAccount());
    context.getContentResolver().update(Note.CONTENT_URI, values, selection, selectionargs);
}

100. NoteManager#AddNote()

Project: PinDroid
Source File: NoteManager.java
View license
public static void AddNote(Note note, String account, Context context) {
    final ContentValues values = new ContentValues();
    values.put(Note.Title, note.getTitle());
    values.put(Note.Hash, note.getHash());
    values.put(Note.Text, note.getText());
    values.put(Note.Pid, note.getPid());
    values.put(Note.Added, note.getAdded());
    values.put(Note.Updated, note.getUpdated());
    values.put(Note.Account, note.getAccount());
    context.getContentResolver().insert(Note.CONTENT_URI, values);
}