use of android.content.ContentValues in project remusic by aa112901.
the class CacheFileInfoDao method packData.
public ContentValues packData(CacheFileInfo cacheFileSize) {
ContentValues cv = new ContentValues();
cv.put("FileName", cacheFileSize.getFileName());
cv.put("FileSize", cacheFileSize.getFileSize());
return cv;
}
use of android.content.ContentValues in project actor-platform by actorapp.
the class SamsungHomeBadger method getContentValues.
private ContentValues getContentValues(int badgeCount, boolean isInsert) {
ContentValues contentValues = new ContentValues();
if (isInsert) {
contentValues.put("package", getContextPackageName());
contentValues.put("class", getEntryActivityName());
}
contentValues.put("badgecount", badgeCount);
return contentValues;
}
use of android.content.ContentValues in project actor-platform by actorapp.
the class SamsungHomeBadger method executeBadge.
@Override
protected void executeBadge(int badgeCount) throws ShortcutBadgeException {
Uri mUri = Uri.parse(CONTENT_URI);
ContentResolver contentResolver = mContext.getContentResolver();
Cursor cursor = null;
try {
cursor = contentResolver.query(mUri, CONTENT_PROJECTION, "package=?", new String[] { getContextPackageName() }, null);
if (cursor != null) {
String entryActivityName = getEntryActivityName();
boolean entryActivityExist = false;
while (cursor.moveToNext()) {
int id = cursor.getInt(0);
ContentValues contentValues = getContentValues(badgeCount, false);
contentResolver.update(mUri, contentValues, "_id=?", new String[] { String.valueOf(id) });
if (entryActivityName.equals(cursor.getString(cursor.getColumnIndex("class")))) {
entryActivityExist = true;
}
}
if (!entryActivityExist) {
ContentValues contentValues = getContentValues(badgeCount, true);
contentResolver.insert(mUri, contentValues);
}
}
} finally {
CloseHelper.close(cursor);
}
}
use of android.content.ContentValues in project CoCoin by Nightonke.
the class DB method saveRecord.
// return the row ID of the newly inserted row, or -1 if an error occurred
public long saveRecord(CoCoinRecord coCoinRecord) {
ContentValues values = new ContentValues();
values.put("MONEY", coCoinRecord.getMoney());
values.put("CURRENCY", coCoinRecord.getCurrency());
values.put("TAG", coCoinRecord.getTag());
values.put("TIME", new SimpleDateFormat("yyyy-MM-dd HH:mm").format(coCoinRecord.getCalendar().getTime()));
values.put("REMARK", coCoinRecord.getRemark());
values.put("USER_ID", coCoinRecord.getUserId());
values.put("OBJECT_ID", coCoinRecord.getLocalObjectId());
values.put("IS_UPLOADED", coCoinRecord.getIsUploaded().equals(Boolean.FALSE) ? 0 : 1);
long insertId = sqliteDatabase.insert(RECORD_DB_NAME_STRING, null, values);
coCoinRecord.setId(insertId);
if (BuildConfig.DEBUG)
Log.d("CoCoin Debugger", "db.saveRecord " + coCoinRecord.toString() + " S");
return insertId;
}
use of android.content.ContentValues in project CoCoin by Nightonke.
the class DB method updateRecord.
// return the id of the coCoinRecord update
public long updateRecord(CoCoinRecord coCoinRecord) {
ContentValues values = new ContentValues();
values.put("ID", coCoinRecord.getId());
values.put("MONEY", coCoinRecord.getMoney());
values.put("CURRENCY", coCoinRecord.getCurrency());
values.put("TAG", coCoinRecord.getTag());
values.put("TIME", new SimpleDateFormat("yyyy-MM-dd HH:mm").format(coCoinRecord.getCalendar().getTime()));
values.put("REMARK", coCoinRecord.getRemark());
values.put("USER_ID", coCoinRecord.getUserId());
values.put("OBJECT_ID", coCoinRecord.getLocalObjectId());
values.put("IS_UPLOADED", coCoinRecord.getIsUploaded().equals(Boolean.FALSE) ? 0 : 1);
sqliteDatabase.update(RECORD_DB_NAME_STRING, values, "ID = ?", new String[] { coCoinRecord.getId() + "" });
if (BuildConfig.DEBUG)
Log.d("CoCoin Debugger", "db.updateRecord " + coCoinRecord.toString() + " S");
return coCoinRecord.getId();
}
Aggregations