Search in sources :

Example 6 with ContentValues

use of android.content.ContentValues in project android-job by evernote.

the class JobRequest method setTransient.

/*package*/
void setTransient(boolean isTransient) {
    mTransient = isTransient;
    ContentValues contentValues = new ContentValues();
    contentValues.put(JobStorage.COLUMN_TRANSIENT, mTransient);
    JobManager.instance().getJobStorage().update(this, contentValues);
}
Also used : ContentValues(android.content.ContentValues)

Example 7 with ContentValues

use of android.content.ContentValues in project materialistic by hidroh.

the class ReadabilityClientTest method testEmptyCachedContent.

@Test
public void testEmptyCachedContent() {
    ContentValues cv = new ContentValues();
    cv.put("itemid", "1");
    cv.put("content", "<div></div>");
    resolver.insert(MaterialisticProvider.URI_READABILITY, cv);
    client.parse("1", "http://example.com/article.html", callback);
    verify(TestRestServiceFactory.mercuryService, never()).parse(any());
    verify(callback).onResponse((String) isNull());
}
Also used : ContentValues(android.content.ContentValues) Test(org.junit.Test)

Example 8 with ContentValues

use of android.content.ContentValues in project materialistic by hidroh.

the class SessionManagerTest method setUp.

@Before
public void setUp() {
    resolver = shadowOf(RuntimeEnvironment.application.getContentResolver());
    ContentValues cv = new ContentValues();
    cv.put("itemid", "1");
    resolver.insert(MaterialisticProvider.URI_VIEWED, cv);
    cv = new ContentValues();
    cv.put("itemid", "2");
    resolver.insert(MaterialisticProvider.URI_VIEWED, cv);
    manager = new SessionManager(Schedulers.immediate());
}
Also used : ContentValues(android.content.ContentValues) Before(org.junit.Before)

Example 9 with ContentValues

use of android.content.ContentValues in project materialistic by hidroh.

the class FavoriteManagerTest method setUp.

@Before
public void setUp() {
    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(Schedulers.immediate()) {

        @Override
        protected Uri getUriForFile(Context context, File file) {
            return Uri.parse("content://" + FavoriteManager.FILE_AUTHORITY + "/files/saved/materialistic-export.txt");
        }
    };
}
Also used : ContentValues(android.content.ContentValues) Context(android.content.Context) File(java.io.File) Uri(android.net.Uri) Before(org.junit.Before)

Example 10 with ContentValues

use of android.content.ContentValues in project qksms by moezbhatti.

the class MessageUtils method lockMessage.

public static void lockMessage(Context context, MessageItem msgItem, boolean locked) {
    Uri uri;
    if ("sms".equals(msgItem.mType)) {
        uri = Sms.CONTENT_URI;
    } else {
        uri = Mms.CONTENT_URI;
    }
    final Uri lockUri = ContentUris.withAppendedId(uri, msgItem.mMsgId);
    final ContentValues values = new ContentValues(1);
    values.put("locked", locked ? 1 : 0);
    new Thread(() -> {
        context.getContentResolver().update(lockUri, values, null, null);
    }, "MainActivity.lockMessage").start();
}
Also used : ContentValues(android.content.ContentValues) Uri(android.net.Uri)

Aggregations

ContentValues (android.content.ContentValues)4022 Cursor (android.database.Cursor)721 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)163 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 SQLiteConstraintException (android.database.sqlite.SQLiteConstraintException)55 SQLiteException (android.database.sqlite.SQLiteException)53