replace anko-sdk27-listeners to anko:anko-sdk27-coroutines

pull/840/head
gedoor 4 years ago
parent 2f1662a0ff
commit 3b7fca8f9a
  1. 2
      app/build.gradle
  2. 2
      app/src/main/java/io/legado/app/ui/about/ReadRecordActivity.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/ImportRssSourceDialog.kt
  5. 19
      app/src/main/java/io/legado/app/ui/audio/AudioPlayActivity.kt
  6. 2
      app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookAdapter.kt
  7. 2
      app/src/main/java/io/legado/app/ui/book/cache/CacheAdapter.kt
  8. 2
      app/src/main/java/io/legado/app/ui/book/changecover/CoverAdapter.kt
  9. 7
      app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceAdapter.kt
  10. 2
      app/src/main/java/io/legado/app/ui/book/explore/ExploreShowAdapter.kt
  11. 2
      app/src/main/java/io/legado/app/ui/book/group/GroupManageDialog.kt
  12. 2
      app/src/main/java/io/legado/app/ui/book/group/GroupSelectDialog.kt
  13. 2
      app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt
  14. 2
      app/src/main/java/io/legado/app/ui/book/info/ChapterListAdapter.kt
  15. 2
      app/src/main/java/io/legado/app/ui/book/info/edit/BookInfoEditActivity.kt
  16. 2
      app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt
  17. 3
      app/src/main/java/io/legado/app/ui/book/local/ImportBookAdapter.kt
  18. 7
      app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt
  19. 2
      app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt
  20. 2
      app/src/main/java/io/legado/app/ui/book/read/config/AutoReadDialog.kt
  21. 2
      app/src/main/java/io/legado/app/ui/book/read/config/BgAdapter.kt
  22. 4
      app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt
  23. 2
      app/src/main/java/io/legado/app/ui/book/read/config/ChineseConverter.kt
  24. 2
      app/src/main/java/io/legado/app/ui/book/read/config/ClickActionConfigDialog.kt
  25. 3
      app/src/main/java/io/legado/app/ui/book/read/config/PageKeyDialog.kt
  26. 2
      app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt
  27. 10
      app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt
  28. 2
      app/src/main/java/io/legado/app/ui/book/read/config/SpeakEngineDialog.kt
  29. 2
      app/src/main/java/io/legado/app/ui/book/read/config/TextFontWeightConverter.kt
  30. 4
      app/src/main/java/io/legado/app/ui/book/read/config/TipConfigDialog.kt
  31. 3
      app/src/main/java/io/legado/app/ui/book/read/config/TocRegexDialog.kt
  32. 2
      app/src/main/java/io/legado/app/ui/book/search/BookAdapter.kt
  33. 7
      app/src/main/java/io/legado/app/ui/book/search/HistoryKeyAdapter.kt
  34. 3
      app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt
  35. 2
      app/src/main/java/io/legado/app/ui/book/search/SearchAdapter.kt
  36. 3
      app/src/main/java/io/legado/app/ui/book/searchContent/SearchContentActivity.kt
  37. 2
      app/src/main/java/io/legado/app/ui/book/searchContent/SearchContentAdapter.kt
  38. 2
      app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceAdapter.kt
  39. 2
      app/src/main/java/io/legado/app/ui/book/source/manage/GroupManageDialog.kt
  40. 8
      app/src/main/java/io/legado/app/ui/book/toc/BookmarkAdapter.kt
  41. 2
      app/src/main/java/io/legado/app/ui/book/toc/ChapterListAdapter.kt
  42. 2
      app/src/main/java/io/legado/app/ui/book/toc/ChapterListFragment.kt
  43. 2
      app/src/main/java/io/legado/app/ui/config/ThemeListDialog.kt
  44. 2
      app/src/main/java/io/legado/app/ui/filepicker/adapter/FileAdapter.kt
  45. 2
      app/src/main/java/io/legado/app/ui/filepicker/adapter/PathAdapter.kt
  46. 7
      app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterGrid.kt
  47. 7
      app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterList.kt
  48. 5
      app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt
  49. 7
      app/src/main/java/io/legado/app/ui/main/rss/RssAdapter.kt
  50. 2
      app/src/main/java/io/legado/app/ui/main/rss/RssFragment.kt
  51. 2
      app/src/main/java/io/legado/app/ui/replace/GroupManageDialog.kt
  52. 2
      app/src/main/java/io/legado/app/ui/replace/ReplaceRuleAdapter.kt
  53. 2
      app/src/main/java/io/legado/app/ui/replace/edit/ReplaceEditActivity.kt
  54. 2
      app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter.kt
  55. 2
      app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter1.kt
  56. 2
      app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter2.kt
  57. 2
      app/src/main/java/io/legado/app/ui/rss/favorites/RssFavoritesAdapter.kt
  58. 2
      app/src/main/java/io/legado/app/ui/rss/source/manage/GroupManageDialog.kt
  59. 2
      app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceAdapter.kt
  60. 2
      app/src/main/java/io/legado/app/ui/rss/subscription/RuleSubAdapter.kt
  61. 2
      app/src/main/java/io/legado/app/ui/widget/DetailSeekBar.kt
  62. 2
      app/src/main/java/io/legado/app/ui/widget/KeyboardToolPop.kt
  63. 2
      app/src/main/java/io/legado/app/ui/widget/SelectActionBar.kt
  64. 2
      app/src/main/java/io/legado/app/ui/widget/font/FontAdapter.kt
  65. 2
      app/src/main/java/io/legado/app/ui/widget/prefs/IconListPreference.kt
  66. 5
      app/src/main/java/io/legado/app/ui/widget/prefs/Preference.kt
  67. 2
      app/src/main/java/io/legado/app/ui/widget/text/AutoCompleteTextView.kt

@ -153,7 +153,7 @@ dependencies {
//anko
def anko_version = '0.10.8'
implementation "org.jetbrains.anko:anko-sdk27:$anko_version"
implementation "org.jetbrains.anko:anko-sdk27-listeners:$anko_version"
implementation "org.jetbrains.anko:anko-sdk27-coroutines:$anko_version"
//liveEventBus
implementation 'com.jeremyliao:live-event-bus-x:1.5.7'

@ -19,7 +19,7 @@ import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import java.util.*
class ReadRecordActivity : BaseActivity<ActivityReadRecordBinding>() {

@ -25,7 +25,7 @@ import io.legado.app.help.AppConfig
import io.legado.app.lib.dialogs.alert
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
/**
* 导入书源弹出窗口

@ -25,7 +25,7 @@ import io.legado.app.help.AppConfig
import io.legado.app.lib.dialogs.alert
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
/**
* 导入rss源弹出窗口

@ -28,8 +28,8 @@ import io.legado.app.ui.book.toc.ChapterListActivity
import io.legado.app.ui.widget.image.CoverImageView
import io.legado.app.ui.widget.seekbar.SeekBarChangeListener
import io.legado.app.utils.*
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.listeners.onLongClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import org.jetbrains.anko.sdk27.coroutines.onLongClick
import org.jetbrains.anko.startActivityForResult
import java.util.*
@ -83,15 +83,14 @@ class AudioPlayActivity :
binding.fabPlayStop.onClick {
playButton()
}
binding.fabPlayStop.onLongClick {
AudioPlay.stop(this)
true
binding.fabPlayStop.onLongClick(returnValue = true) {
AudioPlay.stop(this@AudioPlayActivity)
}
binding.ivSkipNext.onClick {
AudioPlay.next(this)
AudioPlay.next(this@AudioPlayActivity)
}
binding.ivSkipPrevious.onClick {
AudioPlay.prev(this)
AudioPlay.prev(this@AudioPlayActivity)
}
binding.playerProgress.setOnSeekBarChangeListener(object : SeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
@ -120,13 +119,13 @@ class AudioPlayActivity :
binding.ivFastForward.invisible()
}
binding.ivFastForward.onClick {
AudioPlay.adjustSpeed(this, 0.1f)
AudioPlay.adjustSpeed(this@AudioPlayActivity, 0.1f)
}
binding.ivFastRewind.onClick {
AudioPlay.adjustSpeed(this, -0.1f)
AudioPlay.adjustSpeed(this@AudioPlayActivity, -0.1f)
}
binding.ivTimer.onClick {
AudioPlay.addTimer(this)
AudioPlay.addTimer(this@AudioPlayActivity)
}
}

@ -14,7 +14,7 @@ import io.legado.app.lib.theme.backgroundColor
import io.legado.app.ui.widget.recycler.DragSelectTouchHelper
import io.legado.app.ui.widget.recycler.ItemTouchCallback
import org.jetbrains.anko.backgroundColor
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import java.util.*
class ArrangeBookAdapter(context: Context, val callBack: CallBack) :

@ -10,7 +10,7 @@ import io.legado.app.data.entities.Book
import io.legado.app.data.entities.BookChapter
import io.legado.app.databinding.ItemDownloadBinding
import io.legado.app.service.help.CacheBook
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.CopyOnWriteArraySet

@ -7,7 +7,7 @@ import io.legado.app.base.adapter.DiffRecyclerAdapter
import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.data.entities.SearchBook
import io.legado.app.databinding.ItemCoverBinding
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
class CoverAdapter(context: Context, val callBack: CallBack) :
DiffRecyclerAdapter<SearchBook, ItemCoverBinding>(context) {

@ -13,8 +13,8 @@ import io.legado.app.data.entities.SearchBook
import io.legado.app.databinding.ItemChangeSourceBinding
import io.legado.app.utils.invisible
import io.legado.app.utils.visible
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.listeners.onLongClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import org.jetbrains.anko.sdk27.coroutines.onLongClick
class ChangeSourceAdapter(context: Context, val callBack: CallBack) :
@ -70,9 +70,8 @@ class ChangeSourceAdapter(context: Context, val callBack: CallBack) :
callBack.changeTo(it)
}
}
holder.itemView.onLongClick {
holder.itemView.onLongClick(returnValue = true) {
showMenu(holder.itemView, getItem(holder.layoutPosition))
true
}
}

@ -10,7 +10,7 @@ import io.legado.app.data.entities.SearchBook
import io.legado.app.databinding.ItemSearchBinding
import io.legado.app.utils.gone
import io.legado.app.utils.visible
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
class ExploreShowAdapter(context: Context, val callBack: CallBack) :
RecyclerAdapter<SearchBook, ItemSearchBinding>(context) {

@ -28,7 +28,7 @@ import io.legado.app.ui.widget.recycler.ItemTouchCallback
import io.legado.app.ui.widget.recycler.VerticalDivider
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
class GroupManageDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {
private lateinit var viewModel: GroupViewModel

@ -32,7 +32,7 @@ import io.legado.app.utils.getSize
import io.legado.app.utils.getViewModel
import io.legado.app.utils.requestInputMethod
import io.legado.app.utils.viewbindingdelegate.viewBinding
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
class GroupSelectDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {

@ -37,7 +37,7 @@ import io.legado.app.ui.book.source.edit.BookSourceEditActivity
import io.legado.app.ui.book.toc.ChapterListActivity
import io.legado.app.ui.widget.image.CoverImageView
import io.legado.app.utils.*
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import org.jetbrains.anko.startActivity
import org.jetbrains.anko.startActivityForResult
import org.jetbrains.anko.toast

@ -8,7 +8,7 @@ import io.legado.app.base.adapter.RecyclerAdapter
import io.legado.app.data.entities.BookChapter
import io.legado.app.databinding.ItemChapterListBinding
import io.legado.app.lib.theme.accentColor
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import org.jetbrains.anko.textColorResource
class ChapterListAdapter(context: Context, var callBack: CallBack) :

@ -15,7 +15,7 @@ import io.legado.app.help.permission.Permissions
import io.legado.app.help.permission.PermissionsCompat
import io.legado.app.ui.book.changecover.ChangeCoverDialog
import io.legado.app.utils.*
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import org.jetbrains.anko.toast
import java.io.File

@ -28,7 +28,7 @@ import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import org.jetbrains.anko.toast
import java.io.File
import java.util.*

@ -9,8 +9,7 @@ import io.legado.app.base.adapter.RecyclerAdapter
import io.legado.app.constant.AppConst
import io.legado.app.databinding.ItemImportBookBinding
import io.legado.app.utils.*
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
class ImportBookAdapter(context: Context, val callBack: CallBack) :
RecyclerAdapter<DocItem, ItemImportBookBinding>(context) {

@ -21,8 +21,8 @@ import io.legado.app.lib.theme.*
import io.legado.app.service.help.ReadBook
import io.legado.app.ui.widget.seekbar.SeekBarChangeListener
import io.legado.app.utils.*
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.listeners.onLongClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import org.jetbrains.anko.sdk27.coroutines.onLongClick
/**
* 阅读界面菜单
@ -212,9 +212,8 @@ class ReadMenu @JvmOverloads constructor(
callBack.onClickReadAloud()
}
}
llReadAloud.onLongClick {
llReadAloud.onLongClick(returnValue = true) {
runMenuOut { callBack.showReadAloudDialog() }
true
}
//界面
llFont.onClick {

@ -28,7 +28,7 @@ import io.legado.app.utils.gone
import io.legado.app.utils.isAbsUrl
import io.legado.app.utils.sendToClip
import io.legado.app.utils.visible
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import org.jetbrains.anko.share
import org.jetbrains.anko.toast
import java.util.*

@ -16,7 +16,7 @@ import io.legado.app.ui.book.read.ReadBookActivity
import io.legado.app.ui.widget.seekbar.SeekBarChangeListener
import io.legado.app.utils.ColorUtils
import io.legado.app.utils.viewbindingdelegate.viewBinding
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
class AutoReadDialog : BaseDialogFragment() {
var callBack: CallBack? = null

@ -9,7 +9,7 @@ import io.legado.app.databinding.ItemBgImageBinding
import io.legado.app.help.ImageLoader
import io.legado.app.help.ReadBookConfig
import io.legado.app.utils.postEvent
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import java.io.File
class BgAdapter(context: Context, val textColor: Int) :

@ -28,8 +28,8 @@ import io.legado.app.ui.filepicker.FilePicker
import io.legado.app.ui.filepicker.FilePickerDialog
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
import org.jetbrains.anko.sdk27.listeners.onCheckedChange
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onCheckedChange
import org.jetbrains.anko.sdk27.coroutines.onClick
import rxhttp.wrapper.param.RxHttp
import rxhttp.wrapper.param.toByteArray
import java.io.File

@ -10,7 +10,7 @@ import io.legado.app.help.AppConfig
import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.theme.accentColor
import io.legado.app.ui.widget.text.StrokeTextView
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
class ChineseConverter(context: Context, attrs: AttributeSet?) : StrokeTextView(context, attrs) {

@ -16,7 +16,7 @@ import io.legado.app.ui.book.read.ReadBookActivity
import io.legado.app.utils.getCompatColor
import io.legado.app.utils.putPrefInt
import io.legado.app.utils.viewbindingdelegate.viewBinding
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
class ClickActionConfigDialog : BaseDialogFragment() {
private val binding by viewBinding(DialogClickActionConfigBinding::bind)

@ -10,8 +10,7 @@ import io.legado.app.lib.theme.backgroundColor
import io.legado.app.utils.getPrefString
import io.legado.app.utils.hideSoftInput
import io.legado.app.utils.putPrefString
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
class PageKeyDialog(context: Context) : Dialog(context, R.style.AppTheme_AlertDialog) {

@ -21,7 +21,7 @@ import io.legado.app.utils.getPrefBoolean
import io.legado.app.utils.observeEvent
import io.legado.app.utils.putPrefBoolean
import io.legado.app.utils.viewbindingdelegate.viewBinding
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
class ReadAloudDialog : BaseDialogFragment() {
private var callBack: CallBack? = null

@ -24,9 +24,9 @@ import io.legado.app.utils.dp
import io.legado.app.utils.getIndexById
import io.legado.app.utils.postEvent
import io.legado.app.utils.viewbindingdelegate.viewBinding
import org.jetbrains.anko.sdk27.listeners.onCheckedChange
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.listeners.onLongClick
import org.jetbrains.anko.sdk27.coroutines.onCheckedChange
import org.jetbrains.anko.sdk27.coroutines.onClick
import org.jetbrains.anko.sdk27.coroutines.onLongClick
class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack {
private val binding by viewBinding(DialogReadBookStyleBinding::bind)
@ -240,11 +240,9 @@ class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack {
changeBg(holder.layoutPosition)
}
}
ivStyle.onLongClick {
ivStyle.onLongClick(returnValue = ivStyle.isInView) {
if (ivStyle.isInView) {
showBgTextConfig(holder.layoutPosition)
} else {
false
}
}
}

@ -27,7 +27,7 @@ import io.legado.app.service.help.ReadAloud
import io.legado.app.ui.widget.dialog.TextDialog
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
class SpeakEngineDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {
private val binding by viewBinding(DialogRecyclerViewBinding::bind)

@ -10,7 +10,7 @@ import io.legado.app.help.ReadBookConfig
import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.theme.accentColor
import io.legado.app.ui.widget.text.StrokeTextView
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
class TextFontWeightConverter(context: Context, attrs: AttributeSet?) : StrokeTextView(context, attrs) {

@ -14,8 +14,8 @@ import io.legado.app.help.ReadTipConfig
import io.legado.app.lib.dialogs.selector
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
import org.jetbrains.anko.sdk27.listeners.onCheckedChange
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onCheckedChange
import org.jetbrains.anko.sdk27.coroutines.onClick
class TipConfigDialog : BaseDialogFragment() {

@ -33,10 +33,9 @@ import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.launch
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import java.util.*
class TocRegexDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {
private val importTocRuleKey = "tocRuleUrl"
private lateinit var adapter: TocRegexAdapter

@ -6,7 +6,7 @@ import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.RecyclerAdapter
import io.legado.app.data.entities.Book
import io.legado.app.databinding.ItemFilletTextBinding
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
class BookAdapter(context: Context, val callBack: CallBack) :
RecyclerAdapter<Book, ItemFilletTextBinding>(context) {

@ -10,8 +10,8 @@ import io.legado.app.ui.widget.anima.explosion_field.ExplosionField
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.listeners.onLongClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import org.jetbrains.anko.sdk27.coroutines.onLongClick
class HistoryKeyAdapter(activity: SearchActivity, val callBack: CallBack) :
@ -41,7 +41,7 @@ class HistoryKeyAdapter(activity: SearchActivity, val callBack: CallBack) :
callBack.searchHistory(it.word)
}
}
onLongClick {
onLongClick(returnValue = true) {
it?.let {
explosionField.explode(it, true)
}
@ -50,7 +50,6 @@ class HistoryKeyAdapter(activity: SearchActivity, val callBack: CallBack) :
App.db.searchKeywordDao.delete(it)
}
}
true
}
}
}

@ -28,10 +28,9 @@ import io.legado.app.utils.*
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import org.jetbrains.anko.startActivity
class SearchActivity : VMBaseActivity<ActivityBookSearchBinding, SearchViewModel>(),
BookAdapter.CallBack,
HistoryKeyAdapter.CallBack,

@ -11,7 +11,7 @@ import io.legado.app.data.entities.SearchBook
import io.legado.app.databinding.ItemSearchBinding
import io.legado.app.utils.gone
import io.legado.app.utils.visible
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
class SearchAdapter(context: Context, val callBack: CallBack) :
DiffRecyclerAdapter<SearchBook, ItemSearchBinding>(context) {

@ -26,8 +26,7 @@ import io.legado.app.utils.observeEvent
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
class SearchContentActivity :
VMBaseActivity<ActivitySearchContentBinding, SearchContentViewModel>(),

@ -9,7 +9,7 @@ import io.legado.app.databinding.ItemSearchListBinding
import io.legado.app.lib.theme.accentColor
import io.legado.app.utils.getCompatColor
import io.legado.app.utils.hexString
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
class SearchContentAdapter(context: Context, val callback: Callback) :
RecyclerAdapter<SearchResult, ItemSearchListBinding>(context) {

@ -20,7 +20,7 @@ import io.legado.app.ui.widget.recycler.DragSelectTouchHelper
import io.legado.app.ui.widget.recycler.ItemTouchCallback.Callback
import io.legado.app.utils.invisible
import io.legado.app.utils.visible
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
class BookSourceAdapter(context: Context, val callBack: CallBack) :
RecyclerAdapter<BookSource, ItemBookSourceBinding>(context),

@ -24,7 +24,7 @@ import io.legado.app.lib.theme.primaryColor
import io.legado.app.ui.widget.recycler.VerticalDivider
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
class GroupManageDialog : DialogFragment(), Toolbar.OnMenuItemClickListener {
private lateinit var viewModel: BookSourceViewModel

@ -7,9 +7,8 @@ import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView
import io.legado.app.data.entities.Bookmark
import io.legado.app.databinding.ItemBookmarkBinding
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.listeners.onLongClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import org.jetbrains.anko.sdk27.coroutines.onLongClick
class BookmarkAdapter(val callback: Callback) : PagedListAdapter<Bookmark, BookmarkAdapter.MyViewHolder>(DIFF_CALLBACK) {
@ -49,9 +48,8 @@ class BookmarkAdapter(val callback: Callback) : PagedListAdapter<Bookmark, Bookm
itemView.onClick {
callback?.onClick(bookmark)
}
itemView.onLongClick {
itemView.onLongClick(returnValue = true) {
callback?.onLongClick(bookmark)
true
}
}
}

@ -10,7 +10,7 @@ import io.legado.app.databinding.ItemChapterListBinding
import io.legado.app.lib.theme.accentColor
import io.legado.app.utils.getCompatColor
import io.legado.app.utils.visible
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
class ChapterListAdapter(context: Context, val callback: Callback) :
RecyclerAdapter<BookChapter, ItemChapterListBinding>(context) {

@ -26,7 +26,7 @@ import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import kotlin.math.min
class ChapterListFragment : VMBaseFragment<ChapterListViewModel>(R.layout.fragment_chapter_list),

@ -19,7 +19,7 @@ import io.legado.app.lib.theme.primaryColor
import io.legado.app.ui.widget.recycler.VerticalDivider
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import org.jetbrains.anko.share
class ThemeListDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {

@ -13,7 +13,7 @@ import io.legado.app.ui.filepicker.entity.FileItem
import io.legado.app.ui.filepicker.utils.ConvertUtils
import io.legado.app.ui.filepicker.utils.FilePickerIcon
import io.legado.app.utils.FileUtils
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import java.io.File
import java.util.*

@ -8,7 +8,7 @@ import io.legado.app.base.adapter.RecyclerAdapter
import io.legado.app.databinding.ItemPathFilepickerBinding
import io.legado.app.ui.filepicker.utils.ConvertUtils
import io.legado.app.ui.filepicker.utils.FilePickerIcon
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import java.util.*

@ -9,8 +9,8 @@ import io.legado.app.data.entities.Book
import io.legado.app.databinding.ItemBookshelfGridBinding
import io.legado.app.lib.theme.ATH
import io.legado.app.utils.invisible
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.listeners.onLongClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import org.jetbrains.anko.sdk27.coroutines.onLongClick
class BooksAdapterGrid(context: Context, private val callBack: CallBack) :
BaseBooksAdapter<ItemBookshelfGridBinding>(context) {
@ -61,11 +61,10 @@ class BooksAdapterGrid(context: Context, private val callBack: CallBack) :
}
}
onLongClick {
onLongClick(returnValue = true) {
getItem(holder.layoutPosition)?.let {
callBack.openBookInfo(it)
}
true
}
}
}

@ -9,8 +9,8 @@ import io.legado.app.data.entities.Book
import io.legado.app.databinding.ItemBookshelfListBinding
import io.legado.app.lib.theme.ATH
import io.legado.app.utils.invisible
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.listeners.onLongClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import org.jetbrains.anko.sdk27.coroutines.onLongClick
class BooksAdapterList(context: Context, private val callBack: CallBack) :
BaseBooksAdapter<ItemBookshelfListBinding>(context) {
@ -67,11 +67,10 @@ class BooksAdapterList(context: Context, private val callBack: CallBack) :
}
}
onLongClick {
onLongClick(returnValue = true) {
getItem(holder.layoutPosition)?.let {
callBack.openBookInfo(it)
}
true
}
}
}

@ -19,9 +19,8 @@ import io.legado.app.utils.dp
import io.legado.app.utils.gone
import io.legado.app.utils.visible
import kotlinx.coroutines.CoroutineScope
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.listeners.onLongClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import org.jetbrains.anko.sdk27.coroutines.onLongClick
class ExploreAdapter(context: Context, private val scope: CoroutineScope, val callBack: CallBack) :
RecyclerAdapter<BookSource, ItemFindBookBinding>(context) {

@ -10,8 +10,8 @@ import io.legado.app.base.adapter.RecyclerAdapter
import io.legado.app.data.entities.RssSource
import io.legado.app.databinding.ItemRssBinding
import io.legado.app.help.ImageLoader
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.listeners.onLongClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import org.jetbrains.anko.sdk27.coroutines.onLongClick
class RssAdapter(context: Context, val callBack: CallBack) :
RecyclerAdapter<RssSource, ItemRssBinding>(context) {
@ -43,11 +43,10 @@ class RssAdapter(context: Context, val callBack: CallBack) :
callBack.openRss(it)
}
}
root.onLongClick {
root.onLongClick(returnValue = true) {
getItemByLayoutPosition(holder.layoutPosition)?.let {
showMenu(ivIcon, it)
}
true
}
}
}

@ -28,7 +28,7 @@ import io.legado.app.utils.getViewModel
import io.legado.app.utils.splitNotBlank
import io.legado.app.utils.startActivity
import io.legado.app.utils.viewbindingdelegate.viewBinding
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
/**
* 订阅界面

@ -24,7 +24,7 @@ import io.legado.app.lib.theme.primaryColor
import io.legado.app.ui.widget.recycler.VerticalDivider
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
class GroupManageDialog : DialogFragment(), Toolbar.OnMenuItemClickListener {
private lateinit var viewModel: ReplaceRuleViewModel

@ -16,7 +16,7 @@ import io.legado.app.databinding.ItemReplaceRuleBinding
import io.legado.app.lib.theme.backgroundColor
import io.legado.app.ui.widget.recycler.DragSelectTouchHelper
import io.legado.app.ui.widget.recycler.ItemTouchCallback
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import java.util.*

@ -21,7 +21,7 @@ import io.legado.app.ui.widget.dialog.TextDialog
import io.legado.app.utils.getViewModel
import io.legado.app.utils.postEvent
import org.jetbrains.anko.displayMetrics
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import org.jetbrains.anko.selector
import org.jetbrains.anko.toast
import kotlin.math.abs

@ -14,7 +14,7 @@ import io.legado.app.databinding.ItemRssArticleBinding
import io.legado.app.help.ImageLoader
import io.legado.app.utils.gone
import io.legado.app.utils.visible
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import org.jetbrains.anko.textColorResource
class RssArticlesAdapter(context: Context, callBack: CallBack) :

@ -14,7 +14,7 @@ import io.legado.app.databinding.ItemRssArticle1Binding
import io.legado.app.help.ImageLoader
import io.legado.app.utils.gone
import io.legado.app.utils.visible
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import org.jetbrains.anko.textColorResource
class RssArticlesAdapter1(context: Context, callBack: CallBack) :

@ -14,7 +14,7 @@ import io.legado.app.databinding.ItemRssArticle2Binding
import io.legado.app.help.ImageLoader
import io.legado.app.utils.gone
import io.legado.app.utils.visible
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import org.jetbrains.anko.textColorResource
class RssArticlesAdapter2(context: Context, callBack: CallBack) :

@ -14,7 +14,7 @@ import io.legado.app.databinding.ItemRssArticleBinding
import io.legado.app.help.ImageLoader
import io.legado.app.utils.gone
import io.legado.app.utils.visible
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
class RssFavoritesAdapter(context: Context, val callBack: CallBack) :
RecyclerAdapter<RssStar, ItemRssArticleBinding>(context) {

@ -24,7 +24,7 @@ import io.legado.app.lib.theme.primaryColor
import io.legado.app.ui.widget.recycler.VerticalDivider
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
class GroupManageDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {
private lateinit var viewModel: RssSourceViewModel

@ -16,7 +16,7 @@ import io.legado.app.databinding.ItemRssSourceBinding
import io.legado.app.lib.theme.backgroundColor
import io.legado.app.ui.widget.recycler.DragSelectTouchHelper
import io.legado.app.ui.widget.recycler.ItemTouchCallback
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
class RssSourceAdapter(context: Context, val callBack: CallBack) :
RecyclerAdapter<RssSource, ItemRssSourceBinding>(context),

@ -11,7 +11,7 @@ import io.legado.app.base.adapter.RecyclerAdapter
import io.legado.app.data.entities.RuleSub
import io.legado.app.databinding.ItemRuleSubBinding
import io.legado.app.ui.widget.recycler.ItemTouchCallback
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
class RuleSubAdapter(context: Context, val callBack: Callback) :
RecyclerAdapter<RuleSub, ItemRuleSubBinding>(context),

@ -12,7 +12,7 @@ import io.legado.app.lib.theme.getPrimaryTextColor
import io.legado.app.ui.widget.seekbar.SeekBarChangeListener
import io.legado.app.utils.ColorUtils
import io.legado.app.utils.progressAdd
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
class DetailSeekBar @JvmOverloads constructor(
context: Context,

@ -10,7 +10,7 @@ import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.RecyclerAdapter
import io.legado.app.databinding.ItemFilletTextBinding
import io.legado.app.databinding.PopupKeyboardToolBinding
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
class KeyboardToolPop(

@ -14,7 +14,7 @@ import io.legado.app.help.AppConfig
import io.legado.app.lib.theme.*
import io.legado.app.utils.ColorUtils
import io.legado.app.utils.visible
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
@Suppress("unused")
class SelectActionBar @JvmOverloads constructor(

@ -11,7 +11,7 @@ import io.legado.app.utils.DocItem
import io.legado.app.utils.RealPathUtil
import io.legado.app.utils.invisible
import io.legado.app.utils.visible
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
import org.jetbrains.anko.toast
import java.io.File
import java.net.URLDecoder

@ -23,7 +23,7 @@ import io.legado.app.lib.theme.primaryColor
import io.legado.app.utils.getCompatDrawable
import io.legado.app.utils.getSize
import io.legado.app.utils.viewbindingdelegate.viewBinding
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
class IconListPreference(context: Context, attrs: AttributeSet) : ListPreference(context, attrs) {

@ -18,7 +18,7 @@ import io.legado.app.lib.theme.getPrimaryTextColor
import io.legado.app.lib.theme.getSecondaryTextColor
import io.legado.app.utils.ColorUtils
import org.jetbrains.anko.layoutInflater
import org.jetbrains.anko.sdk27.listeners.onLongClick
import org.jetbrains.anko.sdk27.coroutines.onLongClick
import kotlin.math.roundToInt
class Preference(context: Context, attrs: AttributeSet) :
@ -117,9 +117,8 @@ class Preference(context: Context, attrs: AttributeSet) :
isBottomBackground = isBottomBackground
)
super.onBindViewHolder(holder)
holder?.itemView?.onLongClick {
holder?.itemView?.onLongClick(returnValue = true) {
onLongClick?.invoke()
true
}
}

@ -15,7 +15,7 @@ import io.legado.app.R
import io.legado.app.lib.theme.ATH
import io.legado.app.utils.gone
import io.legado.app.utils.visible
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.coroutines.onClick
@Suppress("unused")
class AutoCompleteTextView @JvmOverloads constructor(

Loading…
Cancel
Save