diff --git a/app/build.gradle b/app/build.gradle index 9874b4bc..9f0e3bd5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -161,6 +161,7 @@ dependencies { def zoomimage_version = "1.0.0-alpha03" implementation "io.github.panpf.zoomimage:zoomimage-compose-sketch:$zoomimage_version" + implementation("io.github.panpf.zoomimage:zoomimage-view-sketch:$zoomimage_version") def composeBom = platform("androidx.compose:compose-bom:$compose_bom_version") implementation composeBom diff --git a/app/src/main/java/com/huanchengfly/tieba/post/fragments/PhotoViewFragment.kt b/app/src/main/java/com/huanchengfly/tieba/post/fragments/PhotoViewFragment.kt index 1fcd9e03..835df4bd 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/fragments/PhotoViewFragment.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/fragments/PhotoViewFragment.kt @@ -4,10 +4,11 @@ import android.annotation.SuppressLint import android.content.DialogInterface import android.os.Bundle import android.view.View +import androidx.core.os.BundleCompat import butterknife.BindView import com.github.panpf.sketch.displayImage import com.github.panpf.sketch.viewability.showRingProgressIndicator -import com.github.panpf.sketch.zoom.SketchZoomImageView +import com.github.panpf.zoomimage.SketchZoomImageView import com.huanchengfly.tieba.post.R import com.huanchengfly.tieba.post.dpToPx import com.huanchengfly.tieba.post.dpToPxFloat @@ -27,7 +28,8 @@ class PhotoViewFragment : BaseFragment() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) if (arguments != null) { - photoViewBean = arguments!!.getParcelable(ARG_INFO)!! + photoViewBean = + BundleCompat.getParcelable(requireArguments(), ARG_INFO, PhotoViewBean::class.java) } } @@ -77,13 +79,13 @@ class PhotoViewFragment : BaseFragment() { } bigImageView!!.setOnClickListener { if (activity != null) { - activity!!.finish() + requireActivity().finish() } } } private fun canLoad(): Boolean { - return activity != null && !activity!!.isDestroyed && !activity!!.isFinishing + return activity != null && !requireActivity().isDestroyed && !requireActivity().isFinishing } private fun openDialog(photoViewBean: PhotoViewBean?) {