Fix overrides of the findViewById in android tests for platform 26
This commit is contained in:
committed by
Vyacheslav Gerasimov
parent
587f76251e
commit
7120fe190a
Vendored
+2
-2
@@ -20,8 +20,8 @@ class MyActivity(): Activity() {
|
||||
val loginItem = Button(this)
|
||||
|
||||
val entity = MyEntity(object : FrameLayout(this) {
|
||||
override fun findViewById(id: Int) : View? = when(id) {
|
||||
R.id.login -> loginItem
|
||||
override fun <T : View> findViewById(id: Int): T? = when(id) {
|
||||
R.id.login -> loginItem as T
|
||||
else -> null
|
||||
}
|
||||
})
|
||||
|
||||
+2
-2
@@ -18,8 +18,8 @@ class MyActivity(): Activity() {
|
||||
val loginItem = Button(this)
|
||||
|
||||
val entity = MyEntity(object : FrameLayout(this) {
|
||||
override fun findViewById(id: Int) : View? = when(id) {
|
||||
R.id.login -> loginItem
|
||||
override fun <T : View> findViewById(id: Int): T? = when(id) {
|
||||
R.id.login -> loginItem as T
|
||||
else -> null
|
||||
}
|
||||
})
|
||||
|
||||
Vendored
+2
-2
@@ -17,9 +17,9 @@ class R {
|
||||
class MyActivity(): Activity() {
|
||||
val buttonWidget = MyButton(this)
|
||||
|
||||
override fun findViewById(id: Int): View? {
|
||||
override fun <T : View> findViewById(id: Int): T? {
|
||||
return when (id) {
|
||||
R.id.login -> buttonWidget
|
||||
R.id.login -> buttonWidget as T
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -17,9 +17,9 @@ class R {
|
||||
class MyActivity(): Activity() {
|
||||
val buttonWidget = MyButton(this)
|
||||
|
||||
override fun findViewById(id: Int): View? {
|
||||
override fun <T : View> findViewById(id: Int): T? {
|
||||
return when (id) {
|
||||
R.id.login -> buttonWidget
|
||||
R.id.login -> buttonWidget as T
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -17,9 +17,9 @@ class R {
|
||||
class MyActivity(): Activity() {
|
||||
val buttonWidget = MyButton(this)
|
||||
|
||||
override fun findViewById(id: Int): View? {
|
||||
override fun <T : View> findViewById(id: Int): T? {
|
||||
return when (id) {
|
||||
R.id.login -> buttonWidget
|
||||
R.id.login -> buttonWidget as T
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -17,9 +17,9 @@ class R {
|
||||
class MyActivity(): Activity() {
|
||||
val buttonWidget = MyButton(this)
|
||||
|
||||
override fun findViewById(id: Int): View? {
|
||||
override fun <T : View> findViewById(id: Int): T? {
|
||||
return when (id) {
|
||||
R.id.login -> buttonWidget
|
||||
R.id.login -> buttonWidget as T
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -20,9 +20,9 @@ class R {
|
||||
class BaseView(ctx: Context) : View(ctx) {
|
||||
val buttonWidget = MyButton(ctx)
|
||||
|
||||
override fun findViewById(id: Int): View? {
|
||||
override fun <T : View> findViewById(id: Int): T? {
|
||||
return when (id) {
|
||||
R.id.login -> buttonWidget
|
||||
R.id.login -> buttonWidget as T
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -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?
|
||||
}
|
||||
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -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?
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -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?
|
||||
}
|
||||
|
||||
public fun box(): String {
|
||||
|
||||
Vendored
+2
-2
@@ -23,13 +23,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?
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -19,17 +19,17 @@ class MyActivity(): Activity() {
|
||||
val containerWidget = object : FrameLayout(this) {
|
||||
val loginWidget = Button(this@MyActivity)
|
||||
|
||||
override fun findViewById(id: Int): View? {
|
||||
override fun <T : View> findViewById(id: Int): T? {
|
||||
return when (id) {
|
||||
R.id.login -> loginWidget
|
||||
R.id.login -> loginWidget as T
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun findViewById(id: Int): View? {
|
||||
override fun <T : View> findViewById(id: Int): T? {
|
||||
return when (id) {
|
||||
R.id.container -> containerWidget
|
||||
R.id.container -> containerWidget as T
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -20,9 +20,9 @@ class MyActivity(): Activity() {
|
||||
val loginWidget = Button(this@MyActivity)
|
||||
}
|
||||
|
||||
override fun findViewById(id: Int): View? {
|
||||
override fun <T : View> findViewById(id: Int): T? {
|
||||
return when (id) {
|
||||
R.id.container -> containerWidget
|
||||
R.id.container -> containerWidget as T
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user