From 1a1db5a6f13bc02cecaa8e962a67088257888c92 Mon Sep 17 00:00:00 2001 From: Yan Zhulanow Date: Fri, 2 Jun 2017 22:26:01 +0300 Subject: [PATCH] Android Extensions: Support cache in custom Views --- .../synthetic/codegen/AndroidClassType.kt | 2 +- .../bytecodeShape/simpleView/simpleView.kt | 1 + .../viewWithCache/res/layout/layout.xml | 17 ++++++++++++++ .../viewWithCache/viewWithCache.kt | 22 +++++++++++++++++++ .../AndroidBytecodeShapeTestGenerated.java | 6 +++++ 5 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/viewWithCache/res/layout/layout.xml create mode 100644 plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/viewWithCache/viewWithCache.kt diff --git a/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/synthetic/codegen/AndroidClassType.kt b/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/synthetic/codegen/AndroidClassType.kt index e54eec260f8..e4c27ca0e82 100644 --- a/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/synthetic/codegen/AndroidClassType.kt +++ b/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/synthetic/codegen/AndroidClassType.kt @@ -28,7 +28,7 @@ enum class AndroidClassType(className: String, val supportsCache: Boolean = fals DIALOG(AndroidConst.DIALOG_FQNAME, supportsCache = false), SUPPORT_FRAGMENT_ACTIVITY(AndroidConst.SUPPORT_FRAGMENT_ACTIVITY_FQNAME, supportsCache = true), SUPPORT_FRAGMENT(AndroidConst.SUPPORT_FRAGMENT_FQNAME, supportsCache = true, fragment = true), - VIEW(AndroidConst.VIEW_FQNAME), + VIEW(AndroidConst.VIEW_FQNAME, supportsCache = true), UNKNOWN(""); val internalClassName: String = className.replace('.', '/') diff --git a/plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/simpleView/simpleView.kt b/plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/simpleView/simpleView.kt index 04f5c525f0d..a192d8cacc0 100644 --- a/plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/simpleView/simpleView.kt +++ b/plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/simpleView/simpleView.kt @@ -14,4 +14,5 @@ public class MyActivity : Activity() { // 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 \ No newline at end of file diff --git a/plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/viewWithCache/res/layout/layout.xml b/plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/viewWithCache/res/layout/layout.xml new file mode 100644 index 00000000000..4d73173b521 --- /dev/null +++ b/plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/viewWithCache/res/layout/layout.xml @@ -0,0 +1,17 @@ + + + + +