Skip to content

Instantly share code, notes, and snippets.

View matinnasiri01's full-sized avatar
🏠
Working at 127.0.0.1

Matin Nasiri matinnasiri01

🏠
Working at 127.0.0.1
View GitHub Profile
@matinnasiri01
matinnasiri01 / CustomCarousel.kt
Created June 4, 2024 18:37
This code creates a horizontal slider in Jetpack Compose that automatically and cyclically scrolls, adjusting item transparency based on their position.
/*
Matin Nasiri
mnasirii829@gmail.com
https:linkedin.com/in/matinnasiri01
I hope you are well when you read this file
*/
@matinnasiri01
matinnasiri01 / parcelize-fun.kt
Created January 9, 2024 10:35
android Parcelize
inline fun <reified T : Serializable> Intent.getSerializable(key: String): T = when {
SDK_INT >= 33 -> getSerializableExtra(key, T::class.java)!!
else -> getSerializableExtra(key) as T
}
inline fun <reified T : Parcelable> Intent.getParcelable(key: String): T = when {
SDK_INT >= 33 -> getParcelableExtra(key, T::class.java)!!
else -> getParcelableExtra(key)!!
}
@matinnasiri01
matinnasiri01 / ShimmerEffectCompose.kt
Last active September 22, 2023 10:50
Add shimmer effect to your view without adding additional libraries.
/**
* Shimmer Effect Use Custom Code In Compose.
* @param[customColorList] You can set Your custom color for effect
*/
fun Modifier.shimmerEffect(customColorList: List<Color>? = null): Modifier = composed {
var size by remember {
mutableStateOf(IntSize.Zero)
}
val transition = rememberInfiniteTransition(label = "")
@matinnasiri01
matinnasiri01 / NetworkChecker.kt
Last active September 19, 2023 11:05
This Kotlin file helps you to find out about your user's connection to the Internet very easily
class NetworkChecker(private val context: Context) {
val isInternetConnected :Boolean
get() {
var result = false
val connectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {