diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 6c95c79ce..d33213e6e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -249,7 +249,7 @@ android:screenOrientation="behind" /> diff --git a/app/src/main/java/io/legado/app/constant/AppConst.kt b/app/src/main/java/io/legado/app/constant/AppConst.kt index d8c5b2d00..aed422165 100644 --- a/app/src/main/java/io/legado/app/constant/AppConst.kt +++ b/app/src/main/java/io/legado/app/constant/AppConst.kt @@ -39,6 +39,7 @@ object AppConst { SimpleDateFormat("yy-MM-dd-HH-mm-ss") } + const val rootGroupId = -100L const val bookGroupAllId = -1L const val bookGroupLocalId = -2L const val bookGroupAudioId = -3L diff --git a/app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookAdapter.kt b/app/src/main/java/io/legado/app/ui/book/manage/BookAdapter.kt similarity index 98% rename from app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookAdapter.kt rename to app/src/main/java/io/legado/app/ui/book/manage/BookAdapter.kt index d55938e5c..a7564cf5b 100644 --- a/app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/manage/BookAdapter.kt @@ -1,4 +1,4 @@ -package io.legado.app.ui.book.arrange +package io.legado.app.ui.book.manage import android.annotation.SuppressLint import android.content.Context @@ -15,7 +15,7 @@ import io.legado.app.lib.theme.backgroundColor import io.legado.app.ui.widget.recycler.DragSelectTouchHelper import io.legado.app.ui.widget.recycler.ItemTouchCallback -class ArrangeBookAdapter(context: Context, val callBack: CallBack) : +class BookAdapter(context: Context, val callBack: CallBack) : RecyclerAdapter(context), ItemTouchCallback.Callback { diff --git a/app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/manage/BookshelfManageActivity.kt similarity index 92% rename from app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookActivity.kt rename to app/src/main/java/io/legado/app/ui/book/manage/BookshelfManageActivity.kt index 85c67d54c..e60b27d85 100644 --- a/app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/manage/BookshelfManageActivity.kt @@ -1,4 +1,4 @@ -package io.legado.app.ui.book.arrange +package io.legado.app.ui.book.manage import android.annotation.SuppressLint import android.os.Bundle @@ -39,19 +39,20 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.withContext -class ArrangeBookActivity : VMBaseActivity(), +class BookshelfManageActivity : + VMBaseActivity(), PopupMenu.OnMenuItemClickListener, SelectActionBar.CallBack, - ArrangeBookAdapter.CallBack, + BookAdapter.CallBack, SourcePickerDialog.Callback, GroupSelectDialog.CallBack { override val binding by viewBinding(ActivityArrangeBookBinding::inflate) - override val viewModel by viewModels() + override val viewModel by viewModels() override val groupList: ArrayList = arrayListOf() private val groupRequestCode = 22 private val addToGroupRequestCode = 34 - private val adapter by lazy { ArrangeBookAdapter(this, this) } + private val adapter by lazy { BookAdapter(this, this) } private var booksFlowJob: Job? = null private var menu: Menu? = null private var groupId: Long = -1 @@ -139,6 +140,7 @@ class ArrangeBookActivity : VMBaseActivity appDb.bookDao.flowNoGroup() AppConst.bookGroupAllId -> appDb.bookDao.flowAll() AppConst.bookGroupLocalId -> appDb.bookDao.flowLocal() AppConst.bookGroupAudioId -> appDb.bookDao.flowAudio() @@ -146,12 +148,18 @@ class ArrangeBookActivity : VMBaseActivity appDb.bookDao.flowByGroup(groupId) }.conflate().map { books -> when (getPrefInt(PreferKey.bookshelfSort)) { - 1 -> books.sortedByDescending { it.latestChapterTime } + 1 -> books.sortedByDescending { + it.latestChapterTime + } 2 -> books.sortedWith { o1, o2 -> o1.name.cnCompare(o2.name) } - 3 -> books.sortedBy { it.order } - else -> books.sortedByDescending { it.durChapterTime } + 3 -> books.sortedBy { + it.order + } + else -> books.sortedByDescending { + it.durChapterTime + } } }.conflate().collect { books -> adapter.setItems(books) diff --git a/app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookViewModel.kt b/app/src/main/java/io/legado/app/ui/book/manage/BookshelfManageViewModel.kt similarity index 93% rename from app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookViewModel.kt rename to app/src/main/java/io/legado/app/ui/book/manage/BookshelfManageViewModel.kt index da6ef4862..c404851e3 100644 --- a/app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/manage/BookshelfManageViewModel.kt @@ -1,4 +1,4 @@ -package io.legado.app.ui.book.arrange +package io.legado.app.ui.book.manage import android.app.Application import androidx.compose.runtime.mutableStateOf @@ -10,7 +10,7 @@ import io.legado.app.help.coroutine.Coroutine import io.legado.app.model.webBook.WebBook -class ArrangeBookViewModel(application: Application) : BaseViewModel(application) { +class BookshelfManageViewModel(application: Application) : BaseViewModel(application) { val batchChangeSourceState = mutableStateOf(false) val batchChangeSourceSize = mutableStateOf(0) diff --git a/app/src/main/java/io/legado/app/ui/book/arrange/ComposeView.kt b/app/src/main/java/io/legado/app/ui/book/manage/ComposeView.kt similarity index 97% rename from app/src/main/java/io/legado/app/ui/book/arrange/ComposeView.kt rename to app/src/main/java/io/legado/app/ui/book/manage/ComposeView.kt index bfb86ed15..ffa57baa2 100644 --- a/app/src/main/java/io/legado/app/ui/book/arrange/ComposeView.kt +++ b/app/src/main/java/io/legado/app/ui/book/manage/ComposeView.kt @@ -1,4 +1,4 @@ -package io.legado.app.ui.book.arrange +package io.legado.app.ui.book.manage import androidx.compose.foundation.layout.Column import androidx.compose.material.AlertDialog diff --git a/app/src/main/java/io/legado/app/ui/book/arrange/SourcePickerDialog.kt b/app/src/main/java/io/legado/app/ui/book/manage/SourcePickerDialog.kt similarity index 99% rename from app/src/main/java/io/legado/app/ui/book/arrange/SourcePickerDialog.kt rename to app/src/main/java/io/legado/app/ui/book/manage/SourcePickerDialog.kt index 50101e9a6..1be0837dc 100644 --- a/app/src/main/java/io/legado/app/ui/book/arrange/SourcePickerDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/manage/SourcePickerDialog.kt @@ -1,4 +1,4 @@ -package io.legado.app.ui.book.arrange +package io.legado.app.ui.book.manage import android.content.Context import android.os.Bundle diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/BaseBookshelfFragment.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/BaseBookshelfFragment.kt index e4f0847f0..78d16eb92 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/BaseBookshelfFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/BaseBookshelfFragment.kt @@ -19,10 +19,10 @@ import io.legado.app.help.DirectLinkUpload import io.legado.app.help.config.AppConfig import io.legado.app.lib.dialogs.alert import io.legado.app.ui.about.AppLogDialog -import io.legado.app.ui.book.arrange.ArrangeBookActivity import io.legado.app.ui.book.cache.CacheActivity import io.legado.app.ui.book.group.GroupManageDialog import io.legado.app.ui.book.local.ImportBookActivity +import io.legado.app.ui.book.manage.BookshelfManageActivity import io.legado.app.ui.book.search.SearchActivity import io.legado.app.ui.document.HandleFileContract import io.legado.app.ui.main.MainViewModel @@ -80,7 +80,7 @@ abstract class BaseBookshelfFragment(layoutId: Int) : VMBaseFragment showDialogFragment() R.id.menu_add_local -> startActivity() R.id.menu_add_url -> addBookByUrl() - R.id.menu_arrange_bookshelf -> startActivity { + R.id.menu_bookshelf_manage -> startActivity { putExtra("groupId", groupId) } R.id.menu_download -> startActivity { diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/style2/BookshelfFragment2.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/style2/BookshelfFragment2.kt index 6cd545f29..cfa2c4304 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/style2/BookshelfFragment2.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/style2/BookshelfFragment2.kt @@ -43,7 +43,6 @@ class BookshelfFragment2 : BaseBookshelfFragment(R.layout.fragment_bookshelf1), BaseBooksAdapter.CallBack { private val binding by viewBinding(FragmentBookshelf1Binding::bind) - private val rootGroupId = -100L private val bookshelfLayout by lazy { getPrefInt(PreferKey.bookshelfLayout) } @@ -56,7 +55,7 @@ class BookshelfFragment2 : BaseBookshelfFragment(R.layout.fragment_bookshelf1), } private var bookGroups: List = emptyList() private var booksFlowJob: Job? = null - override var groupId = rootGroupId + override var groupId = AppConst.rootGroupId override var books: List = emptyList() override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { @@ -121,7 +120,7 @@ class BookshelfFragment2 : BaseBookshelfFragment(R.layout.fragment_bookshelf1), booksFlowJob?.cancel() booksFlowJob = launch { when (groupId) { - rootGroupId -> appDb.bookDao.flowRoot() + AppConst.rootGroupId -> appDb.bookDao.flowRoot() AppConst.bookGroupAllId -> appDb.bookDao.flowAll() AppConst.bookGroupLocalId -> appDb.bookDao.flowLocal() AppConst.bookGroupAudioId -> appDb.bookDao.flowAudio() @@ -212,7 +211,7 @@ class BookshelfFragment2 : BaseBookshelfFragment(R.layout.fragment_bookshelf1), } override fun getItemCount(): Int { - return if (groupId == rootGroupId) { + return if (groupId == AppConst.rootGroupId) { bookGroups.size + books.size } else { books.size @@ -220,7 +219,7 @@ class BookshelfFragment2 : BaseBookshelfFragment(R.layout.fragment_bookshelf1), } override fun getItemType(position: Int): Int { - if (groupId != rootGroupId) { + if (groupId != AppConst.rootGroupId) { return 0 } if (position < bookGroups.size) { @@ -230,7 +229,7 @@ class BookshelfFragment2 : BaseBookshelfFragment(R.layout.fragment_bookshelf1), } override fun getItem(position: Int): Any? { - if (groupId != rootGroupId) { + if (groupId != AppConst.rootGroupId) { return books.getOrNull(position) } if (position < bookGroups.size) { diff --git a/app/src/main/res/layout/activity_arrange_book.xml b/app/src/main/res/layout/activity_arrange_book.xml index e85718977..b9875f283 100644 --- a/app/src/main/res/layout/activity_arrange_book.xml +++ b/app/src/main/res/layout/activity_arrange_book.xml @@ -9,7 +9,7 @@ android:id="@+id/title_bar" android:layout_width="match_parent" android:layout_height="wrap_content" - app:title="@string/arrange_bookshelf" + app:title="@string/bookshelf_management" app:layout_constraintTop_toTopOf="parent" /> + + - - Tiempo límite de carga Siga:%s Copiado con éxito - Organización de estantería + Organización de estantería Esto borrará a todos los libros. Por favor, tenga cuidado. Buscar fuentes de libros Buscar fuentes de suscripción diff --git a/app/src/main/res/values-ja-rJP/strings.xml b/app/src/main/res/values-ja-rJP/strings.xml index dfb209873..3385b091b 100644 --- a/app/src/main/res/values-ja-rJP/strings.xml +++ b/app/src/main/res/values-ja-rJP/strings.xml @@ -271,7 +271,7 @@ Loading timeout Follow:%s Copied successfully - Bookshelf arrangement + Bookshelf management It will delete all books. Be careful,please. Search book sources Search subscription sources diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index ac7d406b6..863b931ad 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -271,7 +271,7 @@ Tempo limite de carregamento Siga:%s Copiado com sucesso - A organização da estante + A organização da estante Isto excluirá todos os livros. Por favor, tenha cuidado. Pesquisar fontes de livros Buscar fontes de assinatura diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 56dab2441..416e92a93 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -268,7 +268,7 @@ 加載超時 關注: %s 拷貝咗 - 整理書架 + 書架管理 這將會刪除所有書籍,請謹慎操作。 搜索書源 搜索訂閲源 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 69805157e..874d66764 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -270,7 +270,7 @@ 載入超時 關注:%s 已複製 - 整理書架 + 書架管理 這將會刪除所有書籍,請謹慎操作。 搜尋書源 搜尋訂閱源 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 8f9c01346..6b9b415d0 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -270,7 +270,7 @@ 加载超时 关注:%s 已拷贝 - 整理书架 + 书架管理 这将会删除所有书籍,请谨慎操作。 搜索书源 搜索订阅源 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9423a4cf5..bc5f63327 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -271,7 +271,7 @@ Loading timeout Follow:%s Copied successfully - Bookshelf arrangement + Bookshelf management It will delete all books. Be careful,please. Search book sources Search subscription sources