|
|
|
@ -57,7 +57,7 @@ class BookSourceViewModel(application: Application) : BaseViewModel(application) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun enableSelection(sources: LinkedHashSet<BookSource>) { |
|
|
|
|
fun enableSelection(sources: List<BookSource>) { |
|
|
|
|
execute { |
|
|
|
|
val list = arrayListOf<BookSource>() |
|
|
|
|
sources.forEach { |
|
|
|
@ -67,7 +67,7 @@ class BookSourceViewModel(application: Application) : BaseViewModel(application) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun disableSelection(sources: LinkedHashSet<BookSource>) { |
|
|
|
|
fun disableSelection(sources: List<BookSource>) { |
|
|
|
|
execute { |
|
|
|
|
val list = arrayListOf<BookSource>() |
|
|
|
|
sources.forEach { |
|
|
|
@ -77,7 +77,7 @@ class BookSourceViewModel(application: Application) : BaseViewModel(application) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun enableSelectExplore(sources: LinkedHashSet<BookSource>) { |
|
|
|
|
fun enableSelectExplore(sources: List<BookSource>) { |
|
|
|
|
execute { |
|
|
|
|
val list = arrayListOf<BookSource>() |
|
|
|
|
sources.forEach { |
|
|
|
@ -87,7 +87,7 @@ class BookSourceViewModel(application: Application) : BaseViewModel(application) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun disableSelectExplore(sources: LinkedHashSet<BookSource>) { |
|
|
|
|
fun disableSelectExplore(sources: List<BookSource>) { |
|
|
|
|
execute { |
|
|
|
|
val list = arrayListOf<BookSource>() |
|
|
|
|
sources.forEach { |
|
|
|
@ -97,13 +97,13 @@ class BookSourceViewModel(application: Application) : BaseViewModel(application) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun delSelection(sources: LinkedHashSet<BookSource>) { |
|
|
|
|
fun delSelection(sources: List<BookSource>) { |
|
|
|
|
execute { |
|
|
|
|
App.db.bookSourceDao().delete(*sources.toTypedArray()) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun exportSelection(sources: LinkedHashSet<BookSource>, file: File) { |
|
|
|
|
fun exportSelection(sources: List<BookSource>, file: File) { |
|
|
|
|
execute { |
|
|
|
|
val json = GSON.toJson(sources) |
|
|
|
|
FileUtils.createFileIfNotExist(file, "exportBookSource.json") |
|
|
|
@ -115,7 +115,7 @@ class BookSourceViewModel(application: Application) : BaseViewModel(application) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun exportSelection(sources: LinkedHashSet<BookSource>, doc: DocumentFile) { |
|
|
|
|
fun exportSelection(sources: List<BookSource>, doc: DocumentFile) { |
|
|
|
|
execute { |
|
|
|
|
val json = GSON.toJson(sources) |
|
|
|
|
doc.findFile("exportBookSource.json")?.delete() |
|
|
|
|