Skip to content

Instantly share code, notes, and snippets.

View araujotadeu's full-sized avatar

Tadeu Araujo araujotadeu

  • Brazil
View GitHub Profile
@jamiesanson
jamiesanson / ViewLifecycleLazy.kt
Last active March 26, 2024 13:17
A Kotlin lazy implementation which automatically clears itself at appropriate times in the View Lifecycle, with a Fragment example
import androidx.fragment.app.Fragment
import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.Observer
import kotlin.properties.ReadOnlyProperty
import kotlin.reflect.KProperty
fun <T> Fragment.viewLifecycleLazy(initialise: () -> T): ReadOnlyProperty<Fragment, T> =
object : ReadOnlyProperty<Fragment, T>, DefaultLifecycleObserver {
@guness
guness / CombinedLiveData.java
Last active May 15, 2023 14:10
LiveData merger that takes two live data inputs and a merger function. Merges two results using merger function, and returning result allowing null inputs and outputs. Input and out types are parametric. However only supports two live data inputs for now.
import androidx.annotation.NonNull;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MediatorLiveData;
import androidx.lifecycle.Observer;
import java.util.function.BiFunction;
public class CombinedLiveData<T, K, S> extends MediatorLiveData<S> {
@Pulimet
Pulimet / AdbCommands
Last active May 9, 2024 13:28
Adb useful commands list
adb help // List all comands
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
@jemshit
jemshit / proguard-rules.pro
Last active April 27, 2024 08:54
Proguard Rules for Android libraries
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
-keepclassmembers class fqcn.of.javascript.interface.for.webview {
public *;
}
### RxJava, RxAndroid (https://gist.github.com/kosiara/487868792fbd3214f9c9)
-keep class rx.schedulers.Schedulers {
public static <methods>;