This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NewGuide { | |
@PrimaryKey lateinit var remote_id: String | |
@ColumnInfo(name = "created_at") lateinit var createdAt: String | |
@ColumnInfo(name = "updated_at") var updatedAt: String? = null | |
@ColumnInfo lateinit var title: String | |
@ColumnInfo lateinit var description: String | |
@ColumnInfo var imageUrl: String? = null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity(tableName = Sql.TABLE_GUIDES) | |
data class Guide( | |
@PrimaryKey lateinit var remote_id: String, | |
@ColumnInfo lateinit var created_at: String, | |
@ColumnInfo var updated_at: String? = null, | |
@ColumnInfo val title: String, | |
@ColumnInfo val description: String | |
... | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.contentful.vault | |
import android.annotation.SuppressLint | |
import android.arch.persistence.room.RoomMasterTable | |
import android.database.sqlite.SQLiteDatabase | |
object VaultSpy { | |
@SuppressLint("RestrictedApi") | |
fun Vault.updateRoomIdentityHash(hash: String) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// old way | |
return vault.observe(Guide::class.java) | |
.all() | |
.filter({ guide -> guide.remoteId() == guideId }) | |
.buffer(RESULT_SET_DEFAULT) | |
.first(listOf()) | |
.toFlowable().toLiveData() | |
// new way | |
return dao.getGuidesByAuthorId(authorId) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Dao | |
interface GuideDao { | |
@Query(SELECT_GUIDE_JOIN_DETAILS + " where creatorId = :arg0") | |
fun getGuidesByAuthorId(arg0: String): Flowable<List<NewGuide>> | |
@Query(SELECT_GUIDE_JOIN_DETAILS + " order by guides.created_at DESC limit :arg0") | |
fun getLastUpdated(arg0: Int): Flowable<List<NewGuide>> | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (C) 2017 Mitchell Skaggs, Keturah Gadson, Ethan Holtgrieve, Nathan Skelton, Pattonville School District | |
* | |
* This program is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation, either version 3 of the License, or | |
* (at your option) any later version. | |
* | |
* This program is distributed in the hope that it will be useful, | |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RequestQueueProvider { | |
private static RequestQueue mRequestQueue; | |
public static RequestQueue getRequestQueue(Context context) { | |
if (mRequestQueue == null) { | |
mRequestQueue = newSitecoreRequestQueue(context.getContentResolver()); | |
} | |
return mRequestQueue; | |
} |