-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
83a4b23
commit 9b31517
Showing
59 changed files
with
3,701 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
app/common/src/androidMain/kotlin/sh/christian/ozone/api/androidDispatching.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package sh.christian.ozone.api | ||
|
||
import io.ktor.client.engine.HttpClientEngineFactory | ||
import io.ktor.client.engine.cio.CIO | ||
import kotlinx.coroutines.CoroutineDispatcher | ||
import kotlinx.coroutines.Dispatchers | ||
|
||
actual val engine: HttpClientEngineFactory<*> get() = CIO | ||
|
||
actual object OzoneDispatchers { | ||
actual val IO: CoroutineDispatcher get() = Dispatchers.IO | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
app/common/src/androidMain/kotlin/sh/christian/ozone/ui/compose/androidZoomableImage.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package sh.christian.ozone.ui.compose | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.LaunchedEffect | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.ColorFilter | ||
import androidx.compose.ui.graphics.painter.Painter | ||
import androidx.compose.ui.layout.ContentScale | ||
import me.saket.telephoto.zoomable.ZoomableContentLocation | ||
import me.saket.telephoto.zoomable.rememberZoomableState | ||
import me.saket.telephoto.zoomable.zoomable | ||
|
||
@Composable | ||
actual fun ZoomableImage( | ||
painter: Painter, | ||
contentDescription: String?, | ||
modifier: Modifier, | ||
alignment: Alignment, | ||
contentScale: ContentScale, | ||
alpha: Float, | ||
colorFilter: ColorFilter?, | ||
): ZoomableImageHandle { | ||
val zoomableState = rememberZoomableState() | ||
|
||
Image( | ||
modifier = modifier.zoomable(zoomableState), | ||
painter = painter, | ||
contentDescription = contentDescription, | ||
alignment = alignment, | ||
contentScale = contentScale, | ||
alpha = alpha, | ||
colorFilter = colorFilter, | ||
) | ||
|
||
LaunchedEffect(painter) { | ||
zoomableState.setContentLocation( | ||
ZoomableContentLocation.scaledInsideAndCenterAligned(painter.intrinsicSize) | ||
) | ||
} | ||
|
||
return remember(zoomableState) { | ||
ZoomableImageHandle(resetZoom = { | ||
zoomableState.resetZoom(withAnimation = false) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
app/common/src/commonMain/kotlin/sh/christian/ozone/api/dispatching.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package sh.christian.ozone.api | ||
|
||
import io.ktor.client.engine.HttpClientEngineFactory | ||
import kotlinx.coroutines.CoroutineDispatcher | ||
|
||
expect val engine: HttpClientEngineFactory<*> | ||
|
||
expect object OzoneDispatchers { | ||
val IO: CoroutineDispatcher | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.