jw
12/29/2016, 7:42 PMjw
12/29/2016, 7:43 PMdamian
12/29/2016, 8:11 PMfun Context.wrapWithTheme(attrs: AttributeSet, defStyleAttr: Int = 0): Context {
val defAttrs = obtainStyledAttributes(attrs, android.support.v7.appcompat.R.styleable.View, defStyleAttr, 0)
try {
val themeResId = defAttrs.getResourceId(android.support.v7.appcompat.R.styleable.View_android_theme, -1)
return if (themeResId == -1) this else ContextThemeWrapper(this, themeResId)
} finally {
defAttrs.recycle()
}
}
class DefStyleThemeableButton : AppCompatButton {
constructor(context: Context)
: super(context)
constructor(context: Context, attrs: AttributeSet)
: super(context.wrapWithTheme(attrs, android.support.v7.appcompat.R.attr.buttonStyle), attrs)
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int)
: super(context.wrapWithTheme(attrs, defStyleAttr), attrs, defStyleAttr)
}
miha-x64
12/30/2016, 12:02 PMsimpleArrayMapOf()
, sparseArrayOf()
, sparseBooleanArrayOf()
, arraySetOf()
etc?stangl0r
12/30/2016, 2:58 PMmiha-x64
12/30/2016, 3:03 PMjw
12/30/2016, 4:08 PMdamian
12/30/2016, 4:08 PMjw
12/30/2016, 4:08 PMdamian
12/30/2016, 4:08 PMchuck
12/30/2016, 5:55 PMjw
12/30/2016, 5:56 PMchuck
12/30/2016, 5:57 PMsimon.vergauwen
12/30/2016, 6:40 PMsimon.vergauwen
12/30/2016, 6:41 PM@Provides
@Singleton
public FactoryInterface provideSomeClassGeneratedFactory(final SomeClassGeneratedFactory someClassGeneratedFactory) {
return someClassGeneratedFactory;
}
versus Kotlin
@Provides
@Singleton
fun provideSomeGeneratedFactory(someDependency: SomeDependency): FactoryInterfacy = SomeClassKotlinGeneratedFactory({ someDependency })
rwachol
12/30/2016, 6:47 PMmiha-x64
12/30/2016, 6:50 PM<K, V> arrayMapOf(k0: K, v0: V, k1: K, v1: V ...)
to avoid extra allocations.miha-x64
12/30/2016, 6:50 PM@InlineOnly
to be public to mark these functions 🙂jw
12/30/2016, 7:30 PMscan
operatorrwachol
12/30/2016, 7:35 PMjw
12/30/2016, 7:37 PMval increment = "Increment"
val decrement = "Decrement"
val actions = Observable.from(increment, increment, decrement, decrement);
val states = actions.scan(0, (action, state) -> when(action) {
is increment -> state + 1
is decrement -> state - 1
else -> throw IllegalArgumentException("Unknown action $action")
})
states.subscribe(state -> println(state))
0
1
2
1
0
rwachol
12/30/2016, 7:39 PMpieper
12/31/2016, 5:49 PMpieper
12/31/2016, 5:50 PMlupajz
01/01/2017, 1:22 PMdawidhyzy
01/02/2017, 8:01 AMError:Parent file doesn't exist:/ProjectPath/build/kotlin-build/caches/artifact-difference.tab.keystream
dawidhyzy
01/02/2017, 8:03 AM1.0.6-eap-112
to 1.0.6
dawidhyzy
01/02/2017, 8:07 AManibyl
01/02/2017, 8:14 AM