Skip to content

Instantly share code, notes, and snippets.

View erfansn's full-sized avatar
🔍
Life

Erfan Sadigh Nejati erfansn

🔍
Life
  • Freedom
View GitHub Profile
@erfansn
erfansn / GoogleAuthScreen.kt
Last active October 11, 2023 03:43
Using the Google Sign-In Api in Compose with the least possible friction
@Composable
fun GoogleAuthScreen() {
val googleAuthState = rememberGoogleAuthState(
clientId = stringResource(R.string.web_client_id),
Scope(Scopes.PROFILE),
Scope(Scopes.EMAIL)
)
DisposableEffect(googleAuthState) {
googleAuthState.onSignInResult = {
when (it) {
@erfansn
erfansn / PermissionsRequest.kt
Last active January 14, 2025 14:05
Convenient handling of runtime permissions in Jetpack Compose
import android.app.Activity
import android.content.Context
import android.content.ContextWrapper
import android.content.SharedPreferences
import androidx.activity.compose.ManagedActivityResultLauncher
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.layout.RowScope
import androidx.compose.material3.Button
import androidx.compose.material3.Text
@erfansn
erfansn / CircularRevealAnimation.kt
Last active March 12, 2025 11:33 — forked from bmonjoie/CircularRevealAnimation.kt
Compose Circular Reveal, like the Telegram theme changing animation.
@Composable
fun CircularReveal(
expanded: Boolean,
modifier: Modifier = Modifier,
animationSpec: FiniteAnimationSpec<Float> = tween(),
content: @Composable (Boolean) -> Unit,
) {
val transition = updateTransition(expanded, label = "Circular reveal")
transition.CircularReveal(modifier, animationSpec, content = content)
}