Skip to content

Instantly share code, notes, and snippets.

View Nike2406's full-sized avatar
🎯
Focusing

Nick Nike2406

🎯
Focusing
View GitHub Profile
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.tween
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
@Nike2406
Nike2406 / gist:5d7847c49fddc8c400c16fa428c847e8
Last active October 30, 2025 13:12
Exclude generated Hilt files polluting your Search Window in Android Studio
/**
* Add code below to "settings/editor/file types/Ignored Files and Folders"
*/
*DaggerComponent.java
*DaggetModule.java
*Hilt*.java
*GeneratedInjector.java
*_Factory.java
*ViewModel*.java
@Nike2406
Nike2406 / gist:4cd10df7fb06a61d2cbdde0efb5d27f8
Created April 8, 2025 09:30
Exclude generated Hilt files
1. With your Android Studio open, click on the ‘File’ menu.
2. Then select ‘Settings’.
3. In the ‘Editor’ tab, navigate to ‘File Types’.
4. Within this menu, click on the ‘Ignored Files and Folders’ window.
5. Add this sources.
*DaggerComponent.java
*DaggetModule.java
*Hilt*.java
@Nike2406
Nike2406 / gist:3ef5bd726ee4d47447d13155a0b36eab
Created December 18, 2024 10:42
Preventing Font Scaling
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.unit.sp
val TextUnit.nonScaledSp
@Composable
get() = (this.value / LocalDensity.current.fontScale).sp
// Example:
@Nike2406
Nike2406 / gist:b135dfee8445b4c695e3f54b64c8c8b0
Created December 17, 2024 14:51
Compose: Context.getActivity()
fun Context.getActivity(): ComponentActivity? = when (this) {
is ComponentActivity -> this
is ContextWrapper -> baseContext.getActivity()
else -> null
}