Skip to content

Instantly share code, notes, and snippets.

View tomriddle25's full-sized avatar

Faisal tomriddle25

View GitHub Profile
@inidamleader
inidamleader / AutoSizeText.kt
Last active September 16, 2024 09:57
AutoSizeText: Composable function that automatically adjusts the text size to fit within given constraints with optimal performance by using a binary search algorithm
/*
MIT License
Copyright (c) 2024 Reda El Madini
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
import androidx.compose.ui.Modifier
import androidx.compose.ui.composed
import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Paint
import androidx.compose.ui.graphics.drawscope.drawIntoCanvas
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
@cedrickring
cedrickring / ColoredShadow.kt
Last active September 5, 2024 21:56
Draw a colored shadow in Android Jetpack Compose
/*
Copyright 2020 Cedric Kring.
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,
@Zhuinden
Zhuinden / LoginViewModel.kt
Created June 19, 2020 00:51
Hilt LoginViewModel Login
fun onLoginClicked() {
val username = // ...
navigationDispatcher.emit { navController ->
navController.navigate(
LoggedOutGraphDirections.loggedOutToLoggedIn(username))
}
}
}
@romkatv
romkatv / Pure style for Powerlevel10k.md
Last active July 30, 2024 11:08
Pure style for Powerlevel10k

Powerlevel10k can generate the same prompt as Pure.

pure

Installation

git clone https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>! ~/.zshrc
@deepakpk009
deepakpk009 / add_git_submodule.txt
Created August 8, 2017 09:26
how to add a git android library project as a sub module, to a project
how to add a git android library project as a sub module, to a project
1. create an android project
2. add to vcs (vcs - import into version control - create git repository)
3. goto terminal and add sub-module - make sure the location folder name is different than the original project name
git submodule add https://XXX@bitbucket.org/YYY/ZZZ.git
4. goto file menu - project structure
5. click '+' on left top
6. select 'import gradle project'
@Kishanjvaghela
Kishanjvaghela / converter.sh
Last active July 8, 2024 21:36
Create Image drawable for all resolutions
if [ $# -eq 0 ]; then
echo "No arguments supplied"
else if [ -f "$1" ]; then
echo " Creating different dimensions (dips) of "$1" ..."
mkdir -p drawable-xxhdpi
mkdir -p drawable-xhdpi
mkdir -p drawable-hdpi
mkdir -p drawable-mdpi
if [ $1 = "ic_launcher.png" ]; then