Skip to content

Instantly share code, notes, and snippets.

View Tapchicoma's full-sized avatar

Yahor Berdnikau Tapchicoma

View GitHub Profile
@ghale
ghale / captureFingerprints.gradle
Last active July 19, 2023 11:13
Capture task classpath fingerprints
def fingerprinter = services.get(org.gradle.internal.fingerprint.classpath.ClasspathFingerprinter)
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { task ->
doFirst {
ClassLoader classLoader = task.getClass().classLoader
while (classLoader instanceof URLClassLoader) {
def fingerprints = [] as Set
def allFiles = [] as Set
classLoader.getURLs().each {
fingerprints.add(["${task.path}:${file(it.file).name}", "${fingerprinter.fingerprint(files(it.file)).hash}"])
allFiles.add(file(it.file))
@alexjlockwood
alexjlockwood / androidx-class-mapping.csv
Last active March 10, 2024 21:08
Android X migration script
android.support.v7.widget.util.SortedListAdapterCallback androidx.recyclerview.widget.SortedListAdapterCallback
android.support.v7.widget.helper.ItemTouchUIUtilImpl androidx.recyclerview.widget.ItemTouchUIUtilImpl
android.support.v7.widget.helper.ItemTouchUIUtil androidx.recyclerview.widget.ItemTouchUIUtil
android.support.v7.widget.helper.ItemTouchHelper androidx.recyclerview.widget.ItemTouchHelper
android.support.v7.widget.WithHint androidx.appcompat.widget.WithHint
android.support.v7.widget.ViewUtils androidx.appcompat.widget.ViewUtils
android.support.v7.widget.ViewStubCompat androidx.appcompat.widget.ViewStubCompat
android.support.v7.widget.ViewInfoStore androidx.recyclerview.widget.ViewInfoStore
android.support.v7.widget.ViewBoundsCheck androidx.recyclerview.widget.ViewBoundsCheck
android.support.v7.widget.VectorEnabledTintResources androidx.appcompat.widget.VectorEnabledTintResources
@cketti
cketti / android-27-sources.md
Created December 18, 2017 04:07
Build your own android-27 sources

Build "Sources for Android 27" so you can comfortably browse the Android API source in Android Studio.

  1. Collect source files
mkdir android-sdk-source-build
cd android-sdk-source-build

mkdir -p frameworks/base
@elizarov
elizarov / Debounce.kt
Last active August 26, 2019 00:19
Debounce
import kotlinx.coroutines.experimental.DefaultDispatcher
import kotlinx.coroutines.experimental.channels.ReceiveChannel
import kotlinx.coroutines.experimental.channels.consumeEach
import kotlinx.coroutines.experimental.channels.produce
import kotlinx.coroutines.experimental.delay
import kotlinx.coroutines.experimental.runBlocking
import kotlin.coroutines.experimental.CoroutineContext
fun <T> ReceiveChannel<T>.debounce(
wait: Long = 300,
@mkobit
mkobit / build.gradle.kts
Last active December 14, 2022 00:29
Run Kotlin REPL with built source code and main classpath in Gradle
// Assuming Kotlin plugin is applied...
// Run as: ./gradlew kotlinRepl --console plain --no-daemon
val kotlinRepl by tasks.creating {
description = "Starts Kotlin REPL with compiled main classes and runtime classpath"
val mainSourceSet = java.sourceSets["main"]
dependsOn(mainSourceSet.output)
doFirst {
val buildscriptClasspath = rootProject.buildscript.configurations["classpath"]
@donnfelker
donnfelker / OrderActivity.java
Last active November 22, 2019 23:46
RxJava Bound Service AIDL Abstraction
package com.donnfelker.rxexample;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import rx.Subscriber;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
@nickbutcher
nickbutcher / 10: animator-morph_ridge_2_to_tick.xml
Last active February 20, 2021 07:32
Demonstrating an animation for scanning a fingerprint and showing success or failure. This uses a number of AnimatedVectorDrawables (https://developer.android.com/reference/android/graphics/drawable/AnimatedVectorDrawable.html) to 'morph' parts of the fingerprint into the tick or cross to report success or failure. It also uses a moving clip-pat…
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 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
@maiatoday
maiatoday / getdb
Last active December 7, 2015 10:10
getdb - little shell script to pull the db for an app on an android emulator or device.
#!/bin/bash
display_usage() {
echo -e "\nUsage:\n`basename $0` -p [package] -n [dbname] \n"
}
# if less than two arguments supplied, display usage
if [ $# -le 2 ]
then
display_usage
@pyricau
pyricau / LeakSlackUploadService.java
Created May 9, 2015 00:03
Sending Leak Traces to a Slack Channel (and HipChat, see the comments)
import android.util.Log;
import com.squareup.leakcanary.AnalysisResult;
import com.squareup.leakcanary.DisplayLeakService;
import com.squareup.leakcanary.HeapDump;
import retrofit.RestAdapter;
import retrofit.RetrofitError;
import retrofit.http.Multipart;
import retrofit.http.POST;
import retrofit.http.Part;
import retrofit.mime.TypedFile;
@daj
daj / BaseStatelessBlackBoxEspressoTest.java
Last active December 20, 2018 09:44 — forked from xrigau/AndroidManifest.xml
The set of changes required to disable animations any time Espresso tests run. These instructions will only work on emulators and on rooted devices. This is based on the instructions in: https://code.google.com/p/android-test-kit/wiki/DisablingAnimations
public abstract class BaseStatelessBlackBoxEspressoTest<T extends Activity> extends ActivityInstrumentationTestCase2<T> {
private SystemAnimations mSystemAnimations;
public BaseStatelessBlackBoxEspressoTest(Class clazz) {
super(clazz);
}
@Override
protected void setUp() throws Exception {