Skip to content

Instantly share code, notes, and snippets.

View Sal7one's full-sized avatar
Probably making my 7th cup of Coffee

Saleh Alanazi Sal7one

Probably making my 7th cup of Coffee
View GitHub Profile
@Sal7one
Sal7one / ExpandedButtonCompose.kt
Last active April 21, 2024 16:52
Menu button scale expand something something compose kotlin
// Original idea by https://twitter.com/raffichill/status/1781492309500027206
// Tried to make it vanilla as possible
@Composable
fun EditMenu() {
var isExpanded by remember {
mutableStateOf(false)
}
val scale by animateFloatAsState(
@Sal7one
Sal7one / AssistedInjectionHilt.kt
Last active February 27, 2024 21:23
Assisted Injection with hilt Helper code - I think it's dumb and a bad practice but here's the code anyways :)
// Raw hilt viewmodel
@HiltViewModel
class SomeViewModel @Inject constructor(
private val repository: Repo // Injected from hilt
) : ViewModel() {
}
// Let's pass any var we want for example an int that we pass when we create the viewmodel
class MainActivity : AppCompatActivity() {
private val secretUserNum = Random().nextInt(100) + 1
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
findViewById<TextView>(R.id.actualPass).text = "Actual pass $secretUserNum "
@Sal7one
Sal7one / loader.kt
Created April 3, 2022 06:16
Loading SVGs from a URL with COIL on Jetpack compose (inline imageLoader)
// By Sal7one - 3/4/2022
// Inline ImageLoader if you have a diffrenet need than your ImageLoader Singlton
//
// Since LocalImageLoader is deprecated
//
// Coil Version
// implementation("io.coil-kt:coil-compose:2.0.0-rc02")
// implementation("io.coil-kt:coil-svg:2.0.0-rc02")
//
//
@Sal7one
Sal7one / hotline-miami-2-vita-custom-bullet-calculator.markdown
Created January 23, 2022 15:15
Hotline Miami 2 Vita. custom bullet calculator