Fix overrides of the findViewById in android tests for platform 26

This commit is contained in:
Ilya Chernikov
2017-11-30 14:49:16 +01:00
committed by Vyacheslav Gerasimov
parent 587f76251e
commit 7120fe190a
13 changed files with 28 additions and 28 deletions
@@ -30,7 +30,7 @@ class MyActivity(): Activity() {
val editTextWidget2 = EditText(this)
val buttonWidget2 = Button(this)
override fun findViewById(id: Int): View? {
override fun <T : View> findViewById(id: Int): T? {
return when (id) {
R.id.textView1 -> textViewWidget
R.id.password -> editTextWidget
@@ -39,7 +39,7 @@ class MyActivity(): Activity() {
R.id.passwordCaption -> editTextWidget2
R.id.loginButton -> buttonWidget2
else -> null
}
} as T?
}
@@ -24,13 +24,13 @@ class MyActivity(): Activity() {
val editTextWidget = EditText(this)
val buttonWidget = Button(this)
override fun findViewById(id: Int): View? {
override fun <T : View> findViewById(id: Int): T? {
return when (id) {
R.id.textView1 -> textViewWidget
R.id.password -> editTextWidget
R.id.login -> buttonWidget
else -> null
}
} as T?
}
}