Cast findViewById() result to Views safely

This commit is contained in:
Yan Zhulanow
2015-03-26 16:03:58 +03:00
parent 1f16328070
commit fae114f606
17 changed files with 62 additions and 62 deletions
@@ -13,8 +13,8 @@ import android.support.v4.widget.*
import kotlin.internal.flexible.ft
val android.app.Activity.MyButton: ft<org.my.cool.Button, org.my.cool.Button?>
get() = findViewById(0) as org.my.cool.Button
get() = findViewById(0) as? org.my.cool.Button
val android.app.Fragment.MyButton: ft<org.my.cool.Button, org.my.cool.Button?>
get() = getView().findViewById(0) as org.my.cool.Button
get() = getView().findViewById(0) as? org.my.cool.Button
@@ -13,5 +13,5 @@ import android.support.v4.widget.*
import kotlin.internal.flexible.ft
val android.view.View.MyButton: ft<org.my.cool.Button, org.my.cool.Button?>
get() = findViewById(0) as org.my.cool.Button
get() = findViewById(0) as? org.my.cool.Button