Android Extensions: Add SparseArray implementation for the View cache (KT-18250)

This commit is contained in:
Yan Zhulanow
2017-06-05 23:32:56 +03:00
parent fbfd51e97e
commit 7b238e0b21
9 changed files with 221 additions and 41 deletions
@@ -13,4 +13,9 @@ public class MyActivity : Activity() {
// 1 public _\$_clearFindViewByIdCache
// 1 GETSTATIC test/R\$id\.login
// 1 INVOKEVIRTUAL test/MyActivity\._\$_findCachedViewById
// 1 CHECKCAST android/widget/Button
// 1 CHECKCAST android/widget/Button
// 12 android/util/SparseArray
// 1 INVOKEVIRTUAL android/util/SparseArray\.get
// 1 INVOKEVIRTUAL android/util/SparseArray\.put
// 1 INVOKEVIRTUAL android/util/SparseArray\.clear
// 0 java/util/HashMap
@@ -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>
@@ -0,0 +1,23 @@
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.HASH_MAP)
public class MyActivity : Activity() {
init {login}
}
// 1 public _\$_findCachedViewById
// 1 public _\$_clearFindViewByIdCache
// 1 GETSTATIC test/R\$id\.login
// 1 INVOKEVIRTUAL test/MyActivity\._\$_findCachedViewById
// 1 CHECKCAST android/widget/Button
// 12 java/util/HashMap
// 1 INVOKEVIRTUAL java/util/HashMap\.get
// 1 INVOKEVIRTUAL java/util/HashMap\.put
// 1 INVOKEVIRTUAL java/util/HashMap\.clear
// 0 android/util/SparseArray