Created
August 24, 2023 10:36
-
-
Save prilaga/ba75797b89e204b988626651d0cc3e3d to your computer and use it in GitHub Desktop.
Android Studio templates to speed up writing boilerplate code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. mlData (applicable in Kotlin except Comment) | |
private val _$NAME$ = MutableLiveData<$PARAM_TYPE$>($INITIAL_VALUE$) | |
val $NAME$ : LiveData<$PARAM_TYPE$> = _$NAME$ | |
2. sleData (applicable in Kotlin except Comment) | |
private val _$NAME$ = SingleLiveEvent<$PARAM_TYPE$>() | |
val $NAME$ : LiveData<$PARAM_TYPE$> = _$NAME$ | |
3. hiltvm (applicable in top-level) | |
@dagger.hilt.android.lifecycle.HiltViewModel | |
class $NAME$ @javax.inject.Inject constructor( | |
$PARAM$ | |
) : androidx.lifecycle.ViewModel() { | |
$END$ | |
} | |
4. vmstatefunc (applicable in class) | |
private val _$NAME$ = androidx.compose.runtime.mutableStateOf<$TYPE$>($INITIAL_VALUE$) | |
val $NAME$: androidx.compose.runtime.State<$TYPE$> = _$NAME$ | |
fun $FUNC$($PARAM$: $TYPE$) { | |
_$NAME$.value = $PARAM$ | |
} | |
5. remstate (applicable in Kotlin except Comment) | |
var $NAME$ by androidx.compose.runtime.remember { | |
androidx.compose.runtime.mutableStateOf($INITIAL_VALUE$) | |
} | |
6. centerbox (applicable in Kotlin except Comment) | |
androidx.compose.foundation.layout.Box( | |
modifier = androidx.compose.ui.Modifier.fillMaxSize(), | |
contentAlignment = androidx.compose.ui.Alignment.Center | |
) { | |
$END$ | |
} | |
7. iconbtn (applicable in Kotlin except Comment) | |
androidx.compose.material.IconButton( | |
onClick = { | |
}, | |
) { | |
androidx.compose.material.Icon( | |
imageVector = $ICON$, | |
contentDescription = $CONTENT_DESCRIPTION$ | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment