Search in sources :

Example 81 with ContentValues

use of android.content.ContentValues in project SeriesGuide by UweTrottmann.

the class MovieTools method buildMoviesContentValues.

private static ContentValues[] buildMoviesContentValues(List<MovieDetails> movies) {
    ContentValues[] valuesArray = new ContentValues[movies.size()];
    int index = 0;
    for (MovieDetails movie : movies) {
        valuesArray[index] = buildMovieContentValues(movie);
        index++;
    }
    return valuesArray;
}
Also used : ContentValues(android.content.ContentValues) SuppressLint(android.annotation.SuppressLint) MovieDetails(com.battlelancer.seriesguide.items.MovieDetails)

Example 82 with ContentValues

use of android.content.ContentValues in project SeriesGuide by UweTrottmann.

the class MovieTools method updateMovie.

private static boolean updateMovie(Context context, int movieTmdbId, String column, boolean value) {
    ContentValues values = new ContentValues();
    values.put(column, value);
    int rowsUpdated = context.getContentResolver().update(SeriesGuideContract.Movies.buildMovieUri(movieTmdbId), values, null, null);
    return rowsUpdated > 0;
}
Also used : ContentValues(android.content.ContentValues) SuppressLint(android.annotation.SuppressLint)

Example 83 with ContentValues

use of android.content.ContentValues in project SeriesGuide by UweTrottmann.

the class TraktRatingsTask method saveShowRating.

private void saveShowRating(Ratings ratings) {
    ContentValues values = new ContentValues();
    values.put(SeriesGuideContract.Shows.RATING_GLOBAL, ratings.rating);
    values.put(SeriesGuideContract.Shows.RATING_VOTES, ratings.votes);
    context.getContentResolver().update(SeriesGuideContract.Shows.buildShowUri(showTvdbId), values, null, null);
}
Also used : ContentValues(android.content.ContentValues)

Example 84 with ContentValues

use of android.content.ContentValues in project SeriesGuide by UweTrottmann.

the class AddListTask method doDatabaseUpdate.

protected boolean doDatabaseUpdate(String listId) {
    ContentValues values = new ContentValues();
    values.put(SeriesGuideContract.Lists.LIST_ID, listId);
    values.put(SeriesGuideContract.Lists.NAME, listName);
    getContext().getContentResolver().insert(SeriesGuideContract.Lists.CONTENT_URI, values);
    // notify lists activity
    EventBus.getDefault().post(new ListsActivity.ListsChangedEvent());
    return true;
}
Also used : ContentValues(android.content.ContentValues) ListsActivity(com.battlelancer.seriesguide.ui.ListsActivity)

Example 85 with ContentValues

use of android.content.ContentValues in project SeriesGuide by UweTrottmann.

the class RateEpisodeTask method doDatabaseUpdate.

@Override
protected boolean doDatabaseUpdate() {
    ContentValues values = new ContentValues();
    values.put(SeriesGuideContract.Episodes.RATING_USER, getRating().value);
    int rowsUpdated = getContext().getContentResolver().update(SeriesGuideContract.Episodes.buildEpisodeUri(episodeTvdbId), values, null, null);
    // notify withshow uri as well (used by episode details view)
    getContext().getContentResolver().notifyChange(SeriesGuideContract.Episodes.buildEpisodeWithShowUri(episodeTvdbId), null);
    return rowsUpdated > 0;
}
Also used : ContentValues(android.content.ContentValues)

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