Android extensions: Do not cache ViewStub widgets, do not cast it automatically

This commit is contained in:
Yan Zhulanow
2015-11-12 17:59:18 +03:00
parent 3f97b384ef
commit 6caaa305bc
10 changed files with 127 additions and 27 deletions
@@ -0,0 +1,10 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ViewStub
android:id="@+id/stub"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</FrameLayout>
@@ -0,0 +1,18 @@
package test
import android.app.Activity
import android.os.Bundle
import java.io.File
import kotlinx.android.synthetic.main.layout.*
public class MyActivity : Activity() {
fun test() {
stub
}
}
// 1 GETSTATIC test/R\$id\.stub
// 0 INVOKEVIRTUAL test/MyActivity\._\$_findCachedViewById
// 1 INVOKEVIRTUAL android/app/Activity\.findViewById
// 0 CHECKCAST android/view/ViewStub
// 2 CHECKCAST android/view/View