Skip to content

Instantly share code, notes, and snippets.

View rodrigosimoesrosa's full-sized avatar
🏠
Working from home

Rodrigo rodrigosimoesrosa

🏠
Working from home
View GitHub Profile
@rodrigosimoesrosa
rodrigosimoesrosa / ActivityOrFragment.kt
Created January 13, 2022 17:00
Drawable transition color using vectors
transition = imageView.setTransitionDrawable(resourceID, R.color.firstColor, R.color.secondColor)
transition?.startTransition(3000)
@rodrigosimoesrosa
rodrigosimoesrosa / README.md
Created May 22, 2019 18:21 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

All hex value from 100% to 0% alpha:

import java.math.RoundingMode
import kotlin.math.round
/**
* Created by rodrigosimoesrosa.
*/
const val DIGITS = 1
fun Float.round(decimals: Int = DIGITS): Float {
var multiplier = 1.0f
/*
* Copyright (C) 2018 The Android Open Source Project
*
* 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
@rodrigosimoesrosa
rodrigosimoesrosa / circle_drawable_shadow.xml
Last active January 31, 2023 06:26
Shadow for circle drawable Android.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- Shadow -->
<item>
<shape android:shape="oval">
<padding
android:bottom="1dp"
android:left="1dp"
android:right="1dp"