Skip to content

Commit

Permalink
Merge branch 'hotfix/blurNetworkImage' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
jeluchu committed Jul 5, 2023
2 parents c3126df + 07b5ef4 commit b58fdce
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 9 deletions.
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ androidx-navigation = "2.6.0"
com-google-accompanist = "0.30.1"
com-squareup-okhttp3 = "4.11.0"
com-squareup-retrofit2 = "2.9.0"
io-coil-kt = "2.3.0"
io-coil-kt = "2.4.0"
org-jetbrains-kotlin = "1.8.21"
org-jetbrains-kotlinx = "1.7.0"
billing-ktx = "6.0.0"
org-jetbrains-kotlinx = "1.7.2"
billing-ktx = "6.0.1"

[libraries]
androidx-activity-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity" }
Expand All @@ -23,7 +23,7 @@ androidx-compose-foundation = { module = "androidx.compose.foundation:foundation
androidx-compose-foundation-foundation-layout = { module = "androidx.compose.foundation:foundation-layout", version.ref = "androidx-compose-foundation" }
androidx-compose-material = { module = "androidx.compose.material:material", version.ref = "androidx-compose-material" }
androidx-compose-material-material-icons-extended = { module = "androidx.compose.material:material-icons-extended", version.ref = "androidx-compose-material" }
androidx-compose-material3 = "androidx.compose.material3:material3:1.1.0"
androidx-compose-material3 = "androidx.compose.material3:material3:1.1.1"
androidx-compose-runtime = { module = "androidx.compose.runtime:runtime", version.ref = "androidx-compose-runtime" }
androidx-compose-ui = { module = "androidx.compose.ui:ui", version.ref = "androidx-compose-ui" }
androidx-compose-ui-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "androidx-compose-ui" }
Expand All @@ -49,7 +49,7 @@ org-jetbrains-kotlin-kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kot
org-jetbrains-kotlinx-kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "org-jetbrains-kotlinx" }
org-jetbrains-kotlinx-kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "org-jetbrains-kotlinx" }
com-android-billingclient-billing-ktx = { module = "com.android.billingclient:billing-ktx", version.ref = "billing-ktx" }
firebase-crashlytics-buildtools = { group = "com.google.firebase", name = "firebase-crashlytics-buildtools", version = "2.9.5" }
firebase-crashlytics-buildtools = { group = "com.google.firebase", name = "firebase-crashlytics-buildtools", version = "2.9.6" }

[bundles]
core-androidx = [
Expand Down
2 changes: 1 addition & 1 deletion jchucomponents-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ afterEvaluate {
from components.release
groupId = "com.github.jeluchu"
artifactId = "jchucomponents-core"
version = "1.5.2"
version = "1.5.3"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion jchucomponents-ktx/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ afterEvaluate {
from components.release
groupId = "com.github.jeluchu"
artifactId = "jchucomponents-ktx"
version = "1.5.2"
version = "1.5.3"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion jchucomponents-qr/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ afterEvaluate {
from components.release
groupId = "com.github.jeluchu"
artifactId = "jchucomponents-qr"
version = "1.5.2"
version = "1.5.3"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion jchucomponents-ui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ afterEvaluate {
from components.release
groupId = "com.github.jeluchu"
artifactId = "jchucomponents-ui"
version = "1.5.2"
version = "1.5.3"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.jeluchu.jchucomponents.ui.composables.images

import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.DefaultAlpha
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import coil.compose.AsyncImage
import coil.request.ImageRequest
import com.jeluchu.jchucomponents.ui.composables.images.transformations.BlurTransformation

@Composable
fun BlurImage(
url: Any,
modifier: Modifier = Modifier,
isCrossfade: Boolean = true,
isAllowHardware: Boolean = true,
alpha: Float = DefaultAlpha,
blurTransformation: BlurImageTransformation = BlurImageTransformation(),
contentScale: ContentScale = ContentScale.Crop,
contentDescription: String? = null
) = AsyncImage(
modifier = modifier,
model = ImageRequest.Builder(LocalContext.current)
.data(url)
.transformations(
BlurTransformation(
scale = blurTransformation.scale,
radius = blurTransformation.radius
)
)
.crossfade(isCrossfade)
.allowHardware(isAllowHardware)
.build(),
alpha = alpha,
contentScale = contentScale,
contentDescription = null
)

@Immutable
class BlurImageTransformation(
val scale: Float = 0.5f,
val radius: Int = 25
)

0 comments on commit b58fdce

Please sign in to comment.