pull/32/head
gedoor 6 years ago
parent ba3cdee267
commit 66a27fc28d
  1. 6
      app/src/main/java/io/legado/app/data/AppDatabase.kt
  2. 2
      app/src/main/java/io/legado/app/data/entities/BookSource.kt
  3. 4
      app/src/main/java/io/legado/app/ui/main/booksource/BookSourceAdapter.kt

@ -39,11 +39,7 @@ abstract class AppDatabase : RoomDatabase() {
// .addMigrations(MIGRATION_3_4) // .addMigrations(MIGRATION_3_4)
// .addMigrations(MIGRATION_4_5) // .addMigrations(MIGRATION_4_5)
// .addMigrations(MIGRATION_5_6) // .addMigrations(MIGRATION_5_6)
.addCallback(object : Callback() { .fallbackToDestructiveMigration()
override fun onCreate(db: SupportSQLiteDatabase) {
super.onCreate(db)
}
})
.build() .build()
} }

@ -10,7 +10,7 @@ import kotlinx.android.parcel.Parcelize
@Parcelize @Parcelize
@Entity( @Entity(
tableName = "book_sources", tableName = "book_sources",
indices = [(Index(value = ["sourceId"])), (Index(value = ["origin"], unique = false))] indices = [(Index(value = ["origin"], unique = false))]
) )
data class BookSource ( data class BookSource (
@PrimaryKey @PrimaryKey

@ -20,10 +20,10 @@ class BookSourceAdapter : PagedListAdapter<BookSource, BookSourceAdapter.MyViewH
@JvmField @JvmField
val DIFF_CALLBACK = object : DiffUtil.ItemCallback<BookSource>() { val DIFF_CALLBACK = object : DiffUtil.ItemCallback<BookSource>() {
override fun areItemsTheSame(oldItem: BookSource, newItem: BookSource): Boolean = override fun areItemsTheSame(oldItem: BookSource, newItem: BookSource): Boolean =
oldItem.id == newItem.id oldItem.origin == newItem.origin
override fun areContentsTheSame(oldItem: BookSource, newItem: BookSource): Boolean = override fun areContentsTheSame(oldItem: BookSource, newItem: BookSource): Boolean =
oldItem.id == newItem.id oldItem.origin == newItem.origin
&& oldItem.name == newItem.name && oldItem.name == newItem.name
&& oldItem.group == newItem.group && oldItem.group == newItem.group
&& oldItem.isEnabled == newItem.isEnabled && oldItem.isEnabled == newItem.isEnabled

Loading…
Cancel
Save