Skip to content

Commit 0d994d9

Browse files
committed
Replace zoomable with telephoto
1 parent 212a967 commit 0d994d9

File tree

5 files changed

+44
-19
lines changed

5 files changed

+44
-19
lines changed

app/dependencies/dogReleaseRuntimeClasspath.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ com.nex3z:toggle-button-group:1.2.3
211211
com.squareup.moshi:moshi:1.15.2
212212
com.squareup.okio:okio-jvm:3.17.0
213213
com.squareup.okio:okio:3.17.0
214-
dev.drewhamilton.poko:poko-annotations-jvm:0.15.2
215-
dev.drewhamilton.poko:poko-annotations:0.15.2
214+
dev.drewhamilton.poko:poko-annotations-jvm:0.18.7
215+
dev.drewhamilton.poko:poko-annotations:0.18.7
216216
io.coil-kt.coil3:coil-android:3.4.0
217217
io.coil-kt.coil3:coil-compose-android:3.4.0
218218
io.coil-kt.coil3:coil-compose-core-android:3.4.0
@@ -224,8 +224,11 @@ io.coil-kt.coil3:coil-gif:3.4.0
224224
io.coil-kt.coil3:coil:3.4.0
225225
jakarta.inject:jakarta.inject-api:2.0.1
226226
javax.inject:javax.inject:1
227+
me.saket.telephoto:annotations-android:0.18.0
228+
me.saket.telephoto:annotations:0.18.0
229+
me.saket.telephoto:zoomable-android:0.18.0
230+
me.saket.telephoto:zoomable:0.18.0
227231
me.zhanghai.android.materialprogressbar:library:1.4.2
228-
net.engawapg.lib:zoomable:1.6.1
229232
nl.dionsegijn:konfetti:1.3.2
230233
org.jetbrains.androidx.lifecycle:lifecycle-common:2.9.6
231234
org.jetbrains.androidx.lifecycle:lifecycle-runtime-compose:2.9.6

app/dependencies/googleReleaseRuntimeClasspath.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,8 @@ com.nex3z:toggle-button-group:1.2.3
271271
com.squareup.moshi:moshi:1.15.2
272272
com.squareup.okio:okio-jvm:3.17.0
273273
com.squareup.okio:okio:3.17.0
274-
dev.drewhamilton.poko:poko-annotations-jvm:0.15.2
275-
dev.drewhamilton.poko:poko-annotations:0.15.2
274+
dev.drewhamilton.poko:poko-annotations-jvm:0.18.7
275+
dev.drewhamilton.poko:poko-annotations:0.18.7
276276
io.coil-kt.coil3:coil-android:3.4.0
277277
io.coil-kt.coil3:coil-compose-android:3.4.0
278278
io.coil-kt.coil3:coil-compose-core-android:3.4.0
@@ -284,8 +284,11 @@ io.coil-kt.coil3:coil-gif:3.4.0
284284
io.coil-kt.coil3:coil:3.4.0
285285
jakarta.inject:jakarta.inject-api:2.0.1
286286
javax.inject:javax.inject:1
287+
me.saket.telephoto:annotations-android:0.18.0
288+
me.saket.telephoto:annotations:0.18.0
289+
me.saket.telephoto:zoomable-android:0.18.0
290+
me.saket.telephoto:zoomable:0.18.0
287291
me.zhanghai.android.materialprogressbar:library:1.4.2
288-
net.engawapg.lib:zoomable:1.6.1
289292
net.lingala.zip4j:zip4j:2.11.6
290293
nl.dionsegijn:konfetti:1.3.2
291294
org.jetbrains.androidx.lifecycle:lifecycle-common:2.9.6

app/dependencies/otherReleaseRuntimeClasspath.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ com.nex3z:toggle-button-group:1.2.3
211211
com.squareup.moshi:moshi:1.15.2
212212
com.squareup.okio:okio-jvm:3.17.0
213213
com.squareup.okio:okio:3.17.0
214-
dev.drewhamilton.poko:poko-annotations-jvm:0.15.2
215-
dev.drewhamilton.poko:poko-annotations:0.15.2
214+
dev.drewhamilton.poko:poko-annotations-jvm:0.18.7
215+
dev.drewhamilton.poko:poko-annotations:0.18.7
216216
io.coil-kt.coil3:coil-android:3.4.0
217217
io.coil-kt.coil3:coil-compose-android:3.4.0
218218
io.coil-kt.coil3:coil-compose-core-android:3.4.0
@@ -224,8 +224,11 @@ io.coil-kt.coil3:coil-gif:3.4.0
224224
io.coil-kt.coil3:coil:3.4.0
225225
jakarta.inject:jakarta.inject-api:2.0.1
226226
javax.inject:javax.inject:1
227+
me.saket.telephoto:annotations-android:0.18.0
228+
me.saket.telephoto:annotations:0.18.0
229+
me.saket.telephoto:zoomable-android:0.18.0
230+
me.saket.telephoto:zoomable:0.18.0
227231
me.zhanghai.android.materialprogressbar:library:1.4.2
228-
net.engawapg.lib:zoomable:1.6.1
229232
nl.dionsegijn:konfetti:1.3.2
230233
org.jetbrains.androidx.lifecycle:lifecycle-common:2.9.6
231234
org.jetbrains.androidx.lifecycle:lifecycle-runtime-compose:2.9.6

component-key/src/main/java/xyz/aprildown/timer/component/key/ImagePreviewActivity.kt

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import androidx.activity.SystemBarStyle
88
import androidx.activity.compose.setContent
99
import androidx.activity.enableEdgeToEdge
1010
import androidx.compose.foundation.background
11-
import androidx.compose.foundation.gestures.detectTapGestures
1211
import androidx.compose.foundation.layout.fillMaxSize
1312
import androidx.compose.foundation.layout.padding
1413
import androidx.compose.runtime.Composable
@@ -18,14 +17,17 @@ import androidx.compose.runtime.mutableStateOf
1817
import androidx.compose.runtime.saveable.rememberSaveable
1918
import androidx.compose.runtime.setValue
2019
import androidx.compose.ui.Modifier
21-
import androidx.compose.ui.input.pointer.pointerInput
20+
import androidx.compose.ui.geometry.Size
2221
import androidx.compose.ui.platform.LocalContext
22+
import androidx.compose.ui.platform.LocalDensity
2323
import androidx.compose.ui.unit.dp
2424
import coil3.compose.AsyncImage
2525
import coil3.request.ImageRequest
2626
import coil3.request.crossfade
27-
import net.engawapg.lib.zoomable.rememberZoomState
28-
import net.engawapg.lib.zoomable.zoomable
27+
import me.saket.telephoto.zoomable.ZoomSpec
28+
import me.saket.telephoto.zoomable.ZoomableContentLocation
29+
import me.saket.telephoto.zoomable.rememberZoomableState
30+
import me.saket.telephoto.zoomable.zoomable
2931
import android.graphics.Color as AndroidColor
3032
import androidx.compose.ui.graphics.Color.Companion as ComposeColor
3133

@@ -79,19 +81,33 @@ private fun ImagePreview(
7981
onDismiss: () -> Unit,
8082
modifier: Modifier = Modifier,
8183
) {
84+
val zoomableState = rememberZoomableState(
85+
zoomSpec = ZoomSpec(maxZoomFactor = 5f),
86+
)
87+
val density = LocalDensity.current
88+
val padding = 16.dp
8289
AsyncImage(
8390
model = ImageRequest.Builder(LocalContext.current)
8491
.data(data)
8592
.crossfade(true)
93+
.listener { _, result ->
94+
val image = result.image
95+
val paddingPx = density.run { padding.toPx() } * 2f
96+
zoomableState.setContentLocation(
97+
ZoomableContentLocation.scaledInsideAndCenterAligned(
98+
Size(
99+
width = image.width.toFloat() + paddingPx,
100+
height = image.height.toFloat() + paddingPx
101+
)
102+
)
103+
)
104+
}
86105
.build(),
87106
contentDescription = null,
88107
modifier = modifier
89108
.fillMaxSize()
90109
.background(ComposeColor.Black.copy(alpha = 0.5f))
91-
.pointerInput(onDismiss) {
92-
detectTapGestures(onTap = { onDismiss() })
93-
}
94-
.padding(16.dp)
95-
.zoomable(zoomState = rememberZoomState()),
110+
.zoomable(state = zoomableState, onClick = { onDismiss() })
111+
.padding(padding),
96112
)
97113
}

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ taskerPlugin = "com.joaomgcd:taskerpluginlibrary:0.4.10"
161161
diskLruCache = "com.github.bumptech.glide:disklrucache:5.0.5"
162162
coil = "io.coil-kt.coil3:coil-compose:3.4.0"
163163
coil-gif = "io.coil-kt.coil3:coil-gif:3.4.0"
164-
zoomable = "net.engawapg.lib:zoomable:1.6.1"
164+
zoomable = "me.saket.telephoto:zoomable:0.18.0"
165165
twoWayNestedScrollView = "com.github.ultimate-deej:twowaynestedscrollview:0.1.2"
166166
accurateCountDownTimer = "com.github.cardinalby:accurate-count-down-timer:1.0"
167167

0 commit comments

Comments
 (0)