pull/1846/head^2
kunfei 3 years ago
parent 6abf5002eb
commit 066de03182
  1. 9
      app/src/main/java/io/legado/app/ui/association/VerificationCodeDialog.kt

@ -1,9 +1,9 @@
package io.legado.app.ui.association package io.legado.app.ui.association
import android.annotation.SuppressLint
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.net.Uri
import com.bumptech.glide.request.RequestOptions import com.bumptech.glide.request.RequestOptions
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.BaseDialogFragment import io.legado.app.base.BaseDialogFragment
@ -39,11 +39,12 @@ class VerificationCodeDialog() : BaseDialogFragment(R.layout.dialog_verification
setLayout(1f, ViewGroup.LayoutParams.WRAP_CONTENT) setLayout(1f, ViewGroup.LayoutParams.WRAP_CONTENT)
} }
@SuppressLint("CheckResult")
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
binding.run { binding.run {
toolBar.setBackgroundColor(primaryColor) toolBar.setBackgroundColor(primaryColor)
val sourceOrigin = arguments?.getString("sourceOrigin") val sourceOrigin = arguments?.getString("sourceOrigin")
val key = "${sourceOrigin ?: ""}_verificationResult" val key = "${sourceOrigin}_verificationResult"
arguments?.getString("imageUrl")?.let { imageUrl -> arguments?.getString("imageUrl")?.let { imageUrl ->
ImageLoader.load(requireContext(), imageUrl).apply { ImageLoader.load(requireContext(), imageUrl).apply {
sourceOrigin?.let { sourceOrigin?.let {
@ -62,7 +63,7 @@ class VerificationCodeDialog() : BaseDialogFragment(R.layout.dialog_verification
} }
tvOk.setOnClickListener { tvOk.setOnClickListener {
val verificationCode = binding.verificationCode.text.toString() val verificationCode = binding.verificationCode.text.toString()
verificationCode?.let { verificationCode.let {
CacheManager.put(key, it) CacheManager.put(key, it)
dismiss() dismiss()
} }
@ -75,7 +76,7 @@ class VerificationCodeDialog() : BaseDialogFragment(R.layout.dialog_verification
override fun onDestroy() { override fun onDestroy() {
val sourceOrigin = arguments?.getString("sourceOrigin") val sourceOrigin = arguments?.getString("sourceOrigin")
val key = "${sourceOrigin ?: ""}_verificationResult" val key = "${sourceOrigin}_verificationResult"
CacheManager.get(key) ?: CacheManager.put(key, "") CacheManager.get(key) ?: CacheManager.put(key, "")
super.onDestroy() super.onDestroy()
activity?.finish() activity?.finish()

Loading…
Cancel
Save