Skip to content

Instantly share code, notes, and snippets.

View stevdza-san's full-sized avatar
💭
Kotlin Multiplatform Developer/Content Creator

Stefan Jovanovic stevdza-san

💭
Kotlin Multiplatform Developer/Content Creator
View GitHub Profile
@stevdza-san
stevdza-san / LoadingAnimation.kt
Last active February 22, 2026 11:45
Loading Animation with Jetpack Compose
import androidx.compose.animation.core.*
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
@stevdza-san
stevdza-san / DeviceType.kt
Created September 21, 2025 05:54
Adaptive layout in Compose Multiplatform.
import androidx.compose.material3.adaptive.HingeInfo
import androidx.compose.material3.adaptive.WindowAdaptiveInfo
import androidx.window.core.layout.WindowSizeClass
sealed class DeviceType : Comparable<DeviceType> {
abstract val minWidth: Int
abstract val minHeight: Int
abstract val rank: Int
override fun compareTo(other: DeviceType): Int = this.rank - other.rank
@stevdza-san
stevdza-san / PasswordTextField.kt
Last active November 19, 2025 01:52
Password Input Field - Jetpack Compose
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.Icon
import androidx.compose.material.IconButton
import androidx.compose.material.OutlinedTextField
import androidx.compose.material.Text
import androidx.compose.runtime.*
@stevdza-san
stevdza-san / Localization.kt
Last active November 15, 2025 13:56
Kobweb Localization
object Localization {
private const val LANGUAGE_KEY = "language"
var currentLanguage by mutableStateOf(
value = Language.valueOf(
value = window.localStorage[LANGUAGE_KEY] ?: Language.Serbian.name
)
)
fun updateLanguage(value: Language, company: Company? = null) {
@stevdza-san
stevdza-san / HyperlinkText.kt
Last active October 25, 2025 12:56
Embedd a Hyperlink within a Text using Jetpack Compose.
import androidx.compose.foundation.text.ClickableText
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextDecoration
import androidx.compose.ui.unit.TextUnit
@stevdza-san
stevdza-san / ChannelScreen.kt
Created October 15, 2025 15:39
Homework - REFACTORED
import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.scaleIn
import androidx.compose.animation.scaleOut
import androidx.compose.animation.slideInVertically
import androidx.compose.animation.slideOutVertically
import androidx.compose.animation.togetherWith
@stevdza-san
stevdza-san / ConsumedVsReceived.kt
Created October 15, 2025 15:27
Kotlin Flows - Day 2
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
@stevdza-san
stevdza-san / CancellationExample.kt
Created October 14, 2025 16:02
Kotlin Flows - Day 1
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import androidx.lifecycle.viewmodel.compose.viewModel
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.catch
@stevdza-san
stevdza-san / Animations.kt
Last active October 9, 2025 14:46
Jetpack Compose - Day 2
import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.animation.animateContentSize
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.RepeatMode
import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.rememberInfiniteTransition
@stevdza-san
stevdza-san / AnimatedBorderCard.kt
Last active October 9, 2025 03:56
Card with Animated Border built with Jetpack Compose.
@Composable
fun AnimatedBorderCard(
modifier: Modifier = Modifier,
shape: Shape = RoundedCornerShape(size = 0.dp),
borderWidth: Dp = 2.dp,
gradient: Brush = Brush.sweepGradient(listOf(Color.Gray, Color.White)),
animationDuration: Int = 10000,
onCardClick: () -> Unit = {},
content: @Composable () -> Unit
) {