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
sudo apt install libc6:i386 libncurses5:i386 libstdc++6:i386 libbz2-1.0:i386 zlib1g:i386 openjdk-8-jdk |
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.content.res.TypedArray; | |
import android.graphics.Canvas; | |
import android.graphics.Rect; | |
import android.graphics.drawable.Drawable; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.View; | |
public class ItemDividerDecoration extends RecyclerView.ItemDecoration { | |
private final Drawable divider; |
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
/** | |
* Abstraction over {@link Observable#switchOnNext(Observable)}, allowing an Observable to publish | |
* results from multiple streams that may be switched over time, for example from an event source | |
* that may change. | |
* | |
* https://stackoverflow.com/questions/21836818/subscribing-to-a-future-observable/21839376#21839376 | |
*/ | |
public final class StreamSwitcher<T> { | |
Subject<Observable<T>, Observable<T>> publisher; | |
Observable<T> stream; |
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.os.Parcelable | |
import android.os.Parcel | |
import kotlin.InlineOption.ONLY_LOCAL_RETURN | |
public inline fun creator<reified T : Parcelable>( | |
inlineOptions(ONLY_LOCAL_RETURN) createFromParcel: (Parcel) -> T?): Parcelable.Creator<T> = | |
object : Parcelable.Creator<T> { | |
override fun createFromParcel(source: Parcel): T? = createFromParcel(source) | |
override fun newArray(size: Int): Array<out T?> = arrayOfNulls(size) | |
} |
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 kotlin.properties.ReadWriteProperty | |
import android.content.SharedPreferences | |
import android.app.Activity | |
import android.content.Context | |
import android.app.Fragment | |
import android.support.v4.app.Fragment as SupportFragment | |
import kotlin.properties.Delegates | |
public fun Activity.intPreference(prefs: String, key: String, default: Int): ReadWriteProperty<Any, Int> = intPref(prefs, key, default) | |
public fun Activity.stringPreference(prefs: String, key: String, default: String): ReadWriteProperty<Any, String> = stringPref(prefs, key, default) |
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.view.View | |
import kotlin.properties.ReadOnlyProperty | |
import android.app.Activity | |
import kotlin.properties.Delegates | |
public fun Activity.bindView<T: View>(id: Int): ReadOnlyProperty<Any, T> = ViewVal(id) | |
public fun ViewHolder.bindView<T: View>(id: Int): ReadOnlyProperty<Any, T> = ViewVal(id) | |
public trait ViewHolder { | |
public val view: View; |
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.os.Bundle | |
import kotlin.properties.ReadOnlyProperty | |
import kotlin.properties.ReadWriteProperty | |
import android.app.Fragment | |
import android.support.v4.app.Fragment as SupportFragment | |
import kotlin.properties.Delegates | |
public fun bundledBoolean(bundle: Bundle, key: String, default: Boolean = false): ReadWriteProperty<Any, Boolean> = bundleVar({ bundle }, key, default) | |
public fun bundledString(bundle: Bundle, key: String, default: String = ""): ReadWriteProperty<Any, String> = bundleVar({ bundle }, key, default) | |
public fun bundledInt(bundle: Bundle, key: String, default: Int = 0): ReadWriteProperty<Any, Int> = bundleVar({ bundle }, key, default) |
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
// Copyright 2014 Robert Carr | |
// | |
// 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, |
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
// Apache 2.0 licensed. | |
// Based on Jake Wharton's 'BindableAdapter.java' - https://gist.github.com/JakeWharton/5423616 | |
import android.widget.BaseAdapter | |
import android.content.Context | |
import android.view.LayoutInflater | |
import kotlin.properties.Delegates | |
import android.view.View | |
import android.view.ViewGroup |