pull/1319/head
gedoor 3 years ago
parent 3fcd954070
commit 82a218947e
  1. 9
      app/src/main/java/io/legado/app/ui/association/ImportBookSourceDialog.kt
  2. 11
      app/src/main/java/io/legado/app/ui/association/ImportReplaceRuleDialog.kt
  3. 11
      app/src/main/java/io/legado/app/ui/association/ImportRssSourceDialog.kt
  4. 16
      app/src/main/java/io/legado/app/ui/book/changecover/ChangeCoverDialog.kt
  5. 9
      app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt
  6. 4
      app/src/main/java/io/legado/app/ui/book/group/GroupEditDialog.kt
  7. 11
      app/src/main/java/io/legado/app/ui/book/group/GroupSelectDialog.kt
  8. 2
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  9. 5
      app/src/main/java/io/legado/app/ui/book/toc/BookmarkDialog.kt
  10. 11
      app/src/main/java/io/legado/app/ui/dict/DictDialog.kt
  11. 7
      app/src/main/java/io/legado/app/ui/document/FilePickerDialog.kt
  12. 2
      app/src/main/java/io/legado/app/ui/main/bookshelf/style1/BookshelfFragment1.kt
  13. 8
      app/src/main/java/io/legado/app/ui/main/bookshelf/style1/books/BooksFragment.kt
  14. 8
      app/src/main/java/io/legado/app/ui/rss/article/RssArticlesFragment.kt
  15. 2
      app/src/main/java/io/legado/app/ui/rss/article/RssSortActivity.kt

@ -27,11 +27,8 @@ import io.legado.app.help.AppConfig
import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.theme.primaryColor
import io.legado.app.ui.widget.dialog.WaitDialog
import io.legado.app.utils.dp
import io.legado.app.utils.putPrefBoolean
import io.legado.app.utils.splitNotBlank
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
import io.legado.app.utils.visible
/**
@ -46,12 +43,10 @@ class ImportBookSourceDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickList
source: String,
finishOnDismiss: Boolean = false
) {
ImportBookSourceDialog().apply {
arguments = Bundle().apply {
fragmentManager.showDialog<ImportBookSourceDialog> {
putString("source", source)
putBoolean("finishOnDismiss", finishOnDismiss)
}
}.show(fragmentManager, "importBookSource")
}
}

@ -26,27 +26,24 @@ import io.legado.app.databinding.ItemSourceImportBinding
import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.theme.primaryColor
import io.legado.app.ui.widget.dialog.WaitDialog
import io.legado.app.utils.dp
import io.legado.app.utils.putPrefBoolean
import io.legado.app.utils.splitNotBlank
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
import io.legado.app.utils.visible
class ImportReplaceRuleDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {
companion object {
fun start(
fragmentManager: FragmentManager,
source: String,
finishOnDismiss: Boolean = false
) {
ImportReplaceRuleDialog().apply {
arguments = Bundle().apply {
fragmentManager.showDialog<ImportReplaceRuleDialog> {
putString("source", source)
putBoolean("finishOnDismiss", finishOnDismiss)
}
}.show(fragmentManager, "importReplaceRule")
}
}
private val binding by viewBinding(DialogRecyclerViewBinding::bind)

@ -27,11 +27,8 @@ import io.legado.app.help.AppConfig
import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.theme.primaryColor
import io.legado.app.ui.widget.dialog.WaitDialog
import io.legado.app.utils.dp
import io.legado.app.utils.putPrefBoolean
import io.legado.app.utils.splitNotBlank
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
import io.legado.app.utils.visible
/**
* 导入rss源弹出窗口
@ -39,18 +36,18 @@ import io.legado.app.utils.visible
class ImportRssSourceDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {
companion object {
fun start(
fragmentManager: FragmentManager,
source: String,
finishOnDismiss: Boolean = false
) {
ImportRssSourceDialog().apply {
arguments = Bundle().apply {
fragmentManager.showDialog<ImportRssSourceDialog> {
putString("source", source)
putBoolean("finishOnDismiss", finishOnDismiss)
}
}.show(fragmentManager, "importRssSource")
}
}
private val binding by viewBinding(DialogRecyclerViewBinding::bind)

@ -14,6 +14,7 @@ import io.legado.app.base.BaseDialogFragment
import io.legado.app.databinding.DialogChangeCoverBinding
import io.legado.app.lib.theme.primaryColor
import io.legado.app.utils.applyTint
import io.legado.app.utils.showDialog
import io.legado.app.utils.viewbindingdelegate.viewBinding
import io.legado.app.utils.windowSize
@ -23,17 +24,14 @@ class ChangeCoverDialog : BaseDialogFragment(),
CoverAdapter.CallBack {
companion object {
const val tag = "changeCoverDialog"
fun show(manager: FragmentManager, name: String, author: String) {
val fragment = ChangeCoverDialog().apply {
val bundle = Bundle()
bundle.putString("name", name)
bundle.putString("author", author)
arguments = bundle
fun show(fragmentManager: FragmentManager, name: String, author: String) {
fragmentManager.showDialog<ChangeCoverDialog> {
putString("name", name)
putString("author", author)
}
fragment.show(manager, tag)
}
}
private val binding by viewBinding(DialogChangeCoverBinding::bind)

@ -37,13 +37,10 @@ class ChangeSourceDialog : BaseDialogFragment(),
const val tag = "changeSourceDialog"
fun show(manager: FragmentManager, name: String, author: String) {
val fragment = ChangeSourceDialog().apply {
val bundle = Bundle()
bundle.putString("name", name)
bundle.putString("author", author)
arguments = bundle
manager.showDialog<ChangeSourceDialog> {
putString("name", name)
putString("author", author)
}
fragment.show(manager, tag)
}
}

@ -21,11 +21,9 @@ class GroupEditDialog : BaseDialogFragment() {
companion object {
fun start(fragmentManager: FragmentManager, bookGroup: BookGroup? = null) {
GroupEditDialog().apply {
arguments = Bundle().apply {
fragmentManager.showDialog<GroupEditDialog> {
putParcelable("group", bookGroup)
}
}.show(fragmentManager, "bookGroupEdit")
}
}

@ -26,6 +26,7 @@ import io.legado.app.lib.theme.primaryColor
import io.legado.app.ui.widget.recycler.ItemTouchCallback
import io.legado.app.ui.widget.recycler.VerticalDivider
import io.legado.app.utils.applyTint
import io.legado.app.utils.showDialog
import io.legado.app.utils.viewbindingdelegate.viewBinding
import io.legado.app.utils.windowSize
import kotlinx.coroutines.flow.collect
@ -38,14 +39,12 @@ class GroupSelectDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener
const val tag = "groupSelectDialog"
fun show(manager: FragmentManager, groupId: Long, requestCode: Int = -1) {
val fragment = GroupSelectDialog().apply {
val bundle = Bundle()
bundle.putLong("groupId", groupId)
bundle.putInt("requestCode", requestCode)
arguments = bundle
manager.showDialog<GroupSelectDialog> {
putLong("groupId", groupId)
putInt("requestCode", requestCode)
}
fragment.show(manager, tag)
}
}
private val binding by viewBinding(DialogBookGroupPickerBinding::bind)

@ -539,7 +539,7 @@ class ReadBookActivity : ReadBookBaseActivity(),
return true
}
R.id.menu_dict -> {
DictDialog.dict(supportFragmentManager, selectedText)
DictDialog.show(supportFragmentManager, selectedText)
return true
}
}

@ -11,6 +11,7 @@ import io.legado.app.data.appDb
import io.legado.app.data.entities.Bookmark
import io.legado.app.databinding.DialogBookmarkBinding
import io.legado.app.lib.theme.primaryColor
import io.legado.app.utils.showDialog
import io.legado.app.utils.viewbindingdelegate.viewBinding
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.launch
@ -21,11 +22,9 @@ class BookmarkDialog : BaseDialogFragment() {
companion object {
fun start(fragmentManager: FragmentManager, bookmark: Bookmark) {
BookmarkDialog().apply {
arguments = Bundle().apply {
fragmentManager.showDialog<BookmarkDialog> {
putParcelable("bookmark", bookmark)
}
}.show(fragmentManager, "bookMarkDialog")
}
}

@ -13,6 +13,7 @@ import io.legado.app.R
import io.legado.app.base.BaseDialogFragment
import io.legado.app.databinding.DialogDictBinding
import io.legado.app.utils.invisible
import io.legado.app.utils.showDialog
import io.legado.app.utils.toastOnUi
import io.legado.app.utils.viewbindingdelegate.viewBinding
@ -23,12 +24,10 @@ class DictDialog : BaseDialogFragment() {
companion object {
fun dict(manager: FragmentManager, word: String) {
DictDialog().apply {
val bundle = Bundle()
bundle.putString("word", word)
arguments = bundle
}.show(manager, word)
fun show(manager: FragmentManager, word: String) {
manager.showDialog<DictDialog> {
putString("word", word)
}
}
}

@ -9,11 +9,11 @@ import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.widget.Toolbar
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import io.legado.app.R
import io.legado.app.base.BaseDialogFragment
import io.legado.app.databinding.DialogFileChooserBinding
import io.legado.app.lib.theme.primaryColor
import io.legado.app.ui.document.HandleFileContract.Companion.DIR
@ -26,7 +26,7 @@ import io.legado.app.utils.viewbindingdelegate.viewBinding
import java.io.File
class FilePickerDialog : DialogFragment(),
class FilePickerDialog : BaseDialogFragment(),
Toolbar.OnMenuItemClickListener,
FileAdapter.CallBack,
PathAdapter.CallBack {
@ -88,8 +88,7 @@ class FilePickerDialog : DialogFragment(),
return inflater.inflate(R.layout.dialog_file_chooser, container, true)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
binding.toolBar.setBackgroundColor(primaryColor)
view.setBackgroundResource(R.color.background_card)
arguments?.let {

@ -138,7 +138,7 @@ class BookshelfFragment1 : BaseBookshelfFragment(R.layout.fragment_bookshelf),
override fun getItem(position: Int): Fragment {
val group = bookGroups[position]
return BooksFragment.newInstance(position, group.groupId)
return BooksFragment(position, group.groupId)
}
override fun getCount(): Int {

@ -37,19 +37,15 @@ import kotlin.math.max
/**
* 书架界面
*/
class BooksFragment : BaseFragment(R.layout.fragment_books),
class BooksFragment() : BaseFragment(R.layout.fragment_books),
BaseBooksAdapter.CallBack {
companion object {
fun newInstance(position: Int, groupId: Long): BooksFragment {
return BooksFragment().apply {
constructor(position: Int, groupId: Long) : this() {
val bundle = Bundle()
bundle.putInt("position", position)
bundle.putLong("groupId", groupId)
arguments = bundle
}
}
}
private val binding by viewBinding(FragmentBooksBinding::bind)
private val activityViewModel: MainViewModel

@ -26,19 +26,15 @@ import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
class RssArticlesFragment : VMBaseFragment<RssArticlesViewModel>(R.layout.fragment_rss_articles),
class RssArticlesFragment() : VMBaseFragment<RssArticlesViewModel>(R.layout.fragment_rss_articles),
BaseRssArticlesAdapter.CallBack {
companion object {
fun create(sortName: String, sortUrl: String): RssArticlesFragment {
return RssArticlesFragment().apply {
constructor(sortName: String, sortUrl: String) : this() {
val bundle = Bundle()
bundle.putString("sortName", sortName)
bundle.putString("sortUrl", sortUrl)
arguments = bundle
}
}
}
private val binding by viewBinding(FragmentRssArticlesBinding::bind)
private val activityViewModel by activityViewModels<RssSortViewModel>()

@ -135,7 +135,7 @@ class RssSortActivity : VMBaseActivity<ActivityRssArtivlesBinding, RssSortViewMo
override fun getItem(position: Int): Fragment {
val sort = sortList[position]
return RssArticlesFragment.create(sort.first, sort.second)
return RssArticlesFragment(sort.first, sort.second)
}
override fun getCount(): Int {

Loading…
Cancel
Save