pull/1072/head
gedoor 3 years ago
parent f9a5c9ee63
commit 0c8a421e56
  1. 4
      app/src/main/java/io/legado/app/ui/association/ImportBookSourceActivity.kt
  2. 4
      app/src/main/java/io/legado/app/ui/association/ImportReplaceRuleActivity.kt
  3. 4
      app/src/main/java/io/legado/app/ui/association/ImportRssSourceActivity.kt
  4. 3
      app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookActivity.kt
  5. 22
      app/src/main/java/io/legado/app/ui/book/cache/CacheActivity.kt
  6. 2
      app/src/main/java/io/legado/app/ui/book/explore/ExploreShowActivity.kt
  7. 2
      app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt
  8. 3
      app/src/main/java/io/legado/app/ui/book/info/edit/BookInfoEditActivity.kt
  9. 8
      app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt
  10. 3
      app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt
  11. 3
      app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt
  12. 3
      app/src/main/java/io/legado/app/ui/book/searchContent/SearchContentActivity.kt
  13. 3
      app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugActivity.kt
  14. 2
      app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt
  15. 2
      app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt
  16. 2
      app/src/main/java/io/legado/app/ui/book/toc/BookmarkFragment.kt
  17. 2
      app/src/main/java/io/legado/app/ui/book/toc/ChapterListFragment.kt
  18. 2
      app/src/main/java/io/legado/app/ui/book/toc/TocActivity.kt
  19. 2
      app/src/main/java/io/legado/app/ui/config/ConfigActivity.kt
  20. 2
      app/src/main/java/io/legado/app/ui/main/MainActivity.kt
  21. 4
      app/src/main/java/io/legado/app/ui/main/bookshelf/BaseBookshelfFragment.kt
  22. 2
      app/src/main/java/io/legado/app/ui/main/explore/ExploreFragment.kt
  23. 3
      app/src/main/java/io/legado/app/ui/main/rss/RssFragment.kt
  24. 2
      app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt
  25. 3
      app/src/main/java/io/legado/app/ui/replace/edit/ReplaceEditActivity.kt
  26. 6
      app/src/main/java/io/legado/app/ui/rss/article/RssArticlesFragment.kt
  27. 3
      app/src/main/java/io/legado/app/ui/rss/article/RssSortActivity.kt
  28. 2
      app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt
  29. 2
      app/src/main/java/io/legado/app/ui/rss/source/debug/RssSourceDebugActivity.kt
  30. 4
      app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt
  31. 3
      app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt

@ -19,9 +19,7 @@ class ImportBookSourceActivity :
) {
override val binding by viewBinding(ActivityTranslucenceBinding::inflate)
override val viewModel: ImportBookSourceViewModel
by viewModels()
override val viewModel by viewModels<ImportBookSourceViewModel>()
override fun onActivityCreated(savedInstanceState: Bundle?) {
binding.rotateLoading.show()

@ -18,9 +18,7 @@ class ImportReplaceRuleActivity :
) {
override val binding by viewBinding(ActivityTranslucenceBinding::inflate)
override val viewModel: ImportReplaceRuleViewModel
by viewModels()
override val viewModel by viewModels<ImportReplaceRuleViewModel>()
override fun onActivityCreated(savedInstanceState: Bundle?) {
binding.rotateLoading.show()

@ -18,9 +18,7 @@ class ImportRssSourceActivity :
) {
override val binding by viewBinding(ActivityTranslucenceBinding::inflate)
override val viewModel: ImportRssSourceViewModel
by viewModels()
override val viewModel by viewModels<ImportRssSourceViewModel>()
override fun onActivityCreated(savedInstanceState: Bundle?) {
binding.rotateLoading.show()

@ -39,8 +39,7 @@ class ArrangeBookActivity : VMBaseActivity<ActivityArrangeBookBinding, ArrangeBo
GroupSelectDialog.CallBack {
override val binding by viewBinding(ActivityArrangeBookBinding::inflate)
override val viewModel: ArrangeBookViewModel
by viewModels()
override val viewModel by viewModels<ArrangeBookViewModel>()
override val groupList: ArrayList<BookGroup> = arrayListOf()
private val groupRequestCode = 22
private val addToGroupRequestCode = 34

@ -39,6 +39,18 @@ import java.util.concurrent.CopyOnWriteArraySet
class CacheActivity : VMBaseActivity<ActivityCacheBookBinding, CacheViewModel>(),
CacheAdapter.CallBack {
override val binding by viewBinding(ActivityCacheBookBinding::inflate)
override val viewModel by viewModels<CacheViewModel>()
private val exportBookPathKey = "exportBookPath"
lateinit var adapter: CacheAdapter
private var groupLiveData: LiveData<List<BookGroup>>? = null
private var booksLiveData: LiveData<List<Book>>? = null
private var menu: Menu? = null
private var exportPosition = -1
private val groupList: ArrayList<BookGroup> = arrayListOf()
private var groupId: Long = -1
private val exportDir = registerForActivityResult(FilePicker()) { uri ->
uri ?: return@registerForActivityResult
if (uri.isContentScheme()) {
@ -51,16 +63,6 @@ class CacheActivity : VMBaseActivity<ActivityCacheBookBinding, CacheViewModel>()
}
}
}
private val exportBookPathKey = "exportBookPath"
lateinit var adapter: CacheAdapter
private var groupLiveData: LiveData<List<BookGroup>>? = null
private var booksLiveData: LiveData<List<Book>>? = null
private var menu: Menu? = null
private var exportPosition = -1
private val groupList: ArrayList<BookGroup> = arrayListOf()
private var groupId: Long = -1
override val binding by viewBinding(ActivityCacheBookBinding::inflate)
override val viewModel: CacheViewModel by viewModels()
override fun onActivityCreated(savedInstanceState: Bundle?) {
groupId = intent.getLongExtra("groupId", -1)

@ -18,7 +18,7 @@ import io.legado.app.utils.viewbindingdelegate.viewBinding
class ExploreShowActivity : VMBaseActivity<ActivityExploreShowBinding, ExploreShowViewModel>(),
ExploreShowAdapter.CallBack {
override val binding by viewBinding(ActivityExploreShowBinding::inflate)
override val viewModel: ExploreShowViewModel by viewModels()
override val viewModel by viewModels<ExploreShowViewModel>()
private lateinit var adapter: ExploreShowAdapter
private lateinit var loadMoreView: LoadMoreView

@ -91,7 +91,7 @@ class BookInfoActivity :
}
override val binding by viewBinding(ActivityBookInfoBinding::inflate)
override val viewModel: BookInfoViewModel by viewModels()
override val viewModel by viewModels<BookInfoViewModel>()
@SuppressLint("PrivateResource")
override fun onActivityCreated(savedInstanceState: Bundle?) {

@ -31,8 +31,7 @@ class BookInfoEditActivity :
}
override val binding by viewBinding(ActivityBookInfoEditBinding::inflate)
override val viewModel: BookInfoEditViewModel
by viewModels()
override val viewModel by viewModels<BookInfoEditViewModel>()
override fun onActivityCreated(savedInstanceState: Bundle?) {
viewModel.bookData.observe(this, { upView(it) })

@ -39,6 +39,10 @@ class ImportBookActivity : VMBaseActivity<ActivityImportBookBinding, ImportBookV
PopupMenu.OnMenuItemClickListener,
ImportBookAdapter.CallBack,
SelectActionBar.CallBack {
override val binding by viewBinding(ActivityImportBookBinding::inflate)
override val viewModel by viewModels<ImportBookViewModel>()
private var rootDoc: DocumentFile? = null
private val subDocs = arrayListOf<DocumentFile>()
private lateinit var adapter: ImportBookAdapter
@ -58,10 +62,6 @@ class ImportBookActivity : VMBaseActivity<ActivityImportBookBinding, ImportBookV
}
}
override val binding by viewBinding(ActivityImportBookBinding::inflate)
override val viewModel: ImportBookViewModel
by viewModels()
override fun onActivityCreated(savedInstanceState: Bundle?) {
initView()
initEvent()

@ -43,8 +43,7 @@ abstract class ReadBookBaseActivity :
VMBaseActivity<ActivityBookReadBinding, ReadBookViewModel>(imageBg = false) {
override val binding by viewBinding(ActivityBookReadBinding::inflate)
override val viewModel: ReadBookViewModel
by viewModels()
override val viewModel by viewModels<ReadBookViewModel>()
var bottomDialog = 0
override fun onCreate(savedInstanceState: Bundle?) {

@ -38,8 +38,7 @@ class SearchActivity : VMBaseActivity<ActivityBookSearchBinding, SearchViewModel
SearchAdapter.CallBack {
override val binding by viewBinding(ActivityBookSearchBinding::inflate)
override val viewModel: SearchViewModel
by viewModels()
override val viewModel by viewModels<SearchViewModel>()
lateinit var adapter: SearchAdapter
private lateinit var bookAdapter: BookAdapter

@ -34,8 +34,7 @@ class SearchContentActivity :
SearchContentAdapter.Callback {
override val binding by viewBinding(ActivitySearchContentBinding::inflate)
override val viewModel: SearchContentViewModel
by viewModels()
override val viewModel by viewModels<SearchContentViewModel>()
lateinit var adapter: SearchContentAdapter
private lateinit var mLayoutManager: UpLinearLayoutManager
private lateinit var searchView: SearchView

@ -20,8 +20,7 @@ import kotlinx.coroutines.launch
class BookSourceDebugActivity : VMBaseActivity<ActivitySourceDebugBinding, BookSourceDebugModel>() {
override val binding by viewBinding(ActivitySourceDebugBinding::inflate)
override val viewModel: BookSourceDebugModel
by viewModels()
override val viewModel by viewModels<BookSourceDebugModel>()
private lateinit var adapter: BookSourceDebugAdapter
private lateinit var searchView: SearchView

@ -40,7 +40,7 @@ class BookSourceEditActivity :
KeyboardToolPop.CallBack {
override val binding by viewBinding(ActivityBookSourceEditBinding::inflate)
override val viewModel: BookSourceEditViewModel by viewModels()
override val viewModel by viewModels<BookSourceEditViewModel>()
private val adapter = BookSourceEditAdapter()
private val sourceEntities: ArrayList<EditEntity> = ArrayList()

@ -48,7 +48,7 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
SelectActionBar.CallBack,
SearchView.OnQueryTextListener {
override val binding by viewBinding(ActivityBookSourceBinding::inflate)
override val viewModel: BookSourceViewModel by viewModels()
override val viewModel by viewModels<BookSourceViewModel>()
private val importRecordKey = "bookSourceRecordKey"
private lateinit var adapter: BookSourceAdapter
private lateinit var searchView: SearchView

@ -25,7 +25,7 @@ import io.legado.app.utils.viewbindingdelegate.viewBinding
class BookmarkFragment : VMBaseFragment<TocViewModel>(R.layout.fragment_bookmark),
BookmarkAdapter.Callback,
TocViewModel.BookmarkCallBack {
override val viewModel: TocViewModel by activityViewModels()
override val viewModel by activityViewModels<TocViewModel>()
private val binding by viewBinding(FragmentBookmarkBinding::bind)
private lateinit var adapter: BookmarkAdapter
private var bookmarkLiveData: LiveData<List<Bookmark>>? = null

@ -31,7 +31,7 @@ import kotlin.math.min
class ChapterListFragment : VMBaseFragment<TocViewModel>(R.layout.fragment_chapter_list),
ChapterListAdapter.Callback,
TocViewModel.ChapterListCallBack {
override val viewModel: TocViewModel by activityViewModels()
override val viewModel by activityViewModels<TocViewModel>()
private val binding by viewBinding(FragmentChapterListBinding::bind)
lateinit var adapter: ChapterListAdapter
private var durChapterIndex = 0

@ -26,7 +26,7 @@ import io.legado.app.utils.visible
class TocActivity : VMBaseActivity<ActivityChapterListBinding, TocViewModel>() {
override val binding by viewBinding(ActivityChapterListBinding::inflate)
override val viewModel: TocViewModel by viewModels()
override val viewModel by viewModels<TocViewModel>()
private lateinit var tabLayout: TabLayout
private var searchView: SearchView? = null

@ -13,7 +13,7 @@ import io.legado.app.utils.viewbindingdelegate.viewBinding
class ConfigActivity : VMBaseActivity<ActivityConfigBinding, ConfigViewModel>() {
override val binding by viewBinding(ActivityConfigBinding::inflate)
override val viewModel: ConfigViewModel by viewModels()
override val viewModel by viewModels<ConfigViewModel>()
override fun onActivityCreated(savedInstanceState: Bundle?) {
intent.getIntExtra("configType", -1).let {

@ -44,7 +44,7 @@ class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
BottomNavigationView.OnNavigationItemReselectedListener {
override val binding by viewBinding(ActivityMainBinding::inflate)
override val viewModel: MainViewModel by viewModels()
override val viewModel by viewModels<MainViewModel>()
private var exitTime: Long = 0
private var bookshelfReselected: Long = 0
private var exploreReselected: Long = 0

@ -25,8 +25,8 @@ import io.legado.app.utils.*
abstract class BaseBookshelfFragment(layoutId: Int) : VMBaseFragment<BookshelfViewModel>(layoutId) {
val activityViewModel: MainViewModel by activityViewModels()
override val viewModel: BookshelfViewModel by viewModels()
val activityViewModel by activityViewModels<MainViewModel>()
override val viewModel by viewModels<BookshelfViewModel>()
private val importBookshelf = registerForActivityResult(FilePicker()) {
it?.readText(requireContext())?.let { text ->

@ -33,7 +33,7 @@ import io.legado.app.utils.viewbindingdelegate.viewBinding
*/
class ExploreFragment : VMBaseFragment<ExploreViewModel>(R.layout.fragment_explore),
ExploreAdapter.CallBack {
override val viewModel: ExploreViewModel by viewModels()
override val viewModel by viewModels<ExploreViewModel>()
private val binding by viewBinding(FragmentExploreBinding::bind)
private lateinit var adapter: ExploreAdapter
private lateinit var linearLayoutManager: LinearLayoutManager

@ -37,10 +37,9 @@ import io.legado.app.utils.viewbindingdelegate.viewBinding
class RssFragment : VMBaseFragment<RssSourceViewModel>(R.layout.fragment_rss),
RssAdapter.CallBack {
private val binding by viewBinding(FragmentRssBinding::bind)
override val viewModel by viewModels<RssSourceViewModel>()
private lateinit var adapter: RssAdapter
private lateinit var searchView: SearchView
override val viewModel: RssSourceViewModel
by viewModels()
private var liveRssData: LiveData<List<RssSource>>? = null
private val groups = linkedSetOf<String>()
private var liveGroup: LiveData<List<String>>? = null

@ -50,7 +50,7 @@ class ReplaceRuleActivity : VMBaseActivity<ActivityReplaceRuleBinding, ReplaceRu
SelectActionBar.CallBack,
ReplaceRuleAdapter.CallBack {
override val binding by viewBinding(ActivityReplaceRuleBinding::inflate)
override val viewModel: ReplaceRuleViewModel by viewModels()
override val viewModel by viewModels<ReplaceRuleViewModel>()
private val importRecordKey = "replaceRuleRecordKey"
private lateinit var adapter: ReplaceRuleAdapter
private lateinit var searchView: SearchView

@ -52,8 +52,7 @@ class ReplaceEditActivity :
}
override val binding by viewBinding(ActivityReplaceEditBinding::inflate)
override val viewModel: ReplaceEditViewModel
by viewModels()
override val viewModel by viewModels<ReplaceEditViewModel>()
private var mSoftKeyboardTool: PopupWindow? = null
private var mIsSoftKeyBoardShowing = false

@ -38,10 +38,8 @@ class RssArticlesFragment : VMBaseFragment<RssArticlesViewModel>(R.layout.fragme
}
private val binding by viewBinding(FragmentRssArticlesBinding::bind)
private val activityViewModel: RssSortViewModel
by activityViewModels()
override val viewModel: RssArticlesViewModel
by viewModels()
private val activityViewModel by activityViewModels<RssSortViewModel>()
override val viewModel by viewModels<RssArticlesViewModel>()
lateinit var adapter: BaseRssArticlesAdapter<*>
private lateinit var loadMoreView: LoadMoreView
private var rssArticlesData: LiveData<List<RssArticle>>? = null

@ -21,8 +21,7 @@ import io.legado.app.utils.visible
class RssSortActivity : VMBaseActivity<ActivityRssArtivlesBinding, RssSortViewModel>() {
override val binding by viewBinding(ActivityRssArtivlesBinding::inflate)
override val viewModel: RssSortViewModel
by viewModels()
override val viewModel by viewModels<RssSortViewModel>()
private lateinit var adapter: TabFragmentPageAdapter
private val fragments = linkedMapOf<String, Fragment>()
private val upSourceResult = registerForActivityResult(

@ -37,7 +37,7 @@ class ReadRssActivity : VMBaseActivity<ActivityRssReadBinding, ReadRssViewModel>
ReadRssViewModel.CallBack {
override val binding by viewBinding(ActivityRssReadBinding::inflate)
override val viewModel: ReadRssViewModel by viewModels()
override val viewModel by viewModels<ReadRssViewModel>()
private val imagePathKey = ""
private var starMenuItem: MenuItem? = null
private var ttsMenuItem: MenuItem? = null

@ -21,7 +21,7 @@ import kotlinx.coroutines.launch
class RssSourceDebugActivity : VMBaseActivity<ActivitySourceDebugBinding, RssSourceDebugModel>() {
override val binding by viewBinding(ActivitySourceDebugBinding::inflate)
override val viewModel: RssSourceDebugModel by viewModels()
override val viewModel by viewModels<RssSourceDebugModel>()
private lateinit var adapter: RssSourceDebugAdapter

@ -34,6 +34,7 @@ class RssSourceEditActivity :
KeyboardToolPop.CallBack {
override val binding by viewBinding(ActivityRssSourceEditBinding::inflate)
override val viewModel by viewModels<RssSourceEditViewModel>()
private var mSoftKeyboardTool: PopupWindow? = null
private var mIsSoftKeyBoardShowing = false
private val adapter = RssSourceEditAdapter()
@ -46,9 +47,6 @@ class RssSourceEditActivity :
}
}
override val viewModel: RssSourceEditViewModel
by viewModels()
override fun onActivityCreated(savedInstanceState: Bundle?) {
initView()
viewModel.initData(intent) {

@ -46,8 +46,7 @@ class RssSourceActivity : VMBaseActivity<ActivityRssSourceBinding, RssSourceView
RssSourceAdapter.CallBack {
override val binding by viewBinding(ActivityRssSourceBinding::inflate)
override val viewModel: RssSourceViewModel
by viewModels()
override val viewModel by viewModels<RssSourceViewModel>()
private val importRecordKey = "rssSourceRecordKey"
private lateinit var adapter: RssSourceAdapter
private var sourceLiveData: LiveData<List<RssSource>>? = null

Loading…
Cancel
Save