pull/1226/head
gedoor 3 years ago
parent 9f4fc59f79
commit 7041d85a24
  1. 12
      app/src/main/java/io/legado/app/ui/book/info/edit/BookInfoEditActivity.kt

@ -5,7 +5,6 @@ import android.net.Uri
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import androidx.activity.result.contract.ActivityResultContracts
import androidx.activity.viewModels
import androidx.documentfile.provider.DocumentFile
import io.legado.app.R
@ -23,12 +22,11 @@ class BookInfoEditActivity :
VMBaseActivity<ActivityBookInfoEditBinding, BookInfoEditViewModel>(),
ChangeCoverDialog.CallBack {
private val selectCoverResult =
registerForActivityResult(ActivityResultContracts.GetContent()) {
it?.let { uri ->
coverChangeTo(uri)
}
private val selectCover = registerForActivityResult(ActivityResultContractUtils.SelectImage()) {
it?.second?.let { uri ->
coverChangeTo(uri)
}
}
override val binding by viewBinding(ActivityBookInfoEditBinding::inflate)
override val viewModel by viewModels<BookInfoEditViewModel>()
@ -62,7 +60,7 @@ class BookInfoEditActivity :
}
}
tvSelectCover.setOnClickListener {
selectCoverResult.launch("image/*")
selectCover.launch(null)
}
tvRefreshCover.setOnClickListener {
viewModel.book?.customCoverUrl = tieCoverUrl.text?.toString()

Loading…
Cancel
Save