Android Extensions: Support @ContainerOptions in compiler plugin

This commit is contained in:
Yan Zhulanow
2017-06-05 18:05:03 +03:00
parent 6e1dd08fbb
commit d4b4bc71ee
19 changed files with 321 additions and 68 deletions

View File

@@ -0,0 +1,19 @@
package test
import android.app.Activity
import android.os.Bundle
import java.io.File
import kotlinx.android.synthetic.main.layout.*
import kotlinx.android.extensions.*
@ContainerOptions(cache = CacheImplementation.NO_CACHE)
public class MyActivity : Activity() {
init {login}
}
// 0 public _\$_findCachedViewById
// 0 public _\$_clearFindViewByIdCache
// 1 GETSTATIC test/R\$id\.login
// 0 INVOKEVIRTUAL test/MyActivity\._\$_findCachedViewById
// 1 INVOKEVIRTUAL android/app/Activity\.findViewById
// 1 CHECKCAST android/widget/Button

View File

@@ -0,0 +1,17 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/item_detail_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ItemDetailActivity"
tools:ignore="MergeRootFrame" >
<Button
android:id="@+id/login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Sign in" />
</FrameLayout>

View File

@@ -0,0 +1,20 @@
package test
import android.app.Fragment
import java.io.File
import kotlinx.android.synthetic.main.layout.*
import kotlinx.android.extensions.*
@ContainerOptions(cache = CacheImplementation.NO_CACHE)
public class MyFragment : Fragment() {
init {login}
}
// 0 public _\$_findCachedViewById
// 0 public _\$_clearFindViewByIdCache
// 1 INVOKEVIRTUAL android/app/Fragment\.getView
// 1 GETSTATIC test/R\$id\.login
// 0 INVOKEVIRTUAL test/MyFragment\._\$_findCachedViewById
// 1 INVOKEVIRTUAL android/app/Fragment\.getView
// 1 INVOKEVIRTUAL android/view/View\.findViewById
// 1 CHECKCAST android/widget/Button

View File

@@ -0,0 +1,17 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/item_detail_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ItemDetailActivity"
tools:ignore="MergeRootFrame" >
<Button
android:id="@+id/login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Sign in" />
</FrameLayout>

View File

@@ -4,7 +4,9 @@ import android.view.View
import android.app.Activity
import android.content.Context
import kotlinx.android.synthetic.main.layout.view.*
import kotlinx.android.extensions.*
@ContainerOptions(cache = CacheImplementation.HASH_MAP)
class MyView(context: Context) : View(context)
class MyActivity : Activity() {

View File

@@ -0,0 +1,17 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/item_detail_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ItemDetailActivity"
tools:ignore="MergeRootFrame" >
<Button
android:id="@+id/login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Sign in" />
</FrameLayout>

View File

@@ -0,0 +1,21 @@
package test
import android.view.View
import android.app.Activity
import android.content.Context
import kotlinx.android.synthetic.main.layout.view.*
class MyView(context: Context) : View(context)
class MyActivity : Activity() {
init { MyView(this).login }
}
// 2 public _\$_findCachedViewById
// 1 INVOKEVIRTUAL android/app/Activity\.findViewById
// 2 public _\$_clearFindViewByIdCache
// 1 GETSTATIC test/R\$id\.login
// 1 INVOKEVIRTUAL android/view/View\.findViewById
// 0 INVOKEVIRTUAL test/MyActivity\._\$_findCachedViewById
// 0 INVOKEVIRTUAL android/view/View\._\$_findCachedViewById
// 1 CHECKCAST android/widget/Button

View File

@@ -0,0 +1,17 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/item_detail_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ItemDetailActivity"
tools:ignore="MergeRootFrame" >
<Button
android:id="@+id/login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Sign in" />
</FrameLayout>

View File

@@ -0,0 +1,24 @@
package test
import android.view.View
import android.app.Activity
import android.content.Context
import kotlinx.android.synthetic.main.layout.view.*
import kotlinx.android.extensions.*
@ContainerOptions(cache = CacheImplementation.NO_CACHE)
class MyView(context: Context) : View(context)
class MyActivity : Activity() {
init { MyView(this).login }
}
// 1 public _\$_findCachedViewById
// 1 INVOKEVIRTUAL test/MyActivity\.findViewById
// 1 public _\$_clearFindViewByIdCache
// 1 GETSTATIC test/R\$id\.login
// 1 INVOKEVIRTUAL android/view/View\.findViewById
// 0 INVOKEVIRTUAL test/MyView\.findViewById
// 0 INVOKEVIRTUAL test/MyActivity\._\$_findCachedViewById
// 0 INVOKEVIRTUAL android/view/View\._\$_findCachedViewById
// 1 CHECKCAST android/widget/Button