Skip to content

Instantly share code, notes, and snippets.

@parthdesai1208
Last active June 2, 2022 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parthdesai1208/c14382ef9d98fb3c64eb6013b8954064 to your computer and use it in GitHub Desktop.
Save parthdesai1208/c14382ef9d98fb3c64eb6013b8954064 to your computer and use it in GitHub Desktop.
Collections of live template for android studio
Abbreviation: fun0
Description: Function with no parameters
Template text:
fun $NAME$() : $RETURN$ {
return $RETURN$
}
*******************************************************************************************************************************************
Abbreviation: key
Description: Key for a bundle
Template text:
private const val KEY_$value$ = "$value$"
*******************************************************************************************************************************************
Abbreviation: comment
Description: block comment for structuring code
Template text:
///////////////////////////////////////////////////////////////////////////
//comment by Parth Desai (Email:-dparth78@gmail.com)
///////////////////////////////////////////////////////////////////////////
// $blockName$
///////////////////////////////////////////////////////////////////////////
*******************************************************************************************************************************************
Abbreviation: toast
Description: Create a new Toast
Template text:
android.widget.Toast.makeText($context$, "$text$", Toast.LENGTH_SHORT).show();
*******************************************************************************************************************************************
Abbreviation: todo
Description: adds // TODO
Template text:
// TODO: $date$ $todo$
Note: $date$ = current date
*******************************************************************************************************************************************
Abbreviation: todomock
Description: adds todo while mockking
Template text:
//region TODO: $date$ $todoTitle$
//endregion
Where: $date$ = date() function
*******************************************************************************************************************************************
Abbreviation: composable
Description: Create @Composable function
Template text:
@androidx.compose.runtime.Composable
fun $NAME$() {
$END$
}
*******************************************************************************************************************************************
Abbreviation: preview
Description: Create @Preview composable function
Template text:
@androidx.compose.ui.tooling.preview.Preview
@androidx.compose.runtime.Composable
fun $NAME$() {
$END$
}
*******************************************************************************************************************************************
Abbreviation: sysprev
Description: Preview with showSystemUI
Template text:
@androidx.compose.ui.tooling.preview.Preview(showSystemUi = true)
*******************************************************************************************************************************************
Abbreviation: allprev
Description: Preview in light/dark & tablet screen
Template text:
@androidx.compose.ui.tooling.preview.Preview(name = "light", showSystemUi = true)
@androidx.compose.ui.tooling.preview.Preview(name = "Dark", showSystemUi = true
, uiMode = android.content.res.Configuration.UI_MODE_NIGHT_YES)
@androidx.compose.ui.tooling.preview.Preview(name = "landscape",showSystemUi = true
, device = androidx.compose.ui.tooling.preview.Devices.AUTOMOTIVE_1024p,
widthDp = 720,
heightDp = 360
)
*******************************************************************************************************************************************
Abbreviation: logd
Description: Log.d(TAG, String)
Template text:
android.util.Log.d(this::class.java.simpleName, "$variable$: $value$")
Note: same as
loge
logi
logw
*******************************************************************************************************************************************
Abbreviation: region
Description:region declaration
Template text:
//region $region_name$
//endregion
*******************************************************************************************************************************************
Abbreviation:
Description:
Template text:
*******************************************************************************************************************************************
Abbreviation:
Description:
Template text:
*******************************************************************************************************************************************
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment