From 3b7fca8f9ada628483ab0e2dc44db3277bcf9803 Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 3 Feb 2021 11:27:07 +0800 Subject: [PATCH] replace anko-sdk27-listeners to anko:anko-sdk27-coroutines --- app/build.gradle | 2 +- .../legado/app/ui/about/ReadRecordActivity.kt | 2 +- .../ui/association/ImportBookSourceDialog.kt | 2 +- .../ui/association/ImportRssSourceDialog.kt | 2 +- .../legado/app/ui/audio/AudioPlayActivity.kt | 19 +++++++++---------- .../app/ui/book/arrange/ArrangeBookAdapter.kt | 2 +- .../legado/app/ui/book/cache/CacheAdapter.kt | 2 +- .../app/ui/book/changecover/CoverAdapter.kt | 2 +- .../book/changesource/ChangeSourceAdapter.kt | 7 +++---- .../app/ui/book/explore/ExploreShowAdapter.kt | 2 +- .../app/ui/book/group/GroupManageDialog.kt | 2 +- .../app/ui/book/group/GroupSelectDialog.kt | 2 +- .../app/ui/book/info/BookInfoActivity.kt | 2 +- .../app/ui/book/info/ChapterListAdapter.kt | 2 +- .../ui/book/info/edit/BookInfoEditActivity.kt | 2 +- .../app/ui/book/local/ImportBookActivity.kt | 2 +- .../app/ui/book/local/ImportBookAdapter.kt | 3 +-- .../io/legado/app/ui/book/read/ReadMenu.kt | 7 +++---- .../legado/app/ui/book/read/TextActionMenu.kt | 2 +- .../app/ui/book/read/config/AutoReadDialog.kt | 2 +- .../app/ui/book/read/config/BgAdapter.kt | 2 +- .../ui/book/read/config/BgTextConfigDialog.kt | 4 ++-- .../ui/book/read/config/ChineseConverter.kt | 2 +- .../read/config/ClickActionConfigDialog.kt | 2 +- .../app/ui/book/read/config/PageKeyDialog.kt | 3 +-- .../ui/book/read/config/ReadAloudDialog.kt | 2 +- .../ui/book/read/config/ReadStyleDialog.kt | 10 ++++------ .../ui/book/read/config/SpeakEngineDialog.kt | 2 +- .../read/config/TextFontWeightConverter.kt | 2 +- .../ui/book/read/config/TipConfigDialog.kt | 4 ++-- .../app/ui/book/read/config/TocRegexDialog.kt | 3 +-- .../legado/app/ui/book/search/BookAdapter.kt | 2 +- .../app/ui/book/search/HistoryKeyAdapter.kt | 7 +++---- .../app/ui/book/search/SearchActivity.kt | 3 +-- .../app/ui/book/search/SearchAdapter.kt | 2 +- .../searchContent/SearchContentActivity.kt | 3 +-- .../searchContent/SearchContentAdapter.kt | 2 +- .../book/source/manage/BookSourceAdapter.kt | 2 +- .../book/source/manage/GroupManageDialog.kt | 2 +- .../legado/app/ui/book/toc/BookmarkAdapter.kt | 8 +++----- .../app/ui/book/toc/ChapterListAdapter.kt | 2 +- .../app/ui/book/toc/ChapterListFragment.kt | 2 +- .../legado/app/ui/config/ThemeListDialog.kt | 2 +- .../app/ui/filepicker/adapter/FileAdapter.kt | 2 +- .../app/ui/filepicker/adapter/PathAdapter.kt | 2 +- .../main/bookshelf/books/BooksAdapterGrid.kt | 7 +++---- .../main/bookshelf/books/BooksAdapterList.kt | 7 +++---- .../app/ui/main/explore/ExploreAdapter.kt | 5 ++--- .../io/legado/app/ui/main/rss/RssAdapter.kt | 7 +++---- .../io/legado/app/ui/main/rss/RssFragment.kt | 2 +- .../app/ui/replace/GroupManageDialog.kt | 2 +- .../app/ui/replace/ReplaceRuleAdapter.kt | 2 +- .../ui/replace/edit/ReplaceEditActivity.kt | 2 +- .../app/ui/rss/article/RssArticlesAdapter.kt | 2 +- .../app/ui/rss/article/RssArticlesAdapter1.kt | 2 +- .../app/ui/rss/article/RssArticlesAdapter2.kt | 2 +- .../ui/rss/favorites/RssFavoritesAdapter.kt | 2 +- .../ui/rss/source/manage/GroupManageDialog.kt | 2 +- .../ui/rss/source/manage/RssSourceAdapter.kt | 2 +- .../app/ui/rss/subscription/RuleSubAdapter.kt | 2 +- .../io/legado/app/ui/widget/DetailSeekBar.kt | 2 +- .../legado/app/ui/widget/KeyboardToolPop.kt | 2 +- .../legado/app/ui/widget/SelectActionBar.kt | 2 +- .../legado/app/ui/widget/font/FontAdapter.kt | 2 +- .../app/ui/widget/prefs/IconListPreference.kt | 2 +- .../legado/app/ui/widget/prefs/Preference.kt | 5 ++--- .../ui/widget/text/AutoCompleteTextView.kt | 2 +- 67 files changed, 96 insertions(+), 114 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index bdf74a1f7..d1eddd583 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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' diff --git a/app/src/main/java/io/legado/app/ui/about/ReadRecordActivity.kt b/app/src/main/java/io/legado/app/ui/about/ReadRecordActivity.kt index f974a3dbc..23ece585c 100644 --- a/app/src/main/java/io/legado/app/ui/about/ReadRecordActivity.kt +++ b/app/src/main/java/io/legado/app/ui/about/ReadRecordActivity.kt @@ -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() { diff --git a/app/src/main/java/io/legado/app/ui/association/ImportBookSourceDialog.kt b/app/src/main/java/io/legado/app/ui/association/ImportBookSourceDialog.kt index 0f3e6008f..0915e306e 100644 --- a/app/src/main/java/io/legado/app/ui/association/ImportBookSourceDialog.kt +++ b/app/src/main/java/io/legado/app/ui/association/ImportBookSourceDialog.kt @@ -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 /** * 导入书源弹出窗口 diff --git a/app/src/main/java/io/legado/app/ui/association/ImportRssSourceDialog.kt b/app/src/main/java/io/legado/app/ui/association/ImportRssSourceDialog.kt index 5ad9aeee7..0ae606794 100644 --- a/app/src/main/java/io/legado/app/ui/association/ImportRssSourceDialog.kt +++ b/app/src/main/java/io/legado/app/ui/association/ImportRssSourceDialog.kt @@ -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源弹出窗口 diff --git a/app/src/main/java/io/legado/app/ui/audio/AudioPlayActivity.kt b/app/src/main/java/io/legado/app/ui/audio/AudioPlayActivity.kt index aa8a95a83..f943878bf 100644 --- a/app/src/main/java/io/legado/app/ui/audio/AudioPlayActivity.kt +++ b/app/src/main/java/io/legado/app/ui/audio/AudioPlayActivity.kt @@ -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) } } 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/arrange/ArrangeBookAdapter.kt index d2423de01..6ee3d54f9 100644 --- a/app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookAdapter.kt @@ -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) : diff --git a/app/src/main/java/io/legado/app/ui/book/cache/CacheAdapter.kt b/app/src/main/java/io/legado/app/ui/book/cache/CacheAdapter.kt index c7e3209b8..7916dcc46 100644 --- a/app/src/main/java/io/legado/app/ui/book/cache/CacheAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/cache/CacheAdapter.kt @@ -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 diff --git a/app/src/main/java/io/legado/app/ui/book/changecover/CoverAdapter.kt b/app/src/main/java/io/legado/app/ui/book/changecover/CoverAdapter.kt index 2d181d28c..97b665e6e 100644 --- a/app/src/main/java/io/legado/app/ui/book/changecover/CoverAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/changecover/CoverAdapter.kt @@ -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(context) { diff --git a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceAdapter.kt b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceAdapter.kt index 2db9cb239..4d238a245 100644 --- a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceAdapter.kt @@ -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 } } diff --git a/app/src/main/java/io/legado/app/ui/book/explore/ExploreShowAdapter.kt b/app/src/main/java/io/legado/app/ui/book/explore/ExploreShowAdapter.kt index 77b15300a..c25be5124 100644 --- a/app/src/main/java/io/legado/app/ui/book/explore/ExploreShowAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/explore/ExploreShowAdapter.kt @@ -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(context) { diff --git a/app/src/main/java/io/legado/app/ui/book/group/GroupManageDialog.kt b/app/src/main/java/io/legado/app/ui/book/group/GroupManageDialog.kt index a2a7bd4c2..06b6efd37 100644 --- a/app/src/main/java/io/legado/app/ui/book/group/GroupManageDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/group/GroupManageDialog.kt @@ -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 diff --git a/app/src/main/java/io/legado/app/ui/book/group/GroupSelectDialog.kt b/app/src/main/java/io/legado/app/ui/book/group/GroupSelectDialog.kt index 0aaac8ce4..ea039a9e9 100644 --- a/app/src/main/java/io/legado/app/ui/book/group/GroupSelectDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/group/GroupSelectDialog.kt @@ -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 { diff --git a/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt b/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt index 3314f8aa9..c992f2ad0 100644 --- a/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt @@ -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 diff --git a/app/src/main/java/io/legado/app/ui/book/info/ChapterListAdapter.kt b/app/src/main/java/io/legado/app/ui/book/info/ChapterListAdapter.kt index dab2525ec..0f0160517 100644 --- a/app/src/main/java/io/legado/app/ui/book/info/ChapterListAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/info/ChapterListAdapter.kt @@ -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) : diff --git a/app/src/main/java/io/legado/app/ui/book/info/edit/BookInfoEditActivity.kt b/app/src/main/java/io/legado/app/ui/book/info/edit/BookInfoEditActivity.kt index f5e4e9f38..e22184f2f 100644 --- a/app/src/main/java/io/legado/app/ui/book/info/edit/BookInfoEditActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/info/edit/BookInfoEditActivity.kt @@ -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 diff --git a/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt index f87a0817e..f3762a29c 100644 --- a/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt @@ -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.* diff --git a/app/src/main/java/io/legado/app/ui/book/local/ImportBookAdapter.kt b/app/src/main/java/io/legado/app/ui/book/local/ImportBookAdapter.kt index a2ff5d096..687dc992b 100644 --- a/app/src/main/java/io/legado/app/ui/book/local/ImportBookAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/local/ImportBookAdapter.kt @@ -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(context) { diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt index 63fa5c0f1..2e28fbdb5 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt @@ -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 { diff --git a/app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt b/app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt index 4a75e05c0..0dff7326c 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt @@ -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.* diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/AutoReadDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/AutoReadDialog.kt index 67656c57e..2c1169529 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/AutoReadDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/AutoReadDialog.kt @@ -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 diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/BgAdapter.kt b/app/src/main/java/io/legado/app/ui/book/read/config/BgAdapter.kt index 826a701f2..435083830 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/BgAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/BgAdapter.kt @@ -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) : diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt index edf99df17..c875ae76c 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt @@ -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 diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/ChineseConverter.kt b/app/src/main/java/io/legado/app/ui/book/read/config/ChineseConverter.kt index dc8f36d67..4b227a9e0 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/ChineseConverter.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/ChineseConverter.kt @@ -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) { diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/ClickActionConfigDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/ClickActionConfigDialog.kt index cc4a3157b..4f142a192 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/ClickActionConfigDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/ClickActionConfigDialog.kt @@ -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) diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/PageKeyDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/PageKeyDialog.kt index 85ec5d31a..8994db56f 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/PageKeyDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/PageKeyDialog.kt @@ -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) { diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt index 8fb2bbcea..8a913a5c2 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt @@ -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 diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt index 556545e95..b1df7f52e 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt @@ -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 } } } diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/SpeakEngineDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/SpeakEngineDialog.kt index 2c807a279..f5275b730 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/SpeakEngineDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/SpeakEngineDialog.kt @@ -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) diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/TextFontWeightConverter.kt b/app/src/main/java/io/legado/app/ui/book/read/config/TextFontWeightConverter.kt index ae240846d..dd7f60227 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/TextFontWeightConverter.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/TextFontWeightConverter.kt @@ -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) { diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/TipConfigDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/TipConfigDialog.kt index 7f20e8879..7654ba733 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/TipConfigDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/TipConfigDialog.kt @@ -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() { diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/TocRegexDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/TocRegexDialog.kt index 11ee46f6c..9aad332f9 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/TocRegexDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/TocRegexDialog.kt @@ -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 diff --git a/app/src/main/java/io/legado/app/ui/book/search/BookAdapter.kt b/app/src/main/java/io/legado/app/ui/book/search/BookAdapter.kt index 3f27b52c6..e192f8428 100644 --- a/app/src/main/java/io/legado/app/ui/book/search/BookAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/search/BookAdapter.kt @@ -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(context) { diff --git a/app/src/main/java/io/legado/app/ui/book/search/HistoryKeyAdapter.kt b/app/src/main/java/io/legado/app/ui/book/search/HistoryKeyAdapter.kt index 15c0695c9..a2022c0d1 100644 --- a/app/src/main/java/io/legado/app/ui/book/search/HistoryKeyAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/search/HistoryKeyAdapter.kt @@ -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 } } } diff --git a/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt b/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt index 3f1d377bb..4f6a0bfbd 100644 --- a/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt @@ -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(), BookAdapter.CallBack, HistoryKeyAdapter.CallBack, diff --git a/app/src/main/java/io/legado/app/ui/book/search/SearchAdapter.kt b/app/src/main/java/io/legado/app/ui/book/search/SearchAdapter.kt index 7ad9d35e0..122fb5a9e 100644 --- a/app/src/main/java/io/legado/app/ui/book/search/SearchAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/search/SearchAdapter.kt @@ -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(context) { diff --git a/app/src/main/java/io/legado/app/ui/book/searchContent/SearchContentActivity.kt b/app/src/main/java/io/legado/app/ui/book/searchContent/SearchContentActivity.kt index a111a8cf2..93401168a 100644 --- a/app/src/main/java/io/legado/app/ui/book/searchContent/SearchContentActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/searchContent/SearchContentActivity.kt @@ -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(), diff --git a/app/src/main/java/io/legado/app/ui/book/searchContent/SearchContentAdapter.kt b/app/src/main/java/io/legado/app/ui/book/searchContent/SearchContentAdapter.kt index f65042827..9bacaa3d4 100644 --- a/app/src/main/java/io/legado/app/ui/book/searchContent/SearchContentAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/searchContent/SearchContentAdapter.kt @@ -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(context) { diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceAdapter.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceAdapter.kt index 1545a3108..022a4e800 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceAdapter.kt @@ -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(context), diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/GroupManageDialog.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/GroupManageDialog.kt index 45e973c8b..5085076f4 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/GroupManageDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/manage/GroupManageDialog.kt @@ -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 diff --git a/app/src/main/java/io/legado/app/ui/book/toc/BookmarkAdapter.kt b/app/src/main/java/io/legado/app/ui/book/toc/BookmarkAdapter.kt index 914414a60..5cea134ec 100644 --- a/app/src/main/java/io/legado/app/ui/book/toc/BookmarkAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/toc/BookmarkAdapter.kt @@ -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(DIFF_CALLBACK) { @@ -49,9 +48,8 @@ class BookmarkAdapter(val callback: Callback) : PagedListAdapter(context) { 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 0a4b060fb..eeb80791e 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 @@ -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(R.layout.fragment_chapter_list), diff --git a/app/src/main/java/io/legado/app/ui/config/ThemeListDialog.kt b/app/src/main/java/io/legado/app/ui/config/ThemeListDialog.kt index 974924802..6939a2625 100644 --- a/app/src/main/java/io/legado/app/ui/config/ThemeListDialog.kt +++ b/app/src/main/java/io/legado/app/ui/config/ThemeListDialog.kt @@ -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 { diff --git a/app/src/main/java/io/legado/app/ui/filepicker/adapter/FileAdapter.kt b/app/src/main/java/io/legado/app/ui/filepicker/adapter/FileAdapter.kt index cdd8301fc..8aee54788 100644 --- a/app/src/main/java/io/legado/app/ui/filepicker/adapter/FileAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/filepicker/adapter/FileAdapter.kt @@ -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.* diff --git a/app/src/main/java/io/legado/app/ui/filepicker/adapter/PathAdapter.kt b/app/src/main/java/io/legado/app/ui/filepicker/adapter/PathAdapter.kt index 4ad56534f..e3c911876 100644 --- a/app/src/main/java/io/legado/app/ui/filepicker/adapter/PathAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/filepicker/adapter/PathAdapter.kt @@ -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.* diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterGrid.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterGrid.kt index 27fe663d3..395bedafd 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterGrid.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterGrid.kt @@ -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(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 } } } diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterList.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterList.kt index 5f3822e01..a08ec13df 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterList.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterList.kt @@ -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(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 } } } diff --git a/app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt b/app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt index b0aba869f..234616e99 100644 --- a/app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt @@ -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(context) { diff --git a/app/src/main/java/io/legado/app/ui/main/rss/RssAdapter.kt b/app/src/main/java/io/legado/app/ui/main/rss/RssAdapter.kt index 40218e5d3..d22f7328e 100644 --- a/app/src/main/java/io/legado/app/ui/main/rss/RssAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/main/rss/RssAdapter.kt @@ -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(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 } } } diff --git a/app/src/main/java/io/legado/app/ui/main/rss/RssFragment.kt b/app/src/main/java/io/legado/app/ui/main/rss/RssFragment.kt index daf1dde0d..20d94c924 100644 --- a/app/src/main/java/io/legado/app/ui/main/rss/RssFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/rss/RssFragment.kt @@ -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 /** * 订阅界面 diff --git a/app/src/main/java/io/legado/app/ui/replace/GroupManageDialog.kt b/app/src/main/java/io/legado/app/ui/replace/GroupManageDialog.kt index a5e23d96f..a863681ce 100644 --- a/app/src/main/java/io/legado/app/ui/replace/GroupManageDialog.kt +++ b/app/src/main/java/io/legado/app/ui/replace/GroupManageDialog.kt @@ -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 diff --git a/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleAdapter.kt b/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleAdapter.kt index c8356bea7..1ad90b2b2 100644 --- a/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleAdapter.kt @@ -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.* diff --git a/app/src/main/java/io/legado/app/ui/replace/edit/ReplaceEditActivity.kt b/app/src/main/java/io/legado/app/ui/replace/edit/ReplaceEditActivity.kt index 9d56d65e4..669945224 100644 --- a/app/src/main/java/io/legado/app/ui/replace/edit/ReplaceEditActivity.kt +++ b/app/src/main/java/io/legado/app/ui/replace/edit/ReplaceEditActivity.kt @@ -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 diff --git a/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter.kt b/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter.kt index b321a9e74..85ae70914 100644 --- a/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter.kt @@ -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) : diff --git a/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter1.kt b/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter1.kt index 4b77fa6e7..4b1702bcd 100644 --- a/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter1.kt +++ b/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter1.kt @@ -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) : diff --git a/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter2.kt b/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter2.kt index 44c0df7ed..5c53dd4ac 100644 --- a/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter2.kt +++ b/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter2.kt @@ -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) : diff --git a/app/src/main/java/io/legado/app/ui/rss/favorites/RssFavoritesAdapter.kt b/app/src/main/java/io/legado/app/ui/rss/favorites/RssFavoritesAdapter.kt index 775388364..64300c104 100644 --- a/app/src/main/java/io/legado/app/ui/rss/favorites/RssFavoritesAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/rss/favorites/RssFavoritesAdapter.kt @@ -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(context) { diff --git a/app/src/main/java/io/legado/app/ui/rss/source/manage/GroupManageDialog.kt b/app/src/main/java/io/legado/app/ui/rss/source/manage/GroupManageDialog.kt index b5444cebe..8623961bc 100644 --- a/app/src/main/java/io/legado/app/ui/rss/source/manage/GroupManageDialog.kt +++ b/app/src/main/java/io/legado/app/ui/rss/source/manage/GroupManageDialog.kt @@ -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 diff --git a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceAdapter.kt b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceAdapter.kt index fae25cdb5..fe7d9803d 100644 --- a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceAdapter.kt @@ -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(context), diff --git a/app/src/main/java/io/legado/app/ui/rss/subscription/RuleSubAdapter.kt b/app/src/main/java/io/legado/app/ui/rss/subscription/RuleSubAdapter.kt index d8c3c044d..0173f4fca 100644 --- a/app/src/main/java/io/legado/app/ui/rss/subscription/RuleSubAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/rss/subscription/RuleSubAdapter.kt @@ -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(context), diff --git a/app/src/main/java/io/legado/app/ui/widget/DetailSeekBar.kt b/app/src/main/java/io/legado/app/ui/widget/DetailSeekBar.kt index b0a8115da..6db32a25b 100644 --- a/app/src/main/java/io/legado/app/ui/widget/DetailSeekBar.kt +++ b/app/src/main/java/io/legado/app/ui/widget/DetailSeekBar.kt @@ -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, diff --git a/app/src/main/java/io/legado/app/ui/widget/KeyboardToolPop.kt b/app/src/main/java/io/legado/app/ui/widget/KeyboardToolPop.kt index dbbc10af4..6d9f99e50 100644 --- a/app/src/main/java/io/legado/app/ui/widget/KeyboardToolPop.kt +++ b/app/src/main/java/io/legado/app/ui/widget/KeyboardToolPop.kt @@ -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( diff --git a/app/src/main/java/io/legado/app/ui/widget/SelectActionBar.kt b/app/src/main/java/io/legado/app/ui/widget/SelectActionBar.kt index 316f4102c..006db6941 100644 --- a/app/src/main/java/io/legado/app/ui/widget/SelectActionBar.kt +++ b/app/src/main/java/io/legado/app/ui/widget/SelectActionBar.kt @@ -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( diff --git a/app/src/main/java/io/legado/app/ui/widget/font/FontAdapter.kt b/app/src/main/java/io/legado/app/ui/widget/font/FontAdapter.kt index 8ff31f9f5..840e8faac 100644 --- a/app/src/main/java/io/legado/app/ui/widget/font/FontAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/widget/font/FontAdapter.kt @@ -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 diff --git a/app/src/main/java/io/legado/app/ui/widget/prefs/IconListPreference.kt b/app/src/main/java/io/legado/app/ui/widget/prefs/IconListPreference.kt index 673ba1aca..df63e08f8 100644 --- a/app/src/main/java/io/legado/app/ui/widget/prefs/IconListPreference.kt +++ b/app/src/main/java/io/legado/app/ui/widget/prefs/IconListPreference.kt @@ -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) { diff --git a/app/src/main/java/io/legado/app/ui/widget/prefs/Preference.kt b/app/src/main/java/io/legado/app/ui/widget/prefs/Preference.kt index 042b03868..dfb0f2f8d 100644 --- a/app/src/main/java/io/legado/app/ui/widget/prefs/Preference.kt +++ b/app/src/main/java/io/legado/app/ui/widget/prefs/Preference.kt @@ -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 } } diff --git a/app/src/main/java/io/legado/app/ui/widget/text/AutoCompleteTextView.kt b/app/src/main/java/io/legado/app/ui/widget/text/AutoCompleteTextView.kt index 9e9153e71..8e367df76 100644 --- a/app/src/main/java/io/legado/app/ui/widget/text/AutoCompleteTextView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/text/AutoCompleteTextView.kt @@ -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(