Android Extensions: Generate proper receiver for clearFindViewByIdCache() call (KT-19742)

This commit is contained in:
Yan Zhulanow
2017-08-23 19:25:29 +03:00
committed by Yan Zhulanow
parent f84df6381e
commit 07be1e9d10
5 changed files with 20 additions and 9 deletions
@@ -7,6 +7,7 @@ import android.view.View
import android.widget.*
import org.my.cool.MyButton
import kotlinx.android.synthetic.main.layout.*
import kotlinx.android.synthetic.clearFindViewByIdCache
class R {
class id {
@@ -36,7 +37,9 @@ class MyFragment(): Fragment() {
override fun getView(): View = baseView
public fun box(): String {
return if (login.toString() == "MyButton") "OK" else ""
val result = if (login.toString() == "MyButton") "OK" else ""
clearFindViewByIdCache()
return result
}
}
@@ -4,6 +4,7 @@ import android.app.Activity
import android.view.View
import android.widget.*
import kotlinx.android.synthetic.main.layout.*
import kotlinx.android.synthetic.clearFindViewByIdCache
class R {
class id {
@@ -32,11 +33,15 @@ class MyActivity(): Activity() {
}
}
public fun box(): String{
return if (textView1.toString() == "TextView" &&
password.toString() == "EditText" &&
login.toString() == "Button")
"OK" else ""
public fun box(): String {
val result = when {
textView1.toString() == "TextView" && password.toString() == "EditText" && login.toString() == "Button" -> "OK"
else -> ""
}
clearFindViewByIdCache()
return result
}
}