Skip to content

Instantly share code, notes, and snippets.

View josh-Muleshi's full-sized avatar
🔥
Way up

Josh josh-Muleshi

🔥
Way up
View GitHub Profile
@josh-Muleshi
josh-Muleshi / ParallaxScreen.kt
Created May 31, 2022 13:59 — forked from surajsau/ParallaxScreen.kt
Parallax effect with Jetpack Compose
@Composable
fun ParallaxScreen(modifier: Modifier = Modifier) {
val context = LocalContext.current
val scope = rememberCoroutineScope()
var data by remember { mutableStateOf<SensorData?>(null) }
DisposableEffect(Unit) {
val dataManager = SensorDataManager(context)
dataManager.init()
1. navfun (applicable in Kotlin except Comment)
@androidx.compose.runtime.Composable
fun Navigation($PARAM$: $TYPE$) {
NavHost(navController = $TYPE$, startDestination = "$ROOT$"){
composable("$ROOT$"){
$CODE$
}
}
}
1. hiltvm (applicable in top-level)
@dagger.hilt.android.lifecycle.HiltViewModel
class $NAME$ @javax.inject.Inject constructor(
$PARAM$
) : androidx.lifecycle.ViewModel() {
$END$
}
2. vmstatefunc (applicable in class)
private val _$NAME$ = androidx.compose.runtime.mutableStateOf<$TYPE$>($INITIAL_VALUE$)