Skip to content

Instantly share code, notes, and snippets.

View lucanicoletti's full-sized avatar
:octocat:

Luca Nicoletti lucanicoletti

:octocat:
View GitHub Profile
@twocity
twocity / SimpleHeaderDecoration.java
Last active February 7, 2022 12:22
An empty header (or footer) decoration for RecyclerView, since RecyclerView can't clipToPadding
import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;
/**
* An empty header (or footer) decoration for RecyclerView, since RecyclerView can't clipToPadding
*/
public class SimpleHeaderDecoration extends RecyclerView.ItemDecoration {
private final int headerHeight;
private final int footerHeight;
@nickbutcher
nickbutcher / rainbow.xml
Last active January 25, 2023 17:09
Demonstrating using VectorDrawable gradients to create a rainbow effect. See https://twitter.com/crafty/status/1011922414983352320
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 Google Inc.
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, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the License for the specific language governing permissions and limitations under
the License.
@davidvavra
davidvavra / NonNullAssertionDetector.kt
Created March 22, 2019 17:06
Lint check for detecting non-null assertion (!!) in your code
import com.android.tools.lint.client.api.UElementHandler
import com.android.tools.lint.detector.api.*
import org.jetbrains.uast.UElement
import org.jetbrains.uast.UPostfixExpression
class NonNullAssertionDetector : Detector(), Detector.UastScanner {
override fun getApplicableUastTypes(): List<Class<out UElement>>? {
return listOf(UPostfixExpression::class.java)
}
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
/*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled