Skip to content

Commit

Permalink
replace sketch-zoom with zoomimage
Browse files Browse the repository at this point in the history
  • Loading branch information
5ec1cff committed Jan 11, 2024
1 parent b47bd82 commit 6a28a59
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import androidx.recyclerview.widget.RecyclerView
import androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback
import com.github.panpf.sketch.displayImage
import com.github.panpf.sketch.viewability.showSectorProgressIndicator
import com.github.panpf.sketch.zoom.SketchZoomImageView
import com.github.panpf.zoomimage.SketchZoomImageView
import com.google.android.material.snackbar.Snackbar
import io.github.a13e300.ro_tieba.BaseFragment
import io.github.a13e300.ro_tieba.R
Expand Down Expand Up @@ -222,12 +222,12 @@ class PhotoFragment : BaseFragment() {

override fun onBindViewHolder(holder: PhotoViewHolder, position: Int) {
holder.imageView.apply {
displayImage(items[position].url)
val ta =
requireContext().obtainStyledAttributes(intArrayOf(androidx.appcompat.R.attr.colorPrimary))
val color = ta.getColor(0, Color.WHITE)
ta.recycle()
showSectorProgressIndicator(color = color)
displayImage(items[position].url)
ViewCompat.setTransitionName(this, "${TRANSITION_NAME_PREFIX}_$position")
}
}
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/java/io/github/a13e300/ro_tieba/utils/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import com.github.panpf.sketch.request.DisplayRequest
import com.github.panpf.sketch.request.pauseLoadWhenScrolling
import com.github.panpf.sketch.stateimage.ColorStateImage
import com.github.panpf.sketch.stateimage.IconStateImage
import com.github.panpf.sketch.stateimage.IntColor
import io.github.a13e300.ro_tieba.App
import io.github.a13e300.ro_tieba.BuildConfig
import io.github.a13e300.ro_tieba.EXTRA_DONT_USE_NAV
Expand Down Expand Up @@ -411,7 +410,7 @@ fun DisplayRequest.Builder.configureDefaults(context: Context) {
val color = ta.getColor(0, 0x1a1c1e)
ta.recycle()
placeholder(ColorStateImage(color))
error(IconStateImage(R.drawable.ic_error, IntColor(color)))
error(IconStateImage(R.drawable.ic_error) { colorBackground(color) })
}

inline fun <T> List<T>.firstOrNullFrom(from: Int = 0, predicate: (T) -> Boolean): T? {
Expand Down
3 changes: 2 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ legacy-support-v4 = "1.0.0"
recyclerview = "1.3.2"
room-runtime = "2.6.1"
sketch = "3.3.0"
zoom-image = "1.0.1"

[libraries]
androidx-datastore = { module = "androidx.datastore:datastore", version.ref = "datastore" }
Expand Down Expand Up @@ -67,7 +68,7 @@ espresso-core = { group = "androidx.test.espresso", name = "espresso-core", vers

sketch-main = { module = "io.github.panpf.sketch3:sketch", version.ref = "sketch" }
sketch-okhttp = { module = "io.github.panpf.sketch3:sketch-okhttp", version.ref = "sketch" }
sketch-zoom = { module = "io.github.panpf.sketch3:sketch-zoom", version.ref = "sketch" }
sketch-zoom = { module = "io.github.panpf.zoomimage:zoomimage-view-sketch", version.ref = "zoom-image" }
sketch-movie = { module = "io.github.panpf.sketch3:sketch-gif-movie", version.ref = "sketch" }
sketch-extension = { module = "io.github.panpf.sketch3:sketch-extensions", version.ref = "sketch" }

Expand Down

0 comments on commit 6a28a59

Please sign in to comment.