Search in sources :

Example 96 with ContentValues

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;
}
Also used : ContentValues(android.content.ContentValues)

Example 97 with ContentValues

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;
}
Also used : ContentValues(android.content.ContentValues)

Example 98 with 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);
    }
}
Also used : ContentValues(android.content.ContentValues) Cursor(android.database.Cursor) Uri(android.net.Uri) ContentResolver(android.content.ContentResolver)

Example 99 with ContentValues

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;
}
Also used : ContentValues(android.content.ContentValues) SimpleDateFormat(java.text.SimpleDateFormat)

Example 100 with ContentValues

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();
}
Also used : ContentValues(android.content.ContentValues) SimpleDateFormat(java.text.SimpleDateFormat)

Aggregations

ContentValues (android.content.ContentValues)3993 Cursor (android.database.Cursor)720 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)638 Uri (android.net.Uri)619 Test (org.junit.Test)374 SQLException (android.database.SQLException)231 ContentResolver (android.content.ContentResolver)212 ArrayList (java.util.ArrayList)192 Intent (android.content.Intent)162 File (java.io.File)156 IOException (java.io.IOException)131 RemoteException (android.os.RemoteException)96 CursorAssert.assertThatCursor (org.hisp.dhis.android.core.data.database.CursorAssert.assertThatCursor)91 NonNull (android.support.annotation.NonNull)74 Date (java.util.Date)73 MediumTest (android.test.suitebuilder.annotation.MediumTest)63 HashMap (java.util.HashMap)62 JSONException (org.json.JSONException)60 SQLiteException (android.database.sqlite.SQLiteException)53 ContentProviderOperation (android.content.ContentProviderOperation)49