Skip to content

Instantly share code, notes, and snippets.

View titoaesj's full-sized avatar
🇧🇷

Tito Albino Evangelista da Silva Junior titoaesj

🇧🇷
View GitHub Profile
@titoaesj
titoaesj / .kt
Last active July 14, 2025 09:41
Android convert int to dp
OBS: O var_number_int é a varável que recebera o valor a ser convertido em DP
(int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, var_number_int, getResources().getDisplayMetrics())
##KOTLIN
val Int.dp: Int
get() = (this * Resources.getSystem().displayMetrics.density + 0.5f).toInt()
val Float.dp: Int
@titoaesj
titoaesj / .java
Last active October 16, 2017 13:28
Class ImagesMock para testes com imagens no Android
/**
* Some simple test data to use for this sample app.
*/
public class ImagesMock {
/**
* This are PicasaWeb URLs and could potentially change. Ideally the PicasaWeb API should be
* used to fetch the URLs.
*
* Credit to Romain Guy for the photos: