Search in sources :

Example 6 with Tweet

use of com.pushtorefresh.storio3.sample.db.entities.Tweet in project storio by pushtorefresh.

the class TweetWithUserGetResolver method mapFromCursor.

// We expect that cursor will contain both Tweet and User: SQL JOIN
@NonNull
@Override
public TweetWithUser mapFromCursor(@NonNull StorIOSQLite storIOSQLite, @NonNull Cursor cursor) {
    final Tweet tweet = Tweet.newTweet(cursor.getLong(cursor.getColumnIndexOrThrow(Relations.QUERY_COLUMN_TWEET_ID)), cursor.getString(cursor.getColumnIndexOrThrow(Relations.QUERY_COLUMN_TWEET_AUTHOR)), cursor.getString(cursor.getColumnIndexOrThrow(Relations.QUERY_COLUMN_TWEET_CONTENT)));
    final User user = User.newUser(cursor.getLong(cursor.getColumnIndexOrThrow(Relations.QUERY_COLUMN_USER_ID)), cursor.getString(cursor.getColumnIndexOrThrow(Relations.QUERY_COLUMN_USER_NICK)));
    return new TweetWithUser(tweet, user);
}
Also used : TweetWithUser(com.pushtorefresh.storio3.sample.db.entities.TweetWithUser) User(com.pushtorefresh.storio3.sample.db.entities.User) TweetWithUser(com.pushtorefresh.storio3.sample.db.entities.TweetWithUser) Tweet(com.pushtorefresh.storio3.sample.db.entities.Tweet) NonNull(android.support.annotation.NonNull)

Aggregations

Tweet (com.pushtorefresh.storio3.sample.db.entities.Tweet)5 NonNull (android.support.annotation.NonNull)2 TweetWithUser (com.pushtorefresh.storio3.sample.db.entities.TweetWithUser)2 User (com.pushtorefresh.storio3.sample.db.entities.User)2 Disposable (io.reactivex.disposables.Disposable)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 SuppressLint (android.annotation.SuppressLint)1 SampleApp (com.pushtorefresh.storio3.sample.SampleApp)1 UserWithTweets (com.pushtorefresh.storio3.sample.db.entities.UserWithTweets)1 Test (org.junit.Test)1