Skip to content

Instantly share code, notes, and snippets.

View runo280's full-sized avatar
🤨

runo280 runo280

🤨
View GitHub Profile
@vighnesh153
vighnesh153 / ExoVideoPlayerInJetpackCompose.kt
Last active April 16, 2025 00:54
Exoplayer in Jetpack Compose
package vighnesh153.androidx.exo_player_prototype
import android.net.Uri
import android.os.Build
import android.util.Log
import android.view.ViewGroup
import android.view.accessibility.CaptioningManager.CaptionStyle
import android.widget.FrameLayout
import androidx.annotation.RequiresApi
import androidx.compose.animation.AnimatedVisibility
@rodrigomartind
rodrigomartind / AnimationBlurEffect.kt
Created December 30, 2022 20:04
Animation Blur Effect in Jetpack Compose
import androidx.compose.animation.core.RepeatMode
import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.rememberInfiniteTransition
import androidx.compose.animation.core.tween
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.offset
import android.graphics.Matrix
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.RepeatMode
import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.rememberInfiniteTransition
import androidx.compose.animation.core.tween
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.SpringSpec
import androidx.compose.animation.core.spring
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
@mghdmi
mghdmi / phoneNumberRegex.js
Created April 30, 2022 16:05
Iranian phone number regex (include persian digits)
// Validate numbers that starts with '+98' or '09' and 9 digits after.
// It also works with persian numbers.
const regex = /^((\+98|0|\+۹۸|۰)(9|۹)[0-9-۰-۹]{9})$/;
console.log(regex.test("+989121234567")); // true
console.log(regex.test("۰۹۱۲۱۲۳۴۵۶۷")); // true
console.log(regex.test("۰۹12۱۲34۵۶7")); // true
console.log(regex.test("+۹۸۹۱۲1234567")); // true
console.log(regex.test("+98912123456789")); // false
@okmanideep
okmanideep / EventQueue.kt
Last active October 2, 2024 04:19
Event abstraction for Jetpack Compose
import androidx.compose.runtime.*
import kotlinx.coroutines.CoroutineScope
@Stable
internal class Event<T>(val value: T)
class MutableEventQueue<T>
internal constructor(): EventQueue<T>() {
private val events = mutableListOf<Event<T>>()
private val nextEventAsState = mutableStateOf<Event<T>?>(null)
/*
* Copyright 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
public class ThreeDigitDecimalFormatWatcher implements TextWatcher {
private DecimalFormat df;
private DecimalFormat dfnd;
private boolean hasFractionalPart;
private EditText et;
public ThreeDigitDecimalFormatWatcher(EditText et) {
DecimalFormatSymbols decimalFormatSymbols = DecimalFormatSymbols.getInstance(Locale.US);
@unaisulhadi
unaisulhadi / SquareRadioButton.kt
Created April 2, 2022 14:20
Square Radio Button in Jetpack Compose
package com.hadi.themoment.ui.components
import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.tween
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.requiredSize
import androidx.compose.foundation.layout.wrapContentSize
class PriceTextInputLayout @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = R.attr.textInputStyle
) : TextInputLayout(context, attrs, defStyleAttr) {
val locale = Locale(LOCALE_LANGUAGE_FA)
override fun onAttachedToWindow() {