pull/909/head
gedoor 4 years ago
parent 8d1199925f
commit 9210096d6b
  1. 12
      app/src/main/java/io/legado/app/ui/book/info/edit/BookInfoEditActivity.kt

@ -21,6 +21,10 @@ class BookInfoEditActivity :
VMBaseActivity<ActivityBookInfoEditBinding, BookInfoEditViewModel>(),
ChangeCoverDialog.CallBack {
private val selectCover = registerForActivityResult(ActivityResultContracts.GetContent()) {
coverChangeTo(it)
}
override val viewModel: BookInfoEditViewModel
by viewModels()
@ -57,7 +61,7 @@ class BookInfoEditActivity :
}
}
tvSelectCover.setOnClickListener {
selectImage()
selectCover.launch("image/*")
}
tvRefreshCover.setOnClickListener {
viewModel.book?.customCoverUrl = tieCoverUrl.text?.toString()
@ -93,12 +97,6 @@ class BookInfoEditActivity :
}
}
private fun selectImage() {
registerForActivityResult(ActivityResultContracts.GetContent()) {
coverChangeTo(it)
}.launch("image/*")
}
override fun coverChangeTo(coverUrl: String) {
viewModel.book?.customCoverUrl = coverUrl
binding.tieCoverUrl.setText(coverUrl)

Loading…
Cancel
Save