pull/1395/head
gedoor 3 years ago
parent 21a02abbbf
commit 24d12119e2
  1. 35
      app/src/main/java/io/legado/app/lib/dialogs/AndroidDialogs.kt
  2. 2
      app/src/main/java/io/legado/app/ui/about/AboutFragment.kt
  3. 2
      app/src/main/java/io/legado/app/ui/association/ImportBookSourceDialog.kt
  4. 2
      app/src/main/java/io/legado/app/ui/association/ImportReplaceRuleDialog.kt
  5. 2
      app/src/main/java/io/legado/app/ui/association/ImportRssSourceDialog.kt
  6. 2
      app/src/main/java/io/legado/app/ui/association/OnLineImportActivity.kt
  7. 2
      app/src/main/java/io/legado/app/ui/book/audio/AudioPlayActivity.kt
  8. 2
      app/src/main/java/io/legado/app/ui/book/group/GroupEditDialog.kt
  9. 2
      app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt
  10. 2
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  11. 4
      app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt
  12. 4
      app/src/main/java/io/legado/app/ui/book/read/config/SpeakEngineDialog.kt
  13. 4
      app/src/main/java/io/legado/app/ui/book/source/manage/GroupManageDialog.kt
  14. 4
      app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt
  15. 2
      app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt
  16. 4
      app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt
  17. 2
      app/src/main/java/io/legado/app/ui/config/ThemeListDialog.kt
  18. 2
      app/src/main/java/io/legado/app/ui/document/HandleFileActivity.kt
  19. 8
      app/src/main/java/io/legado/app/ui/main/bookshelf/BaseBookshelfFragment.kt
  20. 4
      app/src/main/java/io/legado/app/ui/replace/GroupManageDialog.kt
  21. 4
      app/src/main/java/io/legado/app/ui/rss/source/manage/GroupManageDialog.kt
  22. 2
      app/src/main/java/io/legado/app/ui/widget/font/FontSelectDialog.kt

@ -8,17 +8,11 @@ import android.content.DialogInterface
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.Fragment
inline fun Fragment.alert(
title: CharSequence? = null,
message: CharSequence? = null,
noinline init: (AlertBuilder<DialogInterface>.() -> Unit)? = null
) = requireActivity().alert(title, message, init)
fun Context.alert(
title: CharSequence? = null,
message: CharSequence? = null,
init: (AlertBuilder<DialogInterface>.() -> Unit)? = null
): AlertBuilder<AlertDialog> {
): AlertDialog {
return AndroidAlertBuilder(this).apply {
if (title != null) {
this.setTitle(title)
@ -27,20 +21,20 @@ fun Context.alert(
this.setMessage(message)
}
if (init != null) init()
}
}.show()
}
inline fun Fragment.alert(
titleResource: Int? = null,
message: Int? = null,
title: CharSequence? = null,
message: CharSequence? = null,
noinline init: (AlertBuilder<DialogInterface>.() -> Unit)? = null
) = requireActivity().alert(titleResource, message, init)
) = requireActivity().alert(title, message, init)
fun Context.alert(
titleResource: Int? = null,
messageResource: Int? = null,
init: (AlertBuilder<DialogInterface>.() -> Unit)? = null
): AlertBuilder<AlertDialog> {
): AlertDialog {
return AndroidAlertBuilder(this).apply {
if (titleResource != null) {
this.setTitle(titleResource)
@ -49,18 +43,23 @@ fun Context.alert(
this.setMessage(messageResource)
}
if (init != null) init()
}.apply {
show()
}
}.show()
}
inline fun Fragment.alert(
titleResource: Int? = null,
message: Int? = null,
noinline init: (AlertBuilder<DialogInterface>.() -> Unit)? = null
) = requireActivity().alert(titleResource, message, init)
fun Context.alert(init: AlertBuilder<AlertDialog>.() -> Unit): AlertDialog =
AndroidAlertBuilder(this).apply {
init()
}.show()
inline fun Fragment.alert(noinline init: AlertBuilder<DialogInterface>.() -> Unit) =
requireContext().alert(init)
fun Context.alert(init: AlertBuilder<AlertDialog>.() -> Unit): AlertBuilder<AlertDialog> =
AndroidAlertBuilder(this).apply { init() }
inline fun Fragment.progressDialog(
title: Int? = null,
message: Int? = null,

@ -105,7 +105,7 @@ class AboutFragment : PreferenceFragmentCompat() {
}
}
}
}.show()
}
}
private fun joinQQGroup(key: String): Boolean {

@ -195,7 +195,7 @@ class ImportBookSourceDialog() : BaseDialogFragment(), Toolbar.OnMenuItemClickLi
}
}
noButton()
}.show()
}
}
inner class SourcesAdapter(context: Context) :

@ -171,7 +171,7 @@ class ImportReplaceRuleDialog() : BaseDialogFragment(), Toolbar.OnMenuItemClickL
}
}
noButton()
}.show()
}
}
private fun upSelectText() {

@ -194,7 +194,7 @@ class ImportRssSourceDialog() : BaseDialogFragment(), Toolbar.OnMenuItemClickLis
}
}
noButton()
}.show()
}
}
inner class SourcesAdapter(context: Context) :

@ -90,7 +90,7 @@ class OnLineImportActivity :
onDismiss {
finish()
}
}.show()
}
}
}

@ -203,7 +203,7 @@ class AudioPlayActivity :
setResult(Activity.RESULT_OK)
}
noButton { viewModel.removeFromBookshelf { super.finish() } }
}.show()
}
} else {
super.finish()
}

@ -107,7 +107,7 @@ class GroupEditDialog() : BaseDialogFragment() {
ok.invoke()
}
noButton()
}.show()
}
}
}

@ -384,7 +384,7 @@ class BookInfoActivity :
}
}
negativeButton(R.string.no)
}.show()
}
} else {
viewModel.delBook {
upTvBookshelf()

@ -934,7 +934,7 @@ class ReadBookActivity : ReadBookBaseActivity(),
setResult(Activity.RESULT_OK)
}
noButton { viewModel.removeFromBookshelf { super.finish() } }
}.show()
}
} else {
super.finish()
}

@ -150,7 +150,7 @@ class BgTextConfigDialog : BaseDialogFragment() {
}
}
cancelButton()
}.show()
}
}
binding.tvRestore.setOnClickListener {
val defaultConfigs = DefaultData.readConfigs
@ -297,7 +297,7 @@ class BgTextConfigDialog : BaseDialogFragment() {
}
}
noButton()
}.show()
}
}
private fun importNetConfig(url: String) {

@ -64,7 +64,7 @@ class SpeakEngineDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener
okButton {
requireContext().sendToClip(uri.toString())
}
}.show()
}
}
override fun onStart() {
@ -181,7 +181,7 @@ class SpeakEngineDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener
viewModel.importOnLine(url)
}
}
}.show()
}
}
@SuppressLint("InflateParams")

@ -98,7 +98,7 @@ class GroupManageDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener
}
}
noButton()
}.show().requestInputMethod()
}.requestInputMethod()
}
@SuppressLint("InflateParams")
@ -113,7 +113,7 @@ class GroupManageDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener
viewModel.upGroup(group, alertBinding.editView.text?.toString())
}
noButton()
}.show().requestInputMethod()
}.requestInputMethod()
}
private inner class GroupAdapter(context: Context) :

@ -221,7 +221,7 @@ class BackupConfigFragment : BasePreferenceFragment(),
onDismiss {
Restore.saveIgnoreConfig()
}
}.show()
}
}
@ -278,7 +278,7 @@ class BackupConfigFragment : BasePreferenceFragment(),
restoreFromLocal()
}
cancelButton()
}.show()
}
}
}

@ -159,7 +159,7 @@ class OtherConfigFragment : BasePreferenceFragment(),
}
}
noButton()
}.show()
}
}
private fun clearCache() {

@ -183,7 +183,7 @@ class ThemeConfigFragment : BasePreferenceFragment(),
}
}
noButton()
}.show()
}
}
private fun selectBgAction(isNight: Boolean) {
@ -241,7 +241,7 @@ class ThemeConfigFragment : BasePreferenceFragment(),
}
}
noButton()
}.show()
}
}
private fun upTheme(isNightTheme: Boolean) {

@ -85,7 +85,7 @@ class ThemeListDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {
initData()
}
noButton()
}.show()
}
}
fun share(index: Int) {

@ -116,7 +116,7 @@ class HandleFileActivity :
onCancelled {
finish()
}
}.show()
}
}
private fun getFileData(): Triple<String, ByteArray, String>? {

@ -51,7 +51,7 @@ abstract class BaseBookshelfFragment(layoutId: Int) : VMBaseFragment<BookshelfVi
okButton {
requireContext().sendToClip(uri.toString())
}
}.show()
}
}
}
abstract val groupId: Long
@ -106,7 +106,7 @@ abstract class BaseBookshelfFragment(layoutId: Int) : VMBaseFragment<BookshelfVi
}
}
noButton()
}.show()
}
}
@SuppressLint("InflateParams")
@ -148,7 +148,7 @@ abstract class BaseBookshelfFragment(layoutId: Int) : VMBaseFragment<BookshelfVi
}
}
noButton()
}.show()
}
}
@ -170,7 +170,7 @@ abstract class BaseBookshelfFragment(layoutId: Int) : VMBaseFragment<BookshelfVi
allowExtensions = arrayOf("txt", "json")
}
}
}.show()
}
}
}

@ -100,7 +100,7 @@ class GroupManageDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener
}
}
noButton()
}.show().requestInputMethod()
}.requestInputMethod()
}
@SuppressLint("InflateParams")
@ -115,7 +115,7 @@ class GroupManageDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener
viewModel.upGroup(group, alertBinding.editView.text?.toString())
}
noButton()
}.show().requestInputMethod()
}.requestInputMethod()
}
private inner class GroupAdapter(context: Context) :

@ -100,7 +100,7 @@ class GroupManageDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener
}
}
noButton()
}.show().requestInputMethod()
}.requestInputMethod()
}
@SuppressLint("InflateParams")
@ -115,7 +115,7 @@ class GroupManageDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener
viewModel.upGroup(group, alertBinding.editView.text?.toString())
}
noButton()
}.show().requestInputMethod()
}.requestInputMethod()
}
private inner class GroupAdapter(context: Context) :

@ -115,7 +115,7 @@ class FontSelectDialog : BaseDialogFragment(),
onDefaultFontChange()
dismissAllowingStateLoss()
}
}.show()
}
}
R.id.menu_other -> {
openFolder()

Loading…
Cancel
Save