diff --git a/app/src/main/java/io/legado/app/ui/download/DownloadViewModel.kt b/app/src/main/java/io/legado/app/ui/download/DownloadViewModel.kt index 2763132eb..7258e1c4d 100644 --- a/app/src/main/java/io/legado/app/ui/download/DownloadViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/download/DownloadViewModel.kt @@ -3,8 +3,11 @@ package io.legado.app.ui.download import android.app.Application import android.net.Uri import androidx.documentfile.provider.DocumentFile +import io.legado.app.App +import io.legado.app.R import io.legado.app.base.BaseViewModel import io.legado.app.data.entities.Book +import io.legado.app.help.BookHelp import io.legado.app.utils.FileUtils import io.legado.app.utils.isContentPath import java.io.File @@ -41,4 +44,16 @@ class DownloadViewModel(application: Application) : BaseViewModel(application) { } + private fun getAllContents(book: Book): String { + val stringBuilder = StringBuilder() + stringBuilder.append(book.name) + .append("\n") + .append(context.getString(R.string.author_show, book.author)) + App.db.bookChapterDao().getChapterList(book.bookUrl).forEach { chapter -> + BookHelp.getContent(book, chapter)?.let { + stringBuilder.append("\n").append(it) + } + } + return stringBuilder.toString() + } } \ No newline at end of file