Skip to content

Instantly share code, notes, and snippets.

Working from home

Hugo Matilla HugoMatilla

Working from home
View GitHub Profile
HugoMatilla / colors_material_design.xml
Created Sep 23, 2020
Material Design Colors for Android apps.
View colors_material_design.xml
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="" tools:ignore="MissingDefaultResource">
<!-- google's material design colours from -->
<color name="md_red_50">#FFEBEE</color>
<color name="md_red_100">#FFCDD2</color>
<color name="md_red_200">#EF9A9A</color>
<color name="md_red_300">#E57373</color>
HugoMatilla / AddDarkModeButton.kt
Last active Sep 15, 2020
Add a DarkMode Button to your activity
View AddDarkModeButton.kt
fun addDarkModeButton() {
val darkButton = Button(this).apply {
text = if (getDefaultNightMode() != MODE_NIGHT_YES) "Go Dark " else "Go Light"
layoutParams = LayoutParams(MATCH_PARENT, WRAP_CONTENT)
(window.decorView as ViewGroup).addView(darkButton) // or `yourContainer.addView(darkButton)`
darkButton.setOnClickListener {
grep -rnw '.' -e ''

Get dependencies tree

./gradlew app:dependencies > deps.txt

Only for one configuration

./gradlew app:dependencies --configuration <productFlavors><buildTypeCapitalized>CompileClasspath
View MediumPost-KotlinModifiers-05.csv
Modifier Corresponding member Comments for classes
final Can’t be overridden Used by default for class members
open Can be overridden Should be specified explicitly
abstract Must be overridden Can be used only in abstract classes; abstract members can’t have an implementation
override Overrides a member in a superclass or interface Overridden member is open by default if not marked final
View MediumPost-KotlinModifiers-04.kt
abstract class Widget {
abstract fun draw() // open and must be overridden
open fun focus() {} // can be overridden
fun hide() {} // final by deafult, can't be overridden
View MediumPost-KotlinModifiers-03.kt
class SuperSpecificButton : SpecificButton {
final override fun click() = print("Super Specific Click")
View MediumPost-KotlinModifiers-02.kt
open class Button {
open fun click() = print("Click")
fun doubleClick() = print("Double Click")
class SpecificButton() : Button { // Inheritance is now possible
override fun click() = print("Specific Click") // Now it works
override fun doubleClick() = print("Specific Double Click") // Error
View MediumPost-KotlinModifiers-01.kt
class Button {
fun click() = print("Click")
class SpecificButton : Button() { // Error
override fun click() = print("Specific Click") // Error
View Gradle Cheat


./gradlew app:dependencies


./gradlew test

You can’t perform that action at this time.