Skip to content

Instantly share code, notes, and snippets.

@timmutton
timmutton / SimpleRecyclerViewAdapter.kt
Created March 8, 2018 12:08
SimpleRecyclerViewAdapter
package au.com.realestate.hometime.presentation.common
import android.support.v7.widget.RecyclerView
import android.view.View
import android.view.ViewGroup
class SimpleRecyclerViewAdapter<T>(private val itemType: Class<SimpleRecyclerViewAdapter.ViewDataBinding<T>>,
private val items: List<T>) : RecyclerView.Adapter<SimpleRecyclerViewAdapter.SimpleViewHolder<T>>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SimpleViewHolder<T> {
val view = itemType.getConstructor().newInstance()
@timmutton
timmutton / DayNightApplication.java
Last active March 1, 2016 21:37
Sample Application class that adds day/night support
public class DayNightApplication extends Application {
static {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_AUTO);
}
}
@timmutton
timmutton / ic_menu_camera.xml
Last active March 1, 2016 21:47
Camera cector with theme attribute colors
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="?attr/colorControlNormal"
android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0" />
<path
android:fillColor="?attr/colorControlNormal"