Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀

Vinay Gaba vinaygaba

🚀
View GitHub Profile
View RecomposeHighlighter.kt
/*
* Copyright 2022 Google Inc.
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@vinaygaba
vinaygaba / codeInsightSettings.xml
Last active May 22, 2022
Configuration setting that makes Jetpack Compose development more efficient by removing the noise from auto complete. More information in this article - https://www.jetpackcompose.app/articles/productivity-hack-to-save-tens-of-engineering-hours-when-working-with-Jetpack-Compose
View codeInsightSettings.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaProjectCodeInsightSettings">
<excluded-names>
<name>android.app.LauncherActivity.ListItem</name>
<name>android.graphics.drawable.Icon</name>
<name>android.graphics.fonts.FontFamily</name>
<name>android.inputmethodservice.Keyboard.Row</name>
<name>android.text.layout.Alignment</name>
<name>android.widget.GridLayout.Alignment</name>
@vinaygaba
vinaygaba / LogCompositions.kt
Created May 22, 2022
Useful for printing log statements when a composable function is being recomposed
View LogCompositions.kt
// Full credit for this snippet goes to Sean McQuillan - https://twitter.com/objcode
class Ref(var value: Int)
// Note the inline function below which ensures that this function is essentially
// copied at the call site to ensure that its logging only recompositions from the
// original call site.
@Composable
inline fun LogCompositions(tag: String, msg: String) {
if (BuildConfig.DEBUG) {
@vinaygaba
vinaygaba / StartShowkase.kt
Created Dec 21, 2020
Start Showkase Activity
View StartShowkase.kt
context.startActivity(createShowkaseBrowserIntent(context))
@vinaygaba
vinaygaba / ShowkaseRootModule.kt
Created Dec 21, 2020
Usage of ShowkaseRootModule
View ShowkaseRootModule.kt
@ShowkaseRoot
class MyRootModule: ShowkaseRootModule
@vinaygaba
vinaygaba / ShowkaseTypography.kt
Last active Dec 21, 2020
Usage of @ShowkaseTypography
View ShowkaseTypography.kt
@ShowkaseTypography(
name = "Custom name for text style"
group = "Custom group name"
val h1 = TextStyle(fontWeight = FontWeight.Light, fontSize = 96.sp)
@vinaygaba
vinaygaba / ShowkaseColor.kt
Created Dec 21, 2020
Usage of @ShowkaseColor
View ShowkaseColor.kt
@ShowkaseColor(
name = "Primary Color",
group = "Material Design"
val primaryColor = Color(0xFF6200EE)
View ShowkasePreview.kt
@Preview(
name = "Custom name for component"
group = "Custom group name"
@Composable 
fun MyComponent() { … }
@vinaygaba
vinaygaba / ShowkaseComposable.kt
Last active Dec 21, 2020
Usage of @ShowkaseComposable
View ShowkaseComposable.kt
@ShowkaseComposable(
name = "Custom name for component"
group = "Custom group name"
@Composable 
fun MyComponent() { … }
@vinaygaba
vinaygaba / build.gradle
Created Dec 21, 2020
Showkase build.gradle
View build.gradle
implementation "com.airbnb.android:showkase:1.0.0-alpha04"
kapt "com.airbnb.android:showkase-processor:1.0.0-alpha04"