Skip to content

Instantly share code, notes, and snippets.

class StateHolder<T : Any>(state: T) {
private val _liveData = MutableLiveData(state)
val liveData: LiveData<T> get() = _liveData
private var _value: T = state
val value: T get() = _value
fun update(notify: Boolean = true, block: T.() -> T) {
synchronized(LOCK) {
_value = block(value)
#define JNIIMPORT
#define JNIEXPORT __attribute__ ((visibility ("default")))
#define JNICALL
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/popuplayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/transparent"
    android:orientation="horizontal">