From c8179fa59a8fece2abac34abb952a6b02a4afd93 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 19 Feb 2020 11:38:05 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../legado/app/ui/download/DownloadViewModel.kt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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