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,26 +13,26 @@ import android.support.v4.widget.*
import kotlin.internal.flexible.ft
val android.app.Activity.item_detail_container: ft<FrameLayout, FrameLayout?>
get() = findViewById(0) as FrameLayout
get() = findViewById(0) as? FrameLayout
val android.app.Fragment.item_detail_container: ft<FrameLayout, FrameLayout?>
get() = getView().findViewById(0) as FrameLayout
get() = getView().findViewById(0) as? FrameLayout
val android.app.Activity.textView1: ft<TextView, TextView?>
get() = findViewById(0) as TextView
get() = findViewById(0) as? TextView
val android.app.Fragment.textView1: ft<TextView, TextView?>
get() = getView().findViewById(0) as TextView
get() = getView().findViewById(0) as? TextView
val android.app.Activity.password: ft<EditText, EditText?>
get() = findViewById(0) as EditText
get() = findViewById(0) as? EditText
val android.app.Fragment.password: ft<EditText, EditText?>
get() = getView().findViewById(0) as EditText
get() = getView().findViewById(0) as? EditText
val android.app.Activity.login: ft<Button, Button?>
get() = findViewById(0) as Button
get() = findViewById(0) as? Button
val android.app.Fragment.login: ft<Button, Button?>
get() = getView().findViewById(0) as Button
get() = getView().findViewById(0) as? Button
@@ -13,14 +13,14 @@ import android.support.v4.widget.*
import kotlin.internal.flexible.ft
val android.view.View.item_detail_container: ft<FrameLayout, FrameLayout?>
get() = findViewById(0) as FrameLayout
get() = findViewById(0) as? FrameLayout
val android.view.View.textView1: ft<TextView, TextView?>
get() = findViewById(0) as TextView
get() = findViewById(0) as? TextView
val android.view.View.password: ft<EditText, EditText?>
get() = findViewById(0) as EditText
get() = findViewById(0) as? EditText
val android.view.View.login: ft<Button, Button?>
get() = findViewById(0) as Button
get() = findViewById(0) as? Button