diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 18c558fe6..c87caef2e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -246,7 +246,7 @@ android:screenOrientation="behind" /> diff --git a/app/src/main/java/io/legado/app/ui/book/toc/BookmarkFragment.kt b/app/src/main/java/io/legado/app/ui/book/toc/BookmarkFragment.kt index 976436e56..609683d90 100644 --- a/app/src/main/java/io/legado/app/ui/book/toc/BookmarkFragment.kt +++ b/app/src/main/java/io/legado/app/ui/book/toc/BookmarkFragment.kt @@ -22,10 +22,10 @@ import io.legado.app.utils.requestInputMethod import io.legado.app.utils.viewbindingdelegate.viewBinding -class BookmarkFragment : VMBaseFragment(R.layout.fragment_bookmark), +class BookmarkFragment : VMBaseFragment(R.layout.fragment_bookmark), BookmarkAdapter.Callback, - ChapterListViewModel.BookmarkCallBack { - override val viewModel: ChapterListViewModel by activityViewModels() + TocViewModel.BookmarkCallBack { + override val viewModel: TocViewModel by activityViewModels() private val binding by viewBinding(FragmentBookmarkBinding::bind) private lateinit var adapter: BookmarkAdapter private var bookmarkLiveData: LiveData>? = null diff --git a/app/src/main/java/io/legado/app/ui/book/toc/ChapterListFragment.kt b/app/src/main/java/io/legado/app/ui/book/toc/ChapterListFragment.kt index 57ccc8305..e2ba1cfa1 100644 --- a/app/src/main/java/io/legado/app/ui/book/toc/ChapterListFragment.kt +++ b/app/src/main/java/io/legado/app/ui/book/toc/ChapterListFragment.kt @@ -28,10 +28,10 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import kotlin.math.min -class ChapterListFragment : VMBaseFragment(R.layout.fragment_chapter_list), +class ChapterListFragment : VMBaseFragment(R.layout.fragment_chapter_list), ChapterListAdapter.Callback, - ChapterListViewModel.ChapterListCallBack { - override val viewModel: ChapterListViewModel by activityViewModels() + TocViewModel.ChapterListCallBack { + override val viewModel: TocViewModel by activityViewModels() private val binding by viewBinding(FragmentChapterListBinding::bind) lateinit var adapter: ChapterListAdapter private var durChapterIndex = 0 diff --git a/app/src/main/java/io/legado/app/ui/book/toc/ChapterListActivity.kt b/app/src/main/java/io/legado/app/ui/book/toc/TocActivity.kt similarity index 88% rename from app/src/main/java/io/legado/app/ui/book/toc/ChapterListActivity.kt rename to app/src/main/java/io/legado/app/ui/book/toc/TocActivity.kt index 4f429447a..57a213a49 100644 --- a/app/src/main/java/io/legado/app/ui/book/toc/ChapterListActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/toc/TocActivity.kt @@ -2,6 +2,7 @@ package io.legado.app.ui.book.toc import android.os.Bundle import android.view.Menu +import android.view.MenuItem import androidx.activity.viewModels import androidx.appcompat.widget.SearchView import androidx.core.view.isGone @@ -19,8 +20,8 @@ import io.legado.app.utils.gone import io.legado.app.utils.visible -class ChapterListActivity : VMBaseActivity() { - override val viewModel: ChapterListViewModel +class TocActivity : VMBaseActivity() { + override val viewModel: TocViewModel by viewModels() private lateinit var tabLayout: TabLayout @@ -47,7 +48,7 @@ class ChapterListActivity : VMBaseActivity viewModel.reverseToc() + } + return super.onCompatOptionsItemSelected(item) + } + private inner class TabFragmentPageAdapter : FragmentStateAdapter(this) { override fun getItemCount(): Int { diff --git a/app/src/main/java/io/legado/app/ui/book/toc/TocActivityResult.kt b/app/src/main/java/io/legado/app/ui/book/toc/TocActivityResult.kt index 1e8f688de..e727de0b2 100644 --- a/app/src/main/java/io/legado/app/ui/book/toc/TocActivityResult.kt +++ b/app/src/main/java/io/legado/app/ui/book/toc/TocActivityResult.kt @@ -8,7 +8,7 @@ import androidx.activity.result.contract.ActivityResultContract class TocActivityResult : ActivityResultContract?>() { override fun createIntent(context: Context, input: String?): Intent { - return Intent(context, ChapterListActivity::class.java) + return Intent(context, TocActivity::class.java) .putExtra("bookUrl", input) } diff --git a/app/src/main/java/io/legado/app/ui/book/toc/ChapterListViewModel.kt b/app/src/main/java/io/legado/app/ui/book/toc/TocViewModel.kt similarity index 70% rename from app/src/main/java/io/legado/app/ui/book/toc/ChapterListViewModel.kt rename to app/src/main/java/io/legado/app/ui/book/toc/TocViewModel.kt index f85ff5749..f56c68ff3 100644 --- a/app/src/main/java/io/legado/app/ui/book/toc/ChapterListViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/toc/TocViewModel.kt @@ -7,7 +7,7 @@ import io.legado.app.base.BaseViewModel import io.legado.app.data.appDb import io.legado.app.data.entities.Book -class ChapterListViewModel(application: Application) : BaseViewModel(application) { +class TocViewModel(application: Application) : BaseViewModel(application) { var bookUrl: String = "" var bookData = MutableLiveData() var chapterCallBack: ChapterListCallBack? = null @@ -22,6 +22,17 @@ class ChapterListViewModel(application: Application) : BaseViewModel(application } } + fun reverseToc() { + execute { + val toc = appDb.bookChapterDao.getChapterList(bookUrl) + val newToc = toc.reversed() + newToc.forEachIndexed { index, bookChapter -> + bookChapter.index = index + } + appDb.bookChapterDao.insert(*newToc.toTypedArray()) + } + } + fun startChapterListSearch(newText: String?) { chapterCallBack?.startChapterListSearch(newText) } diff --git a/app/src/main/res/menu/book_toc.xml b/app/src/main/res/menu/book_toc.xml new file mode 100644 index 000000000..59efd4075 --- /dev/null +++ b/app/src/main/res/menu/book_toc.xml @@ -0,0 +1,18 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-ja-rJP/strings.xml b/app/src/main/res/values-ja-rJP/strings.xml index 78554f9eb..0781727fb 100644 --- a/app/src/main/res/values-ja-rJP/strings.xml +++ b/app/src/main/res/values-ja-rJP/strings.xml @@ -1,5 +1,842 @@ + + Legado + Legado·search + Legado needs storage access to find and read books. please go "App Settings" to allow "Storage permission". + + Home + Restore + Import Legado data + Create a subfolder + Create a folder named Legado as the backup folder. + Offline cache book backup + Export to local and back up to the exports directory under the legado folder + Backup to + Please select a backup path. + Import legacy data + Import github data + Replacement + Send - \ No newline at end of file + Prompt + Cancel + Confirm + Go to Settings + Cannot jump to Settings. + + Retry + Loading + Warning + Edit + Delete + Delete all + Replace + Replacement + Configure replacement rules + Not available now + Enable + Search Replacement + Bookshelf + Favorites + Favorite + in Favorites + Not in Favorites + Subscription + All + Recent reading + Last reading + What\'s new + The bookshelf is still empty. Search for books or add them from discovery! \n if you use it for the first time, please pay attention to the public account [开源阅读] to get the book source! + Search + Download + List + Grid-3 + Grid-4 + Grid-5 + Grid-6 + Layout + View + Library + Import books + Book sources + Sources management + Create/Import/Edit/Manage Book sources + Settings + Theme settings + Some settings related to interface or color + Other settings + Some function-related settings + About + Donations + Exit + It has not been saved. Do you want to continue editing? + Book styles + Version + Local + Search + Origin: %s + Origin: %s + Title + Latest: %s + Would you like to add %s to your Bookshelf? + %s text file(s) in total + Loading… + Retry + Web service + Web edit source and read book + Edit book sources on the web + http://%1$s:%2$d + Offline cache + Offline cache + cache the selected chapter(s) to Storage + Change Origin + + \u3000\u3000 This is an open source reading software newly developed by Kotlin, welcome to join us. Follow the WeChat Official Account [开源阅读]! + + + Legado (YueDu 3.0) download link:\n https://play.google.com/store/apps/details?id=io.legado.play.release + + Version %s + Background-verification + you can operate freely when verifying the book source + Auto-refresh + Update books automatically when opening the software + Auto-download + Download the latest chapters automatically when updating books + Backup and restore + WebDav settings + WebDav settings/Import legacy data + Backup + Restore + Backup needs storage permission + Restore needs storage permission + OK + Cancel + Backup confirmation + The new backup files will replace the original.\n Backup folder: YueDu + Restore confirmation + Restoring the bookshelf data will overwrite the current Bookshelf. + Backup succeed + Backup failed + Restoring + Restore succeed + Backup failed + Screen orientation + Auto(sensor) + Landscape + Portrait + Follow system + Disclaimer + %d chapters + Interface + Brightness + Chapters + Next + Prior + Hide status bar + Hide system navigation bar when reading + Speech + Speaking + Click to open the Reading + Play + Playing + Click to open the Playing + Pause + Back + Refresh + Start + Stop + Pause + Resume + Timer + Speak Paused + Speaking(%d min left) + Playing(%d min left) + Hide virtual buttons when reading + Hide navigation bar + Navigation bar color + GitHub + Rating + Email + Open failed + Share failed + No chapters + Add url + Add book url + Background + Author + Author: %s + Speak Stopped + Clear cache + Cache cleared + Save + Edit source + Edit Book source + Disable Book source + Add Book source + Add subscription source + Add books + Scan + Copy source + Paste source + Source rules description + Check for Updates + Scan QR code + Scan local images + Rules description + Share + Share to + Follow system + Add + Import book sources + Import local + Import online + Replacement + Edit replacement rule + Pattern + Replacement + Cover + Book + Volume keys to turn page + Tap screen to turn page + Flip animation + Flip animation (book) + Keep screen awake + Back + Menu + Adjust + Scroll bar + Clearing the cache will delete all saved chapters. Are you sure to delete it? + Book sources sharing + Rule name + Pattern rule is empty or does not conform the regex specification. + Selection action + Select all + Select all(%1$d/%2$d) + Cancel select all(%1$d/%2$d) + Dark mode + Welcome page + Download start + Download cancel + No download + Downloaded %1$d/%2$d + Import selected book(s) + Number of concurrent tasks + Change icon + Remove + Start reading + Loading… + Load failed, tap to retry + Book description + Description:%s + Description: no introduction + Open external book + Origin: %s + Import local rules + Import online rules + Check interval for updates + By recent list + By update time + By book title + By sort manually + Reading strategy + Typesetting + Delete selected + Are you sure to delete? + Default font + Discovery + Discovery + No content.Go to Sources management to add it! + Delete all + Search history + Clear + Display book title on text + Book Sources sync + No latest chapter. + Display time and battery + Display divider + Darken the status bar\'s icon color + Content + Copy + Download all + This is a test text, \n\u3000\u3000 just to show you the effect + Color and background (long tap to customize) + Immersive status bar + %d chapter(s) left + No selected + Long tap to input color value + Loading… + Awaiting + Awaiting more + Bookmarks + Add to Bookmarks + Delete + Loading timeout + Follow:%s + Copied successfully + Bookshelf arrangement + It will delete all books. Be careful,please. + Search book sources + Search subscription sources + Search( %d sources in total) + Chapters(%d) + Bold + Font + Text + Home page + Right + Left + Bottom + Top + Padding + Padding top + Padding bottom + Padding left + Padding right + Check book sources + Check the selected source + %1$s Progress %2$d/%3$d + Please install and select Chinese TTS! + TTS initialization failed! + Simplified conversion + Off + Simplified to traditional + Traditional to simplified + Flipping mode + %1$d items + Storage: + Add to Bookshelf + Add to Bookshelf(%1$d) + %1$d books added successfully + Please put the font files in the Fonts folder of the storage root directory and reselect + Default font + Select fonts + Text size + Line spacing + Paragraph spacing + To Top + To Bottom + Auto expand Discovery + Default expand the first Discovery. + Current threads %s + Speech rate + Auto scroll + Stop Auto scroll + Auto scroll speed + Book information + Edit book information + Use Bookshelf as start page + Auto jump to Recent list + Replacement object. Book name or source url is available + Groups + Cache path + System file picker + New version + Download updates + Volume keys to turn page when reading + Margin adjustment + Enable update + Disable update + Inverse + Search book name/author + Book name,Author,URL + FAQ + Display all Discovery + Display the selected origin\'s Discovery if closed + Update chapters + Txt Chapters Regex + Text encoding + Ascending/Descending order + Sort + Sort automatically + Sort manually + Sort by name + Scroll to the top + Scroll to the bottom + Read: %s + Awaiting update + Awaiting more + Finished + All + Awaiting update books + Awaiting more chapters books + Finished books + Local books + The status bar color becomes transparent + immersion navigation bar + The navigation bar becomes transparent + Add to Bookshelf + Continue reading + Cover path + Cover + Slide + Simulation + Scroll + None + This book source uses advanced features, please go to the Donations and tap the Alipay red envelope search code to receive the red envelope,then you can use it. + Update the latest chapter after changed origin in the background + if enabled,the update will start 1 minute later when the software is run + Auto hide ToolBar + The toolbar will be hidden automatically when scroll the Bookshelf + Login + Login%s + Success + The current source has not configured with a login address + No prior page + No next page + + + 源名称(sourceName) + 源URL(sourceUrl) + 源分组(sourceGroup) + 自定义源分组 + 输入自定义源分组名称 + 【%s】 + 分类Url + 登录URL(loginUrl) + 源注释(sourceComment) + 搜索地址(url) + 发现地址规则(url) + 书籍列表规则(bookList) + 书名规则(name) + 详情页url规则(bookUrl) + 作者规则(author) + 分类规则(kind) + 简介规则(intro) + 封面规则(coverUrl) + 最新章节规则(lastChapter) + 字数规则(wordCount) + 书籍URL正则(bookUrlPattern) + 预处理规则(bookInfoInit) + 目录URL规则(tocUrl) + 允许修改书名作者(canReName) + 目录下一页规则(nextTocUrl) + 目录列表规则(chapterList) + 章节名称规则(ChapterName) + 章节URL规则(chapterUrl) + VIP标识(isVip) + 更新时间(ChapterInfo) + 正文规则(content) + 正文下一页URL规则(nextContentUrl) + WebViewJs(webJs) + 资源正则(sourceRegex) + 替换规则(replaceRegex) + 图片样式(imageStyle) + + 图标(sourceIcon) + 列表规则(ruleArticles) + 列表下一页规则(ruleArticles) + 标题规则(ruleTitle) + guid规则(ruleGuid) + 时间规则(rulePubDate) + 类别规则(ruleCategories) + 描述规则(ruleDescription) + 图片url规则(ruleImage) + 内容规则(ruleContent) + 样式(style) + 链接规则(ruleLink) + + + + No source + Failed to obtain book information + Failed to obtain content + Failed to obtain chapters list + Failed to access website:%s + Failed to read file + Failed to load chapters list + Failed to get data + Failed to load\n%s + No network + Network connection timeout + Data parsing failed + + + HTTP Header + Debug source + Import from QR code + Share selected sources + Scan QR code + Tap to display Menu when selected + Theme + Theme mode + Select a theme you want + Join QQ group + Set the background image requires storage permission + Input book source address + Delete file + Deleted file + Are you sure to delete this file? + Directory + Intelligent import + Discovery + Switch display styles + Import local books requires storage permission + Night Theme + E-Ink + Optimization for E-ink devices + This software requires storage permission to store the book information to be backed up + Tap again to exit the program + Import local books requires storage permission + Network connection is not available + Yes + No + OK + Are you sure to delete it? + Are you sure to delete %s? + Are you sure to delete all books? + Do you want to delete the downloaded book chapters at the same time? + Scan QR code requires Camera permissions + Speech is running, cannot turn pages automatically + Input encoding + Txt Chapters Regex + Open local books requires storage permission + No bookName + Input replacement rule URL + Search list obtained successfully%d + name and URL cannot be empty + Gallery + get AliPay red envelopes + No update address + Opening the homepage, it will return to start page automatically after success + After successful login, please tap the icon on the upper right corner to test the homepage access + Chapter + To + Using Regex + Indent + None + Indent with 1 chars + Indent with 2 chars + Indent with 3 chars + Indent with 4 chars + Select a folder + Select a file + No Discovery, you can add it in BookSource + Restore default + Custom cache path requires Storage permission + Black + No content + Changing source, wait please + Chapters is empty + Word spacing + + Basic + Search + Discovery + Information + Chapters + Content + + E-Ink mode + Remove animations and optimize the experience of using E-paper books + Web service + Web port + Current port %s + QR code sharing + Strings sharing + Wifi sharing + Please grant Storage Permission + Speed down + Speed up + Prior + Next + Music + Audio + Enable + Enable js + Load BaseUrl + All Sources + The input content cannot be empty + Clear Discovery cache + Edit Discovery + Switch the software icon displayed on the desktop + Help + Me + Read + %d%% + %d min + Auto-Brightness %s + Speak by pages + Speak Engine + Background images + Background color + Text color + Select a picture + Group management + Group selection + Group editing + Move to group + Add to Groups + Remove from Groups + New replacement + Group + Group: %s + Chapters: %s + Enable Discovery + Disable Discovery + Enable selected + Disable selected + Export selected + Export + Load chapters + Load book detail + TTS + WebDav password + Input you WebDav authorized password + Input you server address + WebDav server address + WebDav account + Input your WebDav account + Subscription source + Edit Subscription source + Filter + Search Discovery sources + Current location: + Precise search + Starting service + Empty + File selection + Folder selection + I AM OVER! + Uri To Path failed + Refresh cover + Change origin + Local image + Type: + Background + Importing + Exporting + Set page-turning buttons + Page up button + Page down button + Add this book to Bookshelf first + Ungrouped + Prior sentence + Next sentence + Other folder + There are too many words to create a QR code + Subscription sources sharing + Book sources sharing + Automatic switching dark mode + Following system dark mode + Go back + Online Speech tone + (%1$d/%2$d) + Display Subscription + Service stopped + Starting service\nChecking notification bar for details + Default path + System folder picker + App folder picker + App file picker + Android 10+ unable to read and write file due to permission restrictions + Long tap to display Legado·Search in the operation menu + Text operation display Search + Log + Log + Simplified conversion + The icon is a vector icon, which was not supported before Android 8.0 + Speech settings + Start page + Long Tap to select text + Header + Content + Footer + Select end + Select start + Shared layout + Browser + Import default rules + Name + Regex + More menu + Minus + Plus + System typeface + Delete source file + Default-1 + Default-2 + Default-3 + Title + Left + Center + Hide + Add to Group + Save image + No default path + Group settings + View Chapters + Navigation bar shadow + Current shadow size(elevation): %s + Default + Main menu + Tap to grant permission + Legado needs Storage permission, please tap the "Grant Permission" button below, or go to "Settings"-"Application Permissions"-to open the required permission. If the permission is still not work, please tap "Select Folder" in the upper right corner to use the system folder picker. + The selected text cannot be spoken in full text speech + Extend to cutout + Updating Chapters + Headset buttons are always available + Headset buttons are available even exit the app. + Contributors + Contact + License + Other + 开源阅读 + Follow WeChat Official Accounts + WeChat + Supporting me will be appreciated + Official Accounts[开源阅读] + Changing source + Tap to join + Middle + Information + Switch Layout + Text font weight switching + Full screen gestures support + + + Primary + Accent + Background color + NavBar color + Day + Day,Primary + Day,Accent + Day,Background color + Day,NavBar color + Night + Night,Primary + Night,Accent + Night,Background color + Night,NavBar color + Change source automatically + Text justified + Text align bottom + Auto scroll speed + Sort by URL + Backup the local and WebDav simultaneously + Restore from WebDAV first, Restore form the local backup on long click + Select a legacy backup folder + Enabled + Disabled + Starting download + This book is already in Download list + Click to open + Follow [开源阅读] to support me by clicking on ads + WeChat Tipping Code + AliPay + AliPay red envelope search code + 537954522 Click to copy + AliPay red envelope QR code + AliPay QR code + QQ Collection QR code + gedoor,Invinciblelee etc. Checking in github for details + Clear the cache of the downloaded books and fonts + Default cover + Bypass list + Ignore some contents while restoring + Reading interface settings + Group name + Remarks section + Enable replace rule by default + For new added books + Select restore file + Day background can not be too dark! + Day bottom can not be too dark! + Night background can not be too bright! + Night bottom can not be too bright! + Need Difference between accent and background color + Need Difference between accent and text color + Wrong format + Error + Show brightness widget + Language + Import rss source + Your donation makes this app better + Wechat official account [开源阅读软件] + Read record + Read record summary + Local TTS + Thread count + Total read time + Unselect all + Import + Export + Save theme config + Save day theme config + Save night theme config + Theme list + Save, Import, Share theme + Switch default theme + Sort by update time + Search content + Follow Wechat official account [开源阅读] to get Subscription source + Empty now,Follow Wechat official account [开源阅读] to get Discovery source + 将焦点放到输入框按下物理按键会自动录入键值,多个按键会自动用英文逗号隔开. + Theme name + "Clear expired search histories automatically " + Search histories more than one day + Re-segment + Style name: + Click the folder icon in the upper right corner and select the folder + Intelligent scanning + No books + Keep the original name + Screen touch control + Close + Next page + Prior page + None + Title + Show/Hide + footer header + Rule Subscription + 添加大佬们提供的规则导入地址\n添加后点击可导入规则 + Pull the cloud progress + The current progress exceeds the cloud progress. Do you want to synchronize? + Synchronous reading progress + Synchronize reading progress when entering / exiting the reading interface + Failed to create bookmark + Single URL + Export the list of books + Import the list of books + Download in advance + Download 10 chapters in advance + Is enabled + Background image + Copy book URL + Copy chapters URL + Export to a folder + Exported text coding + Export to WebDav + Reverse content + Debug + Crash log + Custom Chinese line feed + Style of Images + System tts + Exported file format + Check by author + This URL has subscribed + High screen refresh rate + Use maximum screen refresh rate + Export all + Finished + Show unread flag + Always show default cover + Always show the default cover, do not show the network cover + Search source code + Book source code + Chapters source code + Content source code + List source code + Font size + Margin top + Marigin bottom + Show + Hide + Hide when status bar show + Reverse toc + diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 11a473d30..366b70c61 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -838,5 +838,6 @@ Show Hide Hide when status bar show + 反转目录 diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index daac50b21..4a8e636c0 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -836,5 +836,6 @@ 自訂源分組 輸入自訂源分組名稱 【%s】 + 反转目录 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 8393ace59..182ea03aa 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -837,5 +837,6 @@ 显示 隐藏 状态栏显示时隐藏 + 反转目录 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index bc4d43fe5..170d773e0 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -837,5 +837,6 @@ 显示 隐藏 状态栏显示时隐藏 + 反转目录 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0925fdb99..0781727fb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -838,4 +838,5 @@ Show Hide Hide when status bar show + Reverse toc