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 org.json.JSONArray | |
import org.json.JSONObject | |
fun JSONObject.toMap(): Map<String, Any?> = | |
keys().asSequence().associateWith { key -> toValue(get(key)) } | |
fun JSONArray.toList(): List<Any?> = | |
(0 until length()).map { index -> toValue(get(index)) } | |
private fun toValue(element: Any) = when (element) { |
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 android.support.annotation.CallSuper | |
import android.support.annotation.CheckResult | |
import android.support.design.widget.BottomSheetDialogFragment | |
import android.view.View | |
import com.trello.rxlifecycle2.LifecycleProvider | |
import com.trello.rxlifecycle2.LifecycleTransformer | |
import com.trello.rxlifecycle2.RxLifecycle | |
import com.trello.rxlifecycle2.android.FragmentEvent | |
import com.trello.rxlifecycle2.android.RxLifecycleAndroid |
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.graphics.Rect; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.View; | |
public class BottomPaddingDecoration extends RecyclerView.ItemDecoration { | |
private final int bottomPadding; | |
public BottomPaddingDecoration(int bottomPadding) { | |
this.bottomPadding = bottomPadding; | |
} |
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
package com.jakewharton.rxrelay2; | |
import io.reactivex.Observer; | |
public class SingleValueRelay<T> extends Relay<T> { | |
private final BehaviorRelay<T> behaviorRelay = BehaviorRelay.create(); | |
public SingleValueRelay() {} |
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.support.annotation.NonNull; | |
import java.util.Collection; | |
import java.util.Iterator; | |
import java.util.List; | |
import java.util.ListIterator; | |
public class ListWrapper<T> implements List<T> { | |
private final List<T> list; |
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.Typeface; | |
import android.support.design.widget.TextInputLayout; | |
import android.util.AttributeSet; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.EditText; | |
import uk.co.chrisjenx.calligraphy.CalligraphyConfig; |
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 java.util.Collection; | |
import java.util.Map; | |
public class NullSafe { | |
public static boolean isEmpty(Collection<?> collection) { | |
return collection == null || collection.isEmpty(); | |
} | |
public static boolean isEmpty(Map<?, ?> map) { |
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
public class DbCompat { | |
protected static final int FIELD_TYPE_BLOB = 4; | |
protected static final int FIELD_TYPE_FLOAT = 2; | |
protected static final int FIELD_TYPE_INTEGER = 1; | |
protected static final int FIELD_TYPE_NULL = 0; | |
protected static final int FIELD_TYPE_STRING = 3; | |
public static int getType(Cursor cursor, int i) throws Exception { | |
SQLiteCursor sqLiteCursor = (SQLiteCursor) cursor; |