This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context | |
import android.graphics.* | |
import android.support.v7.widget.AppCompatTextView | |
import android.text.Layout | |
import android.util.AttributeSet | |
class FadeOutTextView @JvmOverloads constructor( | |
context: Context, | |
attrs: AttributeSet? = null, | |
defStyleAttribute: Int = android.R.attr.textViewStyle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LiveDataShotOnce<T> : MutableLiveData<T>() { | |
private val observerWrapperMap = WeakHashMap<Observer<in T>, ObserverWrapper<in T>>() | |
@MainThread | |
override fun observe(owner: LifecycleOwner, observer: Observer<in T>) { | |
val observerWrapper = ObserverWrapper(observer) | |
observerWrapperMap[observer] = observerWrapper | |
super.observe(owner, observerWrapper) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* <b>Helper class to print any object you want</b> | |
*/ | |
public class PrintMe { | |
static StringBuilder result; | |
static String newLine = System.getProperty("line.separator"); | |
static ConcurrentLinkedQueue<Object> objects = new ConcurrentLinkedQueue<Object>(); | |
private PrintMe() { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final int PEEK_DRAWER_TIME_SECONDS = 2; | |
private long downTime; | |
private long eventTime; | |
private float x = 0.0f; | |
private float y = 100.0f; | |
private int metaState = 0; | |
protected void peekDrawer() { | |
downTime = SystemClock.uptimeMillis(); | |
eventTime = SystemClock.uptimeMillis() + 100; |