|
|
@ -33,7 +33,6 @@ import io.legado.app.ui.book.read.page.provider.ImageProvider |
|
|
|
import io.legado.app.ui.book.searchContent.SearchResult |
|
|
|
import io.legado.app.ui.book.searchContent.SearchResult |
|
|
|
import io.legado.app.utils.* |
|
|
|
import io.legado.app.utils.* |
|
|
|
import kotlinx.coroutines.Dispatchers.IO |
|
|
|
import kotlinx.coroutines.Dispatchers.IO |
|
|
|
import kotlinx.coroutines.launch |
|
|
|
|
|
|
|
import java.io.File |
|
|
|
import java.io.File |
|
|
|
import java.io.FileInputStream |
|
|
|
import java.io.FileInputStream |
|
|
|
import java.io.FileNotFoundException |
|
|
|
import java.io.FileNotFoundException |
|
|
@ -429,6 +428,25 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
return arrayOf(pageIndex, lineIndex, charIndex, addLine, charIndex2) |
|
|
|
return arrayOf(pageIndex, lineIndex, charIndex, addLine, charIndex2) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 翻转删除重复标题 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
fun reverseRemoveSameTitle() { |
|
|
|
|
|
|
|
execute { |
|
|
|
|
|
|
|
val book = ReadBook.book |
|
|
|
|
|
|
|
val textChapter = ReadBook.curTextChapter |
|
|
|
|
|
|
|
if (book != null && textChapter != null) { |
|
|
|
|
|
|
|
BookHelp.setRemoveSameTitle( |
|
|
|
|
|
|
|
book, textChapter.chapter, !textChapter.sameTitleRemoved |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
ReadBook.loadContent(ReadBook.durChapterIndex) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 刷新图片 |
|
|
|
|
|
|
|
*/ |
|
|
|
fun refreshImage(src: String) { |
|
|
|
fun refreshImage(src: String) { |
|
|
|
execute { |
|
|
|
execute { |
|
|
|
ReadBook.book?.let { book -> |
|
|
|
ReadBook.book?.let { book -> |
|
|
@ -441,6 +459,9 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 保存图片 |
|
|
|
|
|
|
|
*/ |
|
|
|
@Suppress("BlockingMethodInNonBlockingContext") |
|
|
|
@Suppress("BlockingMethodInNonBlockingContext") |
|
|
|
fun saveImage(src: String?, uri: Uri) { |
|
|
|
fun saveImage(src: String?, uri: Uri) { |
|
|
|
src ?: return |
|
|
|
src ?: return |
|
|
|