Skip to content

Commit 5c56ad9

Browse files
committed
deploy
1 parent b62dc40 commit 5c56ad9

File tree

3 files changed

+38
-25
lines changed

3 files changed

+38
-25
lines changed

.github/workflows/publish.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ jobs:
4040
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
4141
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
4242
GROUP: io.github.mejdi14
43-
POM_ARTIFACT_ID: KMP-Searchable-Dropdown
44-
POM_NAME: KMP-Searchable-Dropdown
43+
POM_ARTIFACT_ID: KMP-Image-Censorship
44+
POM_NAME: KMP-Image-Censorship
4545
POM_DESCRIPTION: "This library provides ...."
46-
POM_URL: https://github.com/mejdi14/KMP-Searchable-Dropdown
46+
POM_URL: https://github.com/mejdi14/KMP-Image-Censorship
4747
POM_LICENSE_NAME: "The Apache Software License, Version 2.0"
4848
POM_LICENSE_URL: https://www.apache.org/licenses/LICENSE-2.0.txt
4949
POM_LICENSE_DIST: repo
50-
POM_SCM_URL: https://github.com/mejdi14/KMP-Searchable-Dropdown
51-
POM_SCM_CONNECTION: scm:git:git://github.com/mejdi14/KMP-Searchable-Dropdown.git
52-
POM_SCM_DEV_CONNECTION: scm:git:ssh://git@github.com/mejdi14/KMP-Searchable-Dropdown.git
50+
POM_SCM_URL: https://github.com/mejdi14/KMP-Image-Censorship
51+
POM_SCM_CONNECTION: scm:git:git://github.com/mejdi14/KMP-Image-Censorship.git
52+
POM_SCM_DEV_CONNECTION: scm:git:ssh://git@github.com/mejdi14/KMP-Image-Censorship.git
5353
POM_DEVELOPER_ID: mejdi14
5454
POM_DEVELOPER_NAME: "mejdi hafiene"
5555
POM_DEVELOPER_URL: https://github.com/mejdi14/

gradle.properties

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,8 @@ org.gradle.jvmargs=-Xmx8048M -Dfile.encoding=UTF-8
77

88
#Android
99
android.nonTransitiveRClass=true
10-
android.useAndroidX=true
10+
android.useAndroidX=true
11+
mavenCentralUsername=AfqG1IXv
12+
mavenCentralPassword=1p7xdMppb3mV1wI5FAz5ZiUVXBxnG+n4dpVR4LxyGhnR
13+
14+
signing.keyId=84DC98B3

imageCensorship/src/commonMain/kotlin/org/example/project/CensorshipComposable.kt

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import androidx.compose.runtime.Composable
1010
import androidx.compose.runtime.LaunchedEffect
1111
import androidx.compose.runtime.getValue
1212
import androidx.compose.runtime.mutableStateOf
13+
import androidx.compose.runtime.produceState
1314
import androidx.compose.runtime.remember
1415
import androidx.compose.runtime.setValue
1516
import androidx.compose.ui.Alignment
@@ -19,12 +20,12 @@ import androidx.compose.ui.graphics.painter.Painter
1920
import androidx.compose.ui.platform.LocalDensity
2021
import androidx.compose.ui.platform.LocalLayoutDirection
2122
import androidx.compose.ui.unit.dp
23+
import kotlinx.coroutines.Dispatchers
24+
import kotlinx.coroutines.withContext
2225
import org.example.project.helpers.computePixelatedImage
2326
import org.example.project.helpers.toImageBitmap
2427

25-
/**
26-
* Composable for displaying an image with pixelated effect.
27-
*/
28+
2829
@Composable
2930
fun CensorshipComposable(
3031
painter: Painter,
@@ -40,33 +41,41 @@ fun CensorshipComposable(
4041
painter.toImageBitmap(size, density, layoutDirection)
4142
}
4243

43-
var isPixelated by remember { mutableStateOf(false) }
44-
var pixelatedImage by remember { mutableStateOf<ImageBitmap?>(null) }
45-
46-
LaunchedEffect(isPixelated) {
47-
if (isPixelated && pixelatedImage == null) {
48-
pixelatedImage = computePixelatedImage(imageBitmap, pixelsSize)
44+
val pixelatedImage by produceState<ImageBitmap?>(initialValue = null, imageBitmap) {
45+
value = withContext(Dispatchers.Default) {
46+
computePixelatedImage(imageBitmap, pixelsSize)
4947
}
5048
}
5149

52-
Box(modifier = modifier.size(200.dp).clickable(
53-
interactionSource = remember { MutableInteractionSource() },
54-
indication = null
55-
) { isPixelated = !isPixelated }) {
50+
var isPixelated by remember { mutableStateOf(false) }
51+
52+
Box(
53+
modifier = modifier
54+
.size(200.dp)
55+
.clickable(
56+
interactionSource = remember { MutableInteractionSource() },
57+
indication = null
58+
) {
59+
isPixelated = !isPixelated
60+
}
61+
) {
5662
if (isPixelated) {
57-
pixelatedImage?.let {
63+
if (pixelatedImage != null) {
5864
Image(
59-
bitmap = it,
65+
bitmap = pixelatedImage!!,
6066
contentDescription = "Pixelated image",
61-
modifier.align(Alignment.Center)
67+
modifier = Modifier.align(Alignment.Center)
6268
)
63-
} ?: CircularProgressIndicator()
69+
} else {
70+
CircularProgressIndicator(Modifier.align(Alignment.Center))
71+
}
6472
} else {
6573
Image(
6674
bitmap = imageBitmap,
6775
contentDescription = "Original image",
68-
modifier.align(Alignment.Center)
76+
modifier = Modifier.align(Alignment.Center)
6977
)
7078
}
7179
}
7280
}
81+

0 commit comments

Comments
 (0)