Support variants in Android Extensions (compiler plugin)
This commit is contained in:
+36
-9
@@ -19,8 +19,12 @@ package org.jetbrains.kotlin.android
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinGradleSubplugin
|
||||
import org.gradle.api.Project
|
||||
import com.android.build.gradle.BaseExtension
|
||||
import com.android.build.gradle.api.AndroidSourceSet
|
||||
import org.gradle.api.tasks.compile.AbstractCompile
|
||||
import org.jetbrains.kotlin.gradle.plugin.SubpluginOption
|
||||
import org.w3c.dom.Document
|
||||
import java.io.File
|
||||
import javax.xml.parsers.DocumentBuilderFactory
|
||||
|
||||
public class AndroidSubplugin : KotlinGradleSubplugin {
|
||||
|
||||
@@ -28,20 +32,37 @@ public class AndroidSubplugin : KotlinGradleSubplugin {
|
||||
val androidExtension = project.extensions.getByName("android") as? BaseExtension ?: return null
|
||||
|
||||
val sourceSets = androidExtension.sourceSets
|
||||
|
||||
val pluginOptions = arrayListOf<SubpluginOption>()
|
||||
|
||||
val mainSourceSet = sourceSets.getByName("main")
|
||||
|
||||
val resourceDirs = mainSourceSet.res.srcDirs
|
||||
val manifestFile = mainSourceSet.manifest.srcFile
|
||||
val applicationPackage = androidExtension.defaultConfig.applicationId
|
||||
?: getApplicationPackageFromManifest(manifestFile) ?: ""
|
||||
pluginOptions += SubpluginOption("package", applicationPackage)
|
||||
|
||||
if (resourceDirs.isNotEmpty()) {
|
||||
val resourceDirOptions = resourceDirs.map { resourceDir ->
|
||||
resourceDir.listFiles { it.isDirectory && it.name.startsWith("layout") }?.forEach { task.source(it) }
|
||||
SubpluginOption("androidRes", resourceDir.absolutePath)
|
||||
}
|
||||
return listOf(SubpluginOption("androidManifest", manifestFile.absolutePath)) + resourceDirOptions
|
||||
fun addVariant(sourceSet: AndroidSourceSet) {
|
||||
pluginOptions += SubpluginOption("variant", sourceSet.name + ';' +
|
||||
mainSourceSet.res.srcDirs.joinToString(";") { it.absolutePath })
|
||||
}
|
||||
|
||||
return null
|
||||
addVariant(mainSourceSet)
|
||||
|
||||
val flavorSourceSets = androidExtension.productFlavors.map { sourceSets.findByName(it.name) }.filterNotNull()
|
||||
for (sourceSet in flavorSourceSets) {
|
||||
addVariant(sourceSet)
|
||||
}
|
||||
|
||||
return pluginOptions
|
||||
}
|
||||
|
||||
private fun getApplicationPackageFromManifest(manifestFile: File): String? {
|
||||
try {
|
||||
return manifestFile.parseXml().documentElement.getAttribute("package")
|
||||
}
|
||||
catch (e: Exception) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
override fun getPluginName() = "org.jetbrains.kotlin.android"
|
||||
@@ -49,4 +70,10 @@ public class AndroidSubplugin : KotlinGradleSubplugin {
|
||||
override fun getGroupName() = "org.jetbrains.kotlin"
|
||||
|
||||
override fun getArtifactName() = "kotlin-android-extensions"
|
||||
|
||||
fun File.parseXml(): Document {
|
||||
val factory = DocumentBuilderFactory.newInstance()
|
||||
val builder = factory.newDocumentBuilder()
|
||||
return builder.parse(this)
|
||||
}
|
||||
}
|
||||
+23
-18
@@ -25,10 +25,7 @@ import org.jetbrains.kotlin.android.synthetic.codegen.AndroidExpressionCodegenEx
|
||||
import org.jetbrains.kotlin.android.synthetic.codegen.AndroidOnDestroyClassBuilderInterceptorExtension
|
||||
import org.jetbrains.kotlin.android.synthetic.diagnostic.AndroidExtensionPropertiesCallChecker
|
||||
import org.jetbrains.kotlin.android.synthetic.diagnostic.DefaultErrorMessagesAndroid
|
||||
import org.jetbrains.kotlin.android.synthetic.res.AndroidLayoutXmlFileManager
|
||||
import org.jetbrains.kotlin.android.synthetic.res.CliAndroidLayoutXmlFileManager
|
||||
import org.jetbrains.kotlin.android.synthetic.res.CliSyntheticFileGenerator
|
||||
import org.jetbrains.kotlin.android.synthetic.res.SyntheticFileGenerator
|
||||
import org.jetbrains.kotlin.android.synthetic.res.*
|
||||
import org.jetbrains.kotlin.codegen.extensions.ClassBuilderInterceptorExtension
|
||||
import org.jetbrains.kotlin.codegen.extensions.ExpressionCodegenExtension
|
||||
import org.jetbrains.kotlin.compiler.plugin.CliOption
|
||||
@@ -47,30 +44,30 @@ import org.jetbrains.kotlin.resolve.TargetPlatform
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform
|
||||
|
||||
public object AndroidConfigurationKeys {
|
||||
public val ANDROID_RES_PATH: CompilerConfigurationKey<List<String>> = CompilerConfigurationKey.create<List<String>>("android resources search path")
|
||||
public val ANDROID_MANIFEST: CompilerConfigurationKey<String> = CompilerConfigurationKey.create<String>("android manifest file")
|
||||
public val VARIANT: CompilerConfigurationKey<List<String>> = CompilerConfigurationKey.create<List<String>>("Android build variant")
|
||||
public val PACKAGE: CompilerConfigurationKey<String> = CompilerConfigurationKey.create<String>("application package fq name")
|
||||
}
|
||||
|
||||
public class AndroidCommandLineProcessor : CommandLineProcessor {
|
||||
companion object {
|
||||
public val ANDROID_COMPILER_PLUGIN_ID: String = "org.jetbrains.kotlin.android"
|
||||
|
||||
public val RESOURCE_PATH_OPTION: CliOption = CliOption("androidRes", "<path>", "Android resources path", allowMultipleOccurrences = true)
|
||||
public val MANIFEST_FILE_OPTION: CliOption = CliOption("androidManifest", "<path>", "Android manifest file")
|
||||
public val VARIANT_OPTION: CliOption = CliOption("variant", "<name;path>", "Android build variant", allowMultipleOccurrences = true)
|
||||
public val PACKAGE_OPTION: CliOption = CliOption("package", "<fq name>", "Application package")
|
||||
}
|
||||
|
||||
override val pluginId: String = ANDROID_COMPILER_PLUGIN_ID
|
||||
|
||||
override val pluginOptions: Collection<CliOption> = listOf(RESOURCE_PATH_OPTION, MANIFEST_FILE_OPTION)
|
||||
override val pluginOptions: Collection<CliOption> = listOf(VARIANT_OPTION, PACKAGE_OPTION)
|
||||
|
||||
override fun processOption(option: CliOption, value: String, configuration: CompilerConfiguration) {
|
||||
when (option) {
|
||||
RESOURCE_PATH_OPTION -> {
|
||||
val paths = configuration.getList(AndroidConfigurationKeys.ANDROID_RES_PATH).toArrayList()
|
||||
VARIANT_OPTION -> {
|
||||
val paths = configuration.getList(AndroidConfigurationKeys.VARIANT).toArrayList()
|
||||
paths.add(value)
|
||||
configuration.put(AndroidConfigurationKeys.ANDROID_RES_PATH, paths)
|
||||
configuration.put(AndroidConfigurationKeys.VARIANT, paths)
|
||||
}
|
||||
MANIFEST_FILE_OPTION -> configuration.put(AndroidConfigurationKeys.ANDROID_MANIFEST, value)
|
||||
PACKAGE_OPTION -> configuration.put(AndroidConfigurationKeys.PACKAGE, value)
|
||||
else -> throw CliOptionProcessingException("Unknown option: ${option.name}")
|
||||
}
|
||||
}
|
||||
@@ -86,14 +83,16 @@ public class CliAndroidDeclarationsProvider(private val project: Project) : Exte
|
||||
public class AndroidComponentRegistrar : ComponentRegistrar {
|
||||
|
||||
public override fun registerProjectComponents(project: MockProject, configuration: CompilerConfiguration) {
|
||||
val androidResPath = configuration.get(AndroidConfigurationKeys.ANDROID_RES_PATH)
|
||||
val androidManifest = configuration.get(AndroidConfigurationKeys.ANDROID_MANIFEST)
|
||||
val applicationPackage = configuration.get(AndroidConfigurationKeys.PACKAGE)
|
||||
val variants = configuration.get(AndroidConfigurationKeys.VARIANT)?.map { parseVariant(it) }?.filterNotNull() ?: emptyList()
|
||||
|
||||
if (androidResPath != null && androidManifest != null) {
|
||||
val xmlProcessor = CliSyntheticFileGenerator(project, androidManifest, androidResPath)
|
||||
if (variants.isNotEmpty() && !applicationPackage.isNullOrBlank()) {
|
||||
val xmlProcessor = CliSyntheticFileGenerator(project, applicationPackage!!, variants)
|
||||
|
||||
project.registerService(SyntheticFileGenerator::class.java, xmlProcessor)
|
||||
project.registerService(AndroidLayoutXmlFileManager::class.java, CliAndroidLayoutXmlFileManager(project, androidManifest, androidResPath))
|
||||
|
||||
val layoutXmlFileManager = CliAndroidLayoutXmlFileManager(project, applicationPackage, variants)
|
||||
project.registerService(AndroidLayoutXmlFileManager::class.java, layoutXmlFileManager)
|
||||
|
||||
ExternalDeclarationsProvider.registerExtension(project, CliAndroidDeclarationsProvider(project))
|
||||
ExpressionCodegenExtension.registerExtension(project, AndroidExpressionCodegenExtension())
|
||||
@@ -102,6 +101,12 @@ public class AndroidComponentRegistrar : ComponentRegistrar {
|
||||
ClassBuilderInterceptorExtension.registerExtension(project, AndroidOnDestroyClassBuilderInterceptorExtension())
|
||||
}
|
||||
}
|
||||
|
||||
private fun parseVariant(s: String): AndroidVariant? {
|
||||
val parts = s.split(';')
|
||||
if (parts.size < 2) return null
|
||||
return AndroidVariant(parts[0], parts.drop(0))
|
||||
}
|
||||
}
|
||||
|
||||
public class AndroidExtensionPropertiesComponentContainerContributor : StorageComponentContainerContributor {
|
||||
|
||||
+2
-2
@@ -34,7 +34,7 @@ open class Context(val buffer: StringBuffer = StringBuffer(), private var indent
|
||||
indentDepth--
|
||||
if (indentDepth < 0)
|
||||
throw InvalidIndent(indentDepth)
|
||||
currentIndent = currentIndent.substring(0, currentIndent.length() - indentUnit.length())
|
||||
currentIndent = currentIndent.substring(0, currentIndent.length - indentUnit.length)
|
||||
}
|
||||
|
||||
public open fun write(what: String) {
|
||||
@@ -57,7 +57,7 @@ open class Context(val buffer: StringBuffer = StringBuffer(), private var indent
|
||||
|
||||
|
||||
public fun trim(num: Int) {
|
||||
buffer.delete(buffer.length() - num, buffer.length())
|
||||
buffer.delete(buffer.length - num, buffer.length())
|
||||
}
|
||||
|
||||
public fun fork(newBuffer: StringBuffer = StringBuffer(),
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ class KotlinStringWriter : KotlinWriter {
|
||||
body.writeln("val $name: $retType")
|
||||
body.incIndent()
|
||||
body.write("get() ")
|
||||
if (getterBody.size() > 1) {
|
||||
if (getterBody.size > 1) {
|
||||
body.writeNoIndent("{\n")
|
||||
body.incIndent()
|
||||
for (stmt in getterBody) {
|
||||
|
||||
+18
-8
@@ -27,15 +27,25 @@ import com.intellij.psi.PsiManager
|
||||
import org.jetbrains.kotlin.psi.KtProperty
|
||||
import java.util.*
|
||||
|
||||
public abstract class AndroidLayoutXmlFileManager(val project: Project) {
|
||||
class AndroidVariantData(val variant: AndroidVariant, private val layouts: Map<String, List<PsiFile>>): Map<String, List<PsiFile>> by layouts
|
||||
class AndroidModuleData(val module: AndroidModule, private val variants: List<AndroidVariantData>): Iterable<AndroidVariantData> by variants {
|
||||
companion object {
|
||||
val EMPTY = AndroidModuleData(AndroidModule("android", listOf()), listOf())
|
||||
}
|
||||
}
|
||||
|
||||
public abstract val androidModuleInfo: AndroidModuleInfo?
|
||||
abstract class AndroidLayoutXmlFileManager(val project: Project) {
|
||||
|
||||
public abstract val androidModule: AndroidModule?
|
||||
|
||||
public open fun propertyToXmlAttributes(property: KtProperty): List<PsiElement> = listOf()
|
||||
|
||||
public fun getLayoutXmlFiles(): Map<String, List<PsiFile>> {
|
||||
val info = androidModuleInfo ?: return mapOf()
|
||||
public fun getLayoutXmlFiles(): AndroidModuleData {
|
||||
val androidModule = androidModule ?: return AndroidModuleData.EMPTY
|
||||
return AndroidModuleData(androidModule, androidModule.variants.map { getVariantData(it) })
|
||||
}
|
||||
|
||||
public fun getVariantData(variant: AndroidVariant): AndroidVariantData {
|
||||
val psiManager = PsiManager.getInstance(project)
|
||||
val fileManager = VirtualFileManager.getInstance()
|
||||
|
||||
@@ -53,11 +63,11 @@ public abstract class AndroidLayoutXmlFileManager(val project: Project) {
|
||||
return allChildren
|
||||
}
|
||||
|
||||
val resDirectories = info.resDirectories.map { fileManager.findFileByUrl("file://$it") }
|
||||
val resDirectories = variant.resDirectories.map { fileManager.findFileByUrl("file://$it") }
|
||||
val allChildren = resDirectories.flatMap { it?.getAllChildren() ?: listOf() }
|
||||
|
||||
val allLayoutFiles = allChildren.filter { it.parent.name.startsWith("layout") && it.name.toLowerCase().endsWith(".xml") }
|
||||
val allLayoutPsiFiles = allLayoutFiles.fold(ArrayList<PsiFile>(allLayoutFiles.size())) { list, file ->
|
||||
val allLayoutPsiFiles = allLayoutFiles.fold(ArrayList<PsiFile>(allLayoutFiles.size)) { list, file ->
|
||||
val psiFile = psiManager.findFile(file)
|
||||
if (psiFile != null && psiFile.parent != null) {
|
||||
list += psiFile
|
||||
@@ -67,9 +77,9 @@ public abstract class AndroidLayoutXmlFileManager(val project: Project) {
|
||||
|
||||
val layoutNameToXmlFiles = allLayoutPsiFiles
|
||||
.groupBy { it.name.substringBeforeLast('.') }
|
||||
.mapValues { it.getValue().sortedBy { it.parent!!.name.length() } }
|
||||
.mapValues { it.value.sortedBy { it.parent!!.name.length } }
|
||||
|
||||
return layoutNameToXmlFiles
|
||||
return AndroidVariantData(variant, layoutNameToXmlFiles)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
+3
-32
@@ -17,23 +17,16 @@
|
||||
package org.jetbrains.kotlin.android.synthetic.res
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.kotlin.android.synthetic.toMap
|
||||
import org.xml.sax.Attributes
|
||||
import org.xml.sax.helpers.DefaultHandler
|
||||
import java.io.File
|
||||
import java.io.FileInputStream
|
||||
import javax.xml.parsers.SAXParser
|
||||
import javax.xml.parsers.SAXParserFactory
|
||||
|
||||
public class CliAndroidLayoutXmlFileManager(
|
||||
project: Project,
|
||||
private val manifestPath: String,
|
||||
private val resDirectories: List<String>
|
||||
private val applicationPackage: String,
|
||||
private val variants: List<AndroidVariant>
|
||||
) : AndroidLayoutXmlFileManager(project) {
|
||||
|
||||
override val androidModuleInfo by lazy {
|
||||
AndroidModuleInfo(getApplicationPackage(manifestPath), resDirectories)
|
||||
}
|
||||
override val androidModule by lazy { AndroidModule(applicationPackage, variants) }
|
||||
|
||||
val saxParser: SAXParser = initSAX()
|
||||
|
||||
@@ -43,26 +36,4 @@ public class CliAndroidLayoutXmlFileManager(
|
||||
return saxFactory.newSAXParser()
|
||||
}
|
||||
|
||||
private fun getApplicationPackage(manifestPath: String): String {
|
||||
try {
|
||||
val manifestXml = File(manifestPath)
|
||||
var applicationPackage: String = ""
|
||||
try {
|
||||
saxParser.parse(FileInputStream(manifestXml), object : DefaultHandler() {
|
||||
override fun startElement(uri: String, localName: String, qName: String, attributes: Attributes) {
|
||||
if (localName == "manifest")
|
||||
applicationPackage = attributes.toMap()["package"] ?: ""
|
||||
}
|
||||
})
|
||||
}
|
||||
catch (e: Exception) {
|
||||
throw e
|
||||
}
|
||||
return applicationPackage
|
||||
}
|
||||
catch (e: Exception) {
|
||||
throw SyntheticFileGenerator.NoAndroidManifestFound()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
-3
@@ -20,17 +20,17 @@ import com.intellij.openapi.diagnostic.Logger
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.PsiElementFinder
|
||||
import com.intellij.psi.PsiFile
|
||||
import java.io.ByteArrayInputStream
|
||||
import com.intellij.psi.impl.PsiElementFinderImpl
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import org.jetbrains.kotlin.android.synthetic.AndroidConst
|
||||
import org.jetbrains.kotlin.android.synthetic.AndroidXmlHandler
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import java.io.ByteArrayInputStream
|
||||
|
||||
public open class CliSyntheticFileGenerator(
|
||||
project: Project,
|
||||
private val manifestPath: String,
|
||||
private val resDirectories: List<String>
|
||||
private val variants: List<AndroidVariant>
|
||||
) : SyntheticFileGenerator(project) {
|
||||
|
||||
private val cachedJetFiles by lazy {
|
||||
@@ -40,7 +40,7 @@ public open class CliSyntheticFileGenerator(
|
||||
}
|
||||
|
||||
override val layoutXmlFileManager: CliAndroidLayoutXmlFileManager by lazy {
|
||||
CliAndroidLayoutXmlFileManager(project, manifestPath, resDirectories)
|
||||
CliAndroidLayoutXmlFileManager(project, manifestPath, variants)
|
||||
}
|
||||
|
||||
public override fun getSyntheticFiles(): List<KtFile> = cachedJetFiles
|
||||
|
||||
+48
-21
@@ -47,16 +47,18 @@ public abstract class SyntheticFileGenerator(protected val project: Project) {
|
||||
protected open fun generateSyntheticFiles(generateCommonFiles: Boolean, supportV4: Boolean): List<AndroidSyntheticFile> {
|
||||
val commonFiles = if (generateCommonFiles) generateCommonFiles(supportV4) else listOf()
|
||||
|
||||
return layoutXmlFileManager.getLayoutXmlFiles().flatMap { entry ->
|
||||
val files = entry.getValue()
|
||||
val resources = extractLayoutResources(files)
|
||||
return layoutXmlFileManager.getLayoutXmlFiles().flatMap { variantData ->
|
||||
variantData.flatMap { entry ->
|
||||
val files = entry.value
|
||||
val resources = extractLayoutResources(files)
|
||||
|
||||
val layoutName = entry.getKey()
|
||||
val layoutName = entry.key
|
||||
|
||||
val mainLayoutFile = renderMainLayoutFile(layoutName, resources, supportV4)
|
||||
val viewLayoutFile = renderViewLayoutFile(layoutName, resources)
|
||||
|
||||
listOf(mainLayoutFile, viewLayoutFile)
|
||||
arrayListOf<AndroidSyntheticFile>().apply {
|
||||
this += renderMainLayoutFiles(variantData.variant, layoutName, resources, supportV4)
|
||||
this += renderViewLayoutFiles(variantData.variant, layoutName, resources)
|
||||
}
|
||||
}
|
||||
}.filterNotNull() + commonFiles
|
||||
}
|
||||
|
||||
@@ -79,34 +81,59 @@ public abstract class SyntheticFileGenerator(protected val project: Project) {
|
||||
|
||||
protected abstract fun checkIfClassExist(fqName: String): Boolean
|
||||
|
||||
private fun renderMainLayoutFile(layoutName: String, resources: List<AndroidResource>, supportV4: Boolean): AndroidSyntheticFile {
|
||||
return renderLayoutFile(layoutName + AndroidConst.LAYOUT_POSTFIX, escapeAndroidIdentifier(layoutName), resources) {
|
||||
private fun renderMainLayoutFiles(
|
||||
variant: AndroidVariant,
|
||||
layoutName: String,
|
||||
resources: List<AndroidResource>,
|
||||
supportV4: Boolean
|
||||
): List<AndroidSyntheticFile> {
|
||||
return renderLayoutFile(variant, layoutName + AndroidConst.LAYOUT_POSTFIX, escapeAndroidIdentifier(layoutName), resources) {
|
||||
val properties = it.mainProperties.toArrayList()
|
||||
if (supportV4) properties.addAll(it.mainPropertiesForSupportV4)
|
||||
properties
|
||||
}
|
||||
}
|
||||
|
||||
private fun renderViewLayoutFile(layoutName: String, resources: List<AndroidResource>): AndroidSyntheticFile {
|
||||
return renderLayoutFile(layoutName + AndroidConst.VIEW_LAYOUT_POSTFIX,
|
||||
private fun renderViewLayoutFiles(
|
||||
variant: AndroidVariant,
|
||||
layoutName: String,
|
||||
resources: List<AndroidResource>
|
||||
): List<AndroidSyntheticFile> {
|
||||
return renderLayoutFile(variant, layoutName + AndroidConst.VIEW_LAYOUT_POSTFIX,
|
||||
escapeAndroidIdentifier(layoutName) + ".view", resources) { it.viewProperties }
|
||||
}
|
||||
|
||||
private fun renderLayoutFile(
|
||||
variant: AndroidVariant,
|
||||
filename: String,
|
||||
packageSegment: String,
|
||||
layoutName: String,
|
||||
resources: List<AndroidResource>,
|
||||
properties: (AndroidResource) -> List<Pair<String, String>>): AndroidSyntheticFile {
|
||||
return renderSyntheticFile(filename) {
|
||||
writePackage(AndroidConst.SYNTHETIC_PACKAGE + "." + packageSegment)
|
||||
writeAndroidImports()
|
||||
properties: (AndroidResource) -> List<Pair<String, String>>): List<AndroidSyntheticFile> {
|
||||
fun render(defaultVariant: Boolean = false): AndroidSyntheticFile {
|
||||
val fullFilename = (if (defaultVariant) "" else "${variant.name}_") + filename
|
||||
return renderSyntheticFile(fullFilename) {
|
||||
val packageName = if (defaultVariant)
|
||||
AndroidConst.SYNTHETIC_PACKAGE + "." + layoutName
|
||||
else
|
||||
AndroidConst.SYNTHETIC_PACKAGE + '.' + variant.name + '.' + layoutName
|
||||
|
||||
for (res in resources) {
|
||||
properties(res).forEach { property ->
|
||||
writeSyntheticProperty(property.first, res, property.second)
|
||||
writePackage(packageName)
|
||||
writeAndroidImports()
|
||||
|
||||
for (res in resources) {
|
||||
properties(res).forEach { property ->
|
||||
if (defaultVariant) {
|
||||
val deprecatedText = "Use the property from the 'main' variant instead"
|
||||
val import = AndroidConst.SYNTHETIC_PACKAGE + '.' + variant.name + '.' + layoutName + '.' + res.id
|
||||
writeText("@Deprecated(\"$deprecatedText\", ReplaceWith(\"${res.id}\", \"$import\"))")
|
||||
}
|
||||
writeSyntheticProperty(property.first, res, property.second)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return if (variant.isMainVariant) listOf(render(), render(true)) else listOf(render())
|
||||
}
|
||||
|
||||
private fun renderSyntheticFile(filename: String, init: KotlinStringWriter.() -> Unit): AndroidSyntheticFile {
|
||||
@@ -199,7 +226,7 @@ public abstract class SyntheticFileGenerator(protected val project: Project) {
|
||||
|
||||
protected fun generateSyntheticJetFiles(files: List<AndroidSyntheticFile>): List<KtFile> {
|
||||
val psiManager = PsiManager.getInstance(project)
|
||||
val applicationPackage = layoutXmlFileManager.androidModuleInfo?.applicationPackage
|
||||
val applicationPackage = layoutXmlFileManager.androidModule?.applicationPackage
|
||||
|
||||
return files.mapIndexed { index, syntheticFile ->
|
||||
val fileName = AndroidConst.SYNTHETIC_FILENAME_PREFIX + syntheticFile.name + ".kt"
|
||||
|
||||
+10
-4
@@ -18,13 +18,19 @@ package org.jetbrains.kotlin.android.synthetic.res
|
||||
|
||||
import org.jetbrains.kotlin.android.synthetic.AndroidConst
|
||||
|
||||
public class AndroidModuleInfo(val applicationPackage: String, resDirectories: List<String>) {
|
||||
class AndroidVariant(val name: String, val resDirectories: List<String>) {
|
||||
val packageName: String = name
|
||||
val isMainVariant: Boolean
|
||||
get() = name == "main"
|
||||
|
||||
override fun equals(other: Any?) = other is AndroidModuleInfo && applicationPackage == other.applicationPackage
|
||||
companion object {
|
||||
fun createMainVariant(resDirectories: List<String>) = AndroidVariant("main", resDirectories)
|
||||
}
|
||||
}
|
||||
|
||||
public class AndroidModule(val applicationPackage: String, val variants: List<AndroidVariant>) {
|
||||
override fun equals(other: Any?) = other is AndroidModule && applicationPackage == other.applicationPackage
|
||||
override fun hashCode() = applicationPackage.hashCode()
|
||||
|
||||
val resDirectories = resDirectories.sorted()
|
||||
}
|
||||
|
||||
public abstract class AndroidResource(val id: String) {
|
||||
|
||||
Vendored
+8
@@ -2,27 +2,35 @@ package kotlinx.android.synthetic.`get`
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("item_detail_container", "kotlinx.android.synthetic.main.`get`.item_detail_container"))
|
||||
val android.app.Activity.item_detail_container: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("item_detail_container", "kotlinx.android.synthetic.main.`get`.item_detail_container"))
|
||||
val android.app.Fragment.item_detail_container: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = getView().findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("textView1", "kotlinx.android.synthetic.main.`get`.textView1"))
|
||||
val android.app.Activity.textView1: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("textView1", "kotlinx.android.synthetic.main.`get`.textView1"))
|
||||
val android.app.Fragment.textView1: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = getView().findViewById(0) as? android.widget.TextView
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("password", "kotlinx.android.synthetic.main.`get`.password"))
|
||||
val android.app.Activity.password: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = findViewById(0) as? android.widget.EditText
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("password", "kotlinx.android.synthetic.main.`get`.password"))
|
||||
val android.app.Fragment.password: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = getView().findViewById(0) as? android.widget.EditText
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("login", "kotlinx.android.synthetic.main.`get`.login"))
|
||||
val android.app.Activity.login: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("login", "kotlinx.android.synthetic.main.`get`.login"))
|
||||
val android.app.Fragment.login: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = getView().findViewById(0) as? android.widget.Button
|
||||
|
||||
|
||||
Vendored
+4
@@ -2,15 +2,19 @@ package kotlinx.android.synthetic.`get`.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("item_detail_container", "kotlinx.android.synthetic.main.`get`.view.item_detail_container"))
|
||||
val android.view.View.item_detail_container: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("textView1", "kotlinx.android.synthetic.main.`get`.view.textView1"))
|
||||
val android.view.View.textView1: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("password", "kotlinx.android.synthetic.main.`get`.view.password"))
|
||||
val android.view.View.password: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = findViewById(0) as? android.widget.EditText
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("login", "kotlinx.android.synthetic.main.`get`.view.login"))
|
||||
val android.view.View.login: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package kotlinx.android.synthetic.main.`get`
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
val android.app.Activity.item_detail_container: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
val android.app.Fragment.item_detail_container: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = getView().findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
val android.app.Activity.textView1: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
val android.app.Fragment.textView1: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = getView().findViewById(0) as? android.widget.TextView
|
||||
|
||||
val android.app.Activity.password: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = findViewById(0) as? android.widget.EditText
|
||||
|
||||
val android.app.Fragment.password: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = getView().findViewById(0) as? android.widget.EditText
|
||||
|
||||
val android.app.Activity.login: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
val android.app.Fragment.login: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = getView().findViewById(0) as? android.widget.Button
|
||||
|
||||
plugins/android-compiler-plugin/testData/android/converter/simple/escapedLayoutName/main_get_VIEW.kt
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
package kotlinx.android.synthetic.main.`get`.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
val android.view.View.item_detail_container: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
val android.view.View.textView1: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
val android.view.View.password: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = findViewById(0) as? android.widget.EditText
|
||||
|
||||
val android.view.View.login: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
package kotlinx.android.synthetic.main.test
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
val android.app.Activity.MyKeyboardView: ft<android.inputmethodservice.KeyboardView, android.inputmethodservice.KeyboardView?>
|
||||
get() = findViewById(0) as? android.inputmethodservice.KeyboardView
|
||||
|
||||
val android.app.Fragment.MyKeyboardView: ft<android.inputmethodservice.KeyboardView, android.inputmethodservice.KeyboardView?>
|
||||
get() = getView().findViewById(0) as? android.inputmethodservice.KeyboardView
|
||||
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
package kotlinx.android.synthetic.main.test.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
val android.view.View.MyKeyboardView: ft<android.inputmethodservice.KeyboardView, android.inputmethodservice.KeyboardView?>
|
||||
get() = findViewById(0) as? android.inputmethodservice.KeyboardView
|
||||
|
||||
Vendored
+2
@@ -2,9 +2,11 @@ package kotlinx.android.synthetic.test
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("MyKeyboardView", "kotlinx.android.synthetic.main.test.MyKeyboardView"))
|
||||
val android.app.Activity.MyKeyboardView: ft<android.inputmethodservice.KeyboardView, android.inputmethodservice.KeyboardView?>
|
||||
get() = findViewById(0) as? android.inputmethodservice.KeyboardView
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("MyKeyboardView", "kotlinx.android.synthetic.main.test.MyKeyboardView"))
|
||||
val android.app.Fragment.MyKeyboardView: ft<android.inputmethodservice.KeyboardView, android.inputmethodservice.KeyboardView?>
|
||||
get() = getView().findViewById(0) as? android.inputmethodservice.KeyboardView
|
||||
|
||||
|
||||
Vendored
+1
@@ -2,6 +2,7 @@ package kotlinx.android.synthetic.test.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("MyKeyboardView", "kotlinx.android.synthetic.main.test.view.MyKeyboardView"))
|
||||
val android.view.View.MyKeyboardView: ft<android.inputmethodservice.KeyboardView, android.inputmethodservice.KeyboardView?>
|
||||
get() = findViewById(0) as? android.inputmethodservice.KeyboardView
|
||||
|
||||
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
package kotlinx.android.synthetic.main.test
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
val android.app.Activity.MyKeyboardView: ft<android.inputmethodservice.KeyboardView, android.inputmethodservice.KeyboardView?>
|
||||
get() = findViewById(0) as? android.inputmethodservice.KeyboardView
|
||||
|
||||
val android.app.Fragment.MyKeyboardView: ft<android.inputmethodservice.KeyboardView, android.inputmethodservice.KeyboardView?>
|
||||
get() = getView().findViewById(0) as? android.inputmethodservice.KeyboardView
|
||||
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
package kotlinx.android.synthetic.main.test.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
val android.view.View.MyKeyboardView: ft<android.inputmethodservice.KeyboardView, android.inputmethodservice.KeyboardView?>
|
||||
get() = findViewById(0) as? android.inputmethodservice.KeyboardView
|
||||
|
||||
Vendored
+2
@@ -2,9 +2,11 @@ package kotlinx.android.synthetic.test
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("MyKeyboardView", "kotlinx.android.synthetic.main.test.MyKeyboardView"))
|
||||
val android.app.Activity.MyKeyboardView: ft<android.inputmethodservice.KeyboardView, android.inputmethodservice.KeyboardView?>
|
||||
get() = findViewById(0) as? android.inputmethodservice.KeyboardView
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("MyKeyboardView", "kotlinx.android.synthetic.main.test.MyKeyboardView"))
|
||||
val android.app.Fragment.MyKeyboardView: ft<android.inputmethodservice.KeyboardView, android.inputmethodservice.KeyboardView?>
|
||||
get() = getView().findViewById(0) as? android.inputmethodservice.KeyboardView
|
||||
|
||||
|
||||
+1
@@ -2,6 +2,7 @@ package kotlinx.android.synthetic.test.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("MyKeyboardView", "kotlinx.android.synthetic.main.test.view.MyKeyboardView"))
|
||||
val android.view.View.MyKeyboardView: ft<android.inputmethodservice.KeyboardView, android.inputmethodservice.KeyboardView?>
|
||||
get() = findViewById(0) as? android.inputmethodservice.KeyboardView
|
||||
|
||||
|
||||
plugins/android-compiler-plugin/testData/android/converter/simple/layoutVariants/main_test_LAYOUT.kt
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
package kotlinx.android.synthetic.main.test
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
val android.app.Activity.button: ft<android.view.View, android.view.View?>
|
||||
get() = findViewById(0)
|
||||
|
||||
val android.app.Fragment.button: ft<android.view.View, android.view.View?>
|
||||
get() = getView().findViewById(0)
|
||||
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
package kotlinx.android.synthetic.main.test.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
val android.view.View.button: ft<android.view.View, android.view.View?>
|
||||
get() = findViewById(0)
|
||||
|
||||
Vendored
+2
@@ -2,9 +2,11 @@ package kotlinx.android.synthetic.test
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("button", "kotlinx.android.synthetic.main.test.button"))
|
||||
val android.app.Activity.button: ft<android.view.View, android.view.View?>
|
||||
get() = findViewById(0)
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("button", "kotlinx.android.synthetic.main.test.button"))
|
||||
val android.app.Fragment.button: ft<android.view.View, android.view.View?>
|
||||
get() = getView().findViewById(0)
|
||||
|
||||
|
||||
Vendored
+1
@@ -2,6 +2,7 @@ package kotlinx.android.synthetic.test.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("button", "kotlinx.android.synthetic.main.test.view.button"))
|
||||
val android.view.View.button: ft<android.view.View, android.view.View?>
|
||||
get() = findViewById(0)
|
||||
|
||||
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
package kotlinx.android.synthetic.main.test1
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
val android.app.Activity.frameLayout: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
val android.app.Fragment.frameLayout: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = getView().findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
val android.app.Activity.passwordField: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
val android.app.Fragment.passwordField: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = getView().findViewById(0) as? android.widget.TextView
|
||||
|
||||
val android.app.Activity.passwordCaption: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = findViewById(0) as? android.widget.EditText
|
||||
|
||||
val android.app.Fragment.passwordCaption: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = getView().findViewById(0) as? android.widget.EditText
|
||||
|
||||
val android.app.Activity.loginButton: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
val android.app.Fragment.loginButton: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = getView().findViewById(0) as? android.widget.Button
|
||||
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
package kotlinx.android.synthetic.main.test1.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
val android.view.View.frameLayout: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
val android.view.View.passwordField: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
val android.view.View.passwordCaption: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = findViewById(0) as? android.widget.EditText
|
||||
|
||||
val android.view.View.loginButton: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
package kotlinx.android.synthetic.main.test
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
val android.app.Activity.item_detail_container: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
val android.app.Fragment.item_detail_container: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = getView().findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
val android.app.Activity.textView1: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
val android.app.Fragment.textView1: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = getView().findViewById(0) as? android.widget.TextView
|
||||
|
||||
val android.app.Activity.password: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = findViewById(0) as? android.widget.EditText
|
||||
|
||||
val android.app.Fragment.password: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = getView().findViewById(0) as? android.widget.EditText
|
||||
|
||||
val android.app.Activity.login: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
val android.app.Fragment.login: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = getView().findViewById(0) as? android.widget.Button
|
||||
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
package kotlinx.android.synthetic.main.test.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
val android.view.View.item_detail_container: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
val android.view.View.textView1: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
val android.view.View.password: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = findViewById(0) as? android.widget.EditText
|
||||
|
||||
val android.view.View.login: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
Vendored
+8
@@ -2,27 +2,35 @@ package kotlinx.android.synthetic.test1
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("frameLayout", "kotlinx.android.synthetic.main.test1.frameLayout"))
|
||||
val android.app.Activity.frameLayout: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("frameLayout", "kotlinx.android.synthetic.main.test1.frameLayout"))
|
||||
val android.app.Fragment.frameLayout: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = getView().findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("passwordField", "kotlinx.android.synthetic.main.test1.passwordField"))
|
||||
val android.app.Activity.passwordField: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("passwordField", "kotlinx.android.synthetic.main.test1.passwordField"))
|
||||
val android.app.Fragment.passwordField: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = getView().findViewById(0) as? android.widget.TextView
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("passwordCaption", "kotlinx.android.synthetic.main.test1.passwordCaption"))
|
||||
val android.app.Activity.passwordCaption: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = findViewById(0) as? android.widget.EditText
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("passwordCaption", "kotlinx.android.synthetic.main.test1.passwordCaption"))
|
||||
val android.app.Fragment.passwordCaption: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = getView().findViewById(0) as? android.widget.EditText
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("loginButton", "kotlinx.android.synthetic.main.test1.loginButton"))
|
||||
val android.app.Activity.loginButton: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("loginButton", "kotlinx.android.synthetic.main.test1.loginButton"))
|
||||
val android.app.Fragment.loginButton: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = getView().findViewById(0) as? android.widget.Button
|
||||
|
||||
|
||||
+4
@@ -2,15 +2,19 @@ package kotlinx.android.synthetic.test1.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("frameLayout", "kotlinx.android.synthetic.main.test1.view.frameLayout"))
|
||||
val android.view.View.frameLayout: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("passwordField", "kotlinx.android.synthetic.main.test1.view.passwordField"))
|
||||
val android.view.View.passwordField: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("passwordCaption", "kotlinx.android.synthetic.main.test1.view.passwordCaption"))
|
||||
val android.view.View.passwordCaption: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = findViewById(0) as? android.widget.EditText
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("loginButton", "kotlinx.android.synthetic.main.test1.view.loginButton"))
|
||||
val android.view.View.loginButton: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
|
||||
+8
@@ -2,27 +2,35 @@ package kotlinx.android.synthetic.test
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("item_detail_container", "kotlinx.android.synthetic.main.test.item_detail_container"))
|
||||
val android.app.Activity.item_detail_container: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("item_detail_container", "kotlinx.android.synthetic.main.test.item_detail_container"))
|
||||
val android.app.Fragment.item_detail_container: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = getView().findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("textView1", "kotlinx.android.synthetic.main.test.textView1"))
|
||||
val android.app.Activity.textView1: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("textView1", "kotlinx.android.synthetic.main.test.textView1"))
|
||||
val android.app.Fragment.textView1: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = getView().findViewById(0) as? android.widget.TextView
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("password", "kotlinx.android.synthetic.main.test.password"))
|
||||
val android.app.Activity.password: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = findViewById(0) as? android.widget.EditText
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("password", "kotlinx.android.synthetic.main.test.password"))
|
||||
val android.app.Fragment.password: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = getView().findViewById(0) as? android.widget.EditText
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("login", "kotlinx.android.synthetic.main.test.login"))
|
||||
val android.app.Activity.login: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("login", "kotlinx.android.synthetic.main.test.login"))
|
||||
val android.app.Fragment.login: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = getView().findViewById(0) as? android.widget.Button
|
||||
|
||||
|
||||
+4
@@ -2,15 +2,19 @@ package kotlinx.android.synthetic.test.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("item_detail_container", "kotlinx.android.synthetic.main.test.view.item_detail_container"))
|
||||
val android.view.View.item_detail_container: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("textView1", "kotlinx.android.synthetic.main.test.view.textView1"))
|
||||
val android.view.View.textView1: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("password", "kotlinx.android.synthetic.main.test.view.password"))
|
||||
val android.view.View.password: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = findViewById(0) as? android.widget.EditText
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("login", "kotlinx.android.synthetic.main.test.view.login"))
|
||||
val android.view.View.login: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
package kotlinx.android.synthetic.main.test
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package kotlinx.android.synthetic.main.test.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
package kotlinx.android.synthetic.main.test
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
val android.app.Activity.textView1: ft<android.view.View, android.view.View?>
|
||||
get() = findViewById(0)
|
||||
|
||||
val android.app.Fragment.textView1: ft<android.view.View, android.view.View?>
|
||||
get() = getView().findViewById(0)
|
||||
|
||||
val android.app.Activity.textView2: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
val android.app.Fragment.textView2: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = getView().findViewById(0) as? android.widget.TextView
|
||||
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
package kotlinx.android.synthetic.main.test.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
val android.view.View.textView1: ft<android.view.View, android.view.View?>
|
||||
get() = findViewById(0)
|
||||
|
||||
val android.view.View.textView2: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
+4
@@ -2,15 +2,19 @@ package kotlinx.android.synthetic.test
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("textView1", "kotlinx.android.synthetic.main.test.textView1"))
|
||||
val android.app.Activity.textView1: ft<android.view.View, android.view.View?>
|
||||
get() = findViewById(0)
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("textView1", "kotlinx.android.synthetic.main.test.textView1"))
|
||||
val android.app.Fragment.textView1: ft<android.view.View, android.view.View?>
|
||||
get() = getView().findViewById(0)
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("textView2", "kotlinx.android.synthetic.main.test.textView2"))
|
||||
val android.app.Activity.textView2: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("textView2", "kotlinx.android.synthetic.main.test.textView2"))
|
||||
val android.app.Fragment.textView2: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = getView().findViewById(0) as? android.widget.TextView
|
||||
|
||||
|
||||
+2
@@ -2,9 +2,11 @@ package kotlinx.android.synthetic.test.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("textView1", "kotlinx.android.synthetic.main.test.view.textView1"))
|
||||
val android.view.View.textView1: ft<android.view.View, android.view.View?>
|
||||
get() = findViewById(0)
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("textView2", "kotlinx.android.synthetic.main.test.view.textView2"))
|
||||
val android.view.View.textView2: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
|
||||
plugins/android-compiler-plugin/testData/android/converter/simple/severalResDirs/main_test_LAYOUT.kt
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
package kotlinx.android.synthetic.main.test
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
val android.app.Activity.button: ft<android.view.View, android.view.View?>
|
||||
get() = findViewById(0)
|
||||
|
||||
val android.app.Fragment.button: ft<android.view.View, android.view.View?>
|
||||
get() = getView().findViewById(0)
|
||||
|
||||
val android.app.Activity.button2: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
val android.app.Fragment.button2: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = getView().findViewById(0) as? android.widget.Button
|
||||
|
||||
val android.app.Activity.button3: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
val android.app.Fragment.button3: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = getView().findViewById(0) as? android.widget.Button
|
||||
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
package kotlinx.android.synthetic.main.test.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
val android.view.View.button: ft<android.view.View, android.view.View?>
|
||||
get() = findViewById(0)
|
||||
|
||||
val android.view.View.button2: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
val android.view.View.button3: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
Vendored
+6
@@ -2,21 +2,27 @@ package kotlinx.android.synthetic.test
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("button", "kotlinx.android.synthetic.main.test.button"))
|
||||
val android.app.Activity.button: ft<android.view.View, android.view.View?>
|
||||
get() = findViewById(0)
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("button", "kotlinx.android.synthetic.main.test.button"))
|
||||
val android.app.Fragment.button: ft<android.view.View, android.view.View?>
|
||||
get() = getView().findViewById(0)
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("button2", "kotlinx.android.synthetic.main.test.button2"))
|
||||
val android.app.Activity.button2: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("button2", "kotlinx.android.synthetic.main.test.button2"))
|
||||
val android.app.Fragment.button2: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = getView().findViewById(0) as? android.widget.Button
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("button3", "kotlinx.android.synthetic.main.test.button3"))
|
||||
val android.app.Activity.button3: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("button3", "kotlinx.android.synthetic.main.test.button3"))
|
||||
val android.app.Fragment.button3: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = getView().findViewById(0) as? android.widget.Button
|
||||
|
||||
|
||||
Vendored
+3
@@ -2,12 +2,15 @@ package kotlinx.android.synthetic.test.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("button", "kotlinx.android.synthetic.main.test.view.button"))
|
||||
val android.view.View.button: ft<android.view.View, android.view.View?>
|
||||
get() = findViewById(0)
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("button2", "kotlinx.android.synthetic.main.test.view.button2"))
|
||||
val android.view.View.button2: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("button3", "kotlinx.android.synthetic.main.test.view.button3"))
|
||||
val android.view.View.button3: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
package kotlinx.android.synthetic.main.test
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
val android.app.Activity.item_detail_container: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
val android.app.Fragment.item_detail_container: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = getView().findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
val android.app.Activity.textView1: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
val android.app.Fragment.textView1: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = getView().findViewById(0) as? android.widget.TextView
|
||||
|
||||
val android.app.Activity.password: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = findViewById(0) as? android.widget.EditText
|
||||
|
||||
val android.app.Fragment.password: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = getView().findViewById(0) as? android.widget.EditText
|
||||
|
||||
val android.app.Activity.login: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
val android.app.Fragment.login: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = getView().findViewById(0) as? android.widget.Button
|
||||
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
package kotlinx.android.synthetic.main.test.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
val android.view.View.item_detail_container: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
val android.view.View.textView1: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
val android.view.View.password: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = findViewById(0) as? android.widget.EditText
|
||||
|
||||
val android.view.View.login: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
Vendored
+8
@@ -2,27 +2,35 @@ package kotlinx.android.synthetic.test
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("item_detail_container", "kotlinx.android.synthetic.main.test.item_detail_container"))
|
||||
val android.app.Activity.item_detail_container: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("item_detail_container", "kotlinx.android.synthetic.main.test.item_detail_container"))
|
||||
val android.app.Fragment.item_detail_container: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = getView().findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("textView1", "kotlinx.android.synthetic.main.test.textView1"))
|
||||
val android.app.Activity.textView1: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("textView1", "kotlinx.android.synthetic.main.test.textView1"))
|
||||
val android.app.Fragment.textView1: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = getView().findViewById(0) as? android.widget.TextView
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("password", "kotlinx.android.synthetic.main.test.password"))
|
||||
val android.app.Activity.password: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = findViewById(0) as? android.widget.EditText
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("password", "kotlinx.android.synthetic.main.test.password"))
|
||||
val android.app.Fragment.password: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = getView().findViewById(0) as? android.widget.EditText
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("login", "kotlinx.android.synthetic.main.test.login"))
|
||||
val android.app.Activity.login: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("login", "kotlinx.android.synthetic.main.test.login"))
|
||||
val android.app.Fragment.login: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = getView().findViewById(0) as? android.widget.Button
|
||||
|
||||
|
||||
+4
@@ -2,15 +2,19 @@ package kotlinx.android.synthetic.test.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("item_detail_container", "kotlinx.android.synthetic.main.test.view.item_detail_container"))
|
||||
val android.view.View.item_detail_container: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("textView1", "kotlinx.android.synthetic.main.test.view.textView1"))
|
||||
val android.view.View.textView1: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("password", "kotlinx.android.synthetic.main.test.view.password"))
|
||||
val android.view.View.password: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = findViewById(0) as? android.widget.EditText
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("login", "kotlinx.android.synthetic.main.test.view.login"))
|
||||
val android.view.View.login: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
package kotlinx.android.synthetic.main.test
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
val android.app.Activity.includeTag: ft<android.view.View, android.view.View?>
|
||||
get() = findViewById(0)
|
||||
|
||||
val android.app.Fragment.includeTag: ft<android.view.View, android.view.View?>
|
||||
get() = getView().findViewById(0)
|
||||
|
||||
val android.app.Activity.fragmentTag: ft<android.app.Fragment, android.app.Fragment?>
|
||||
get() = getFragmentManager().findFragmentById(0) as? android.app.Fragment
|
||||
|
||||
val android.app.Fragment.fragmentTag: ft<android.app.Fragment, android.app.Fragment?>
|
||||
get() = getFragmentManager().findFragmentById(0) as? android.app.Fragment
|
||||
|
||||
val android.app.Activity.`fun`: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
val android.app.Fragment.`fun`: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = getView().findViewById(0) as? android.widget.TextView
|
||||
|
||||
val android.app.Activity.`set`: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
val android.app.Fragment.`set`: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = getView().findViewById(0) as? android.widget.Button
|
||||
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
package kotlinx.android.synthetic.main.test.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
val android.view.View.includeTag: ft<android.view.View, android.view.View?>
|
||||
get() = findViewById(0)
|
||||
|
||||
val android.view.View.`fun`: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
val android.view.View.`set`: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
Vendored
+8
@@ -2,27 +2,35 @@ package kotlinx.android.synthetic.test
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("includeTag", "kotlinx.android.synthetic.main.test.includeTag"))
|
||||
val android.app.Activity.includeTag: ft<android.view.View, android.view.View?>
|
||||
get() = findViewById(0)
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("includeTag", "kotlinx.android.synthetic.main.test.includeTag"))
|
||||
val android.app.Fragment.includeTag: ft<android.view.View, android.view.View?>
|
||||
get() = getView().findViewById(0)
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("fragmentTag", "kotlinx.android.synthetic.main.test.fragmentTag"))
|
||||
val android.app.Activity.fragmentTag: ft<android.app.Fragment, android.app.Fragment?>
|
||||
get() = getFragmentManager().findFragmentById(0) as? android.app.Fragment
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("fragmentTag", "kotlinx.android.synthetic.main.test.fragmentTag"))
|
||||
val android.app.Fragment.fragmentTag: ft<android.app.Fragment, android.app.Fragment?>
|
||||
get() = getFragmentManager().findFragmentById(0) as? android.app.Fragment
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("`fun`", "kotlinx.android.synthetic.main.test.`fun`"))
|
||||
val android.app.Activity.`fun`: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("`fun`", "kotlinx.android.synthetic.main.test.`fun`"))
|
||||
val android.app.Fragment.`fun`: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = getView().findViewById(0) as? android.widget.TextView
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("`set`", "kotlinx.android.synthetic.main.test.`set`"))
|
||||
val android.app.Activity.`set`: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("`set`", "kotlinx.android.synthetic.main.test.`set`"))
|
||||
val android.app.Fragment.`set`: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = getView().findViewById(0) as? android.widget.Button
|
||||
|
||||
|
||||
+3
@@ -2,12 +2,15 @@ package kotlinx.android.synthetic.test.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("includeTag", "kotlinx.android.synthetic.main.test.view.includeTag"))
|
||||
val android.view.View.includeTag: ft<android.view.View, android.view.View?>
|
||||
get() = findViewById(0)
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("`fun`", "kotlinx.android.synthetic.main.test.view.`fun`"))
|
||||
val android.view.View.`fun`: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("`set`", "kotlinx.android.synthetic.main.test.view.`set`"))
|
||||
val android.view.View.`set`: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package kotlinx.android.synthetic.main.test
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
val android.app.Activity.item_detail_container: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
val android.app.Fragment.item_detail_container: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = getView().findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
val android.support.v4.app.Fragment.item_detail_container: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = getView().findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
val android.app.Activity.textView1: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
val android.app.Fragment.textView1: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = getView().findViewById(0) as? android.widget.TextView
|
||||
|
||||
val android.support.v4.app.Fragment.textView1: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = getView().findViewById(0) as? android.widget.TextView
|
||||
|
||||
val android.app.Activity.password: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = findViewById(0) as? android.widget.EditText
|
||||
|
||||
val android.app.Fragment.password: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = getView().findViewById(0) as? android.widget.EditText
|
||||
|
||||
val android.support.v4.app.Fragment.password: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = getView().findViewById(0) as? android.widget.EditText
|
||||
|
||||
val android.app.Activity.login: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
val android.app.Fragment.login: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = getView().findViewById(0) as? android.widget.Button
|
||||
|
||||
val android.support.v4.app.Fragment.login: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = getView().findViewById(0) as? android.widget.Button
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package kotlinx.android.synthetic.main.test.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
val android.view.View.item_detail_container: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
val android.view.View.textView1: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
val android.view.View.password: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = findViewById(0) as? android.widget.EditText
|
||||
|
||||
val android.view.View.login: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
Vendored
+12
@@ -2,39 +2,51 @@ package kotlinx.android.synthetic.test
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("item_detail_container", "kotlinx.android.synthetic.main.test.item_detail_container"))
|
||||
val android.app.Activity.item_detail_container: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("item_detail_container", "kotlinx.android.synthetic.main.test.item_detail_container"))
|
||||
val android.app.Fragment.item_detail_container: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = getView().findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("item_detail_container", "kotlinx.android.synthetic.main.test.item_detail_container"))
|
||||
val android.support.v4.app.Fragment.item_detail_container: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = getView().findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("textView1", "kotlinx.android.synthetic.main.test.textView1"))
|
||||
val android.app.Activity.textView1: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("textView1", "kotlinx.android.synthetic.main.test.textView1"))
|
||||
val android.app.Fragment.textView1: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = getView().findViewById(0) as? android.widget.TextView
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("textView1", "kotlinx.android.synthetic.main.test.textView1"))
|
||||
val android.support.v4.app.Fragment.textView1: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = getView().findViewById(0) as? android.widget.TextView
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("password", "kotlinx.android.synthetic.main.test.password"))
|
||||
val android.app.Activity.password: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = findViewById(0) as? android.widget.EditText
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("password", "kotlinx.android.synthetic.main.test.password"))
|
||||
val android.app.Fragment.password: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = getView().findViewById(0) as? android.widget.EditText
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("password", "kotlinx.android.synthetic.main.test.password"))
|
||||
val android.support.v4.app.Fragment.password: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = getView().findViewById(0) as? android.widget.EditText
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("login", "kotlinx.android.synthetic.main.test.login"))
|
||||
val android.app.Activity.login: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("login", "kotlinx.android.synthetic.main.test.login"))
|
||||
val android.app.Fragment.login: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = getView().findViewById(0) as? android.widget.Button
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("login", "kotlinx.android.synthetic.main.test.login"))
|
||||
val android.support.v4.app.Fragment.login: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = getView().findViewById(0) as? android.widget.Button
|
||||
|
||||
|
||||
Vendored
+4
@@ -2,15 +2,19 @@ package kotlinx.android.synthetic.test.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("item_detail_container", "kotlinx.android.synthetic.main.test.view.item_detail_container"))
|
||||
val android.view.View.item_detail_container: ft<android.widget.FrameLayout, android.widget.FrameLayout?>
|
||||
get() = findViewById(0) as? android.widget.FrameLayout
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("textView1", "kotlinx.android.synthetic.main.test.view.textView1"))
|
||||
val android.view.View.textView1: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("password", "kotlinx.android.synthetic.main.test.view.password"))
|
||||
val android.view.View.password: ft<android.widget.EditText, android.widget.EditText?>
|
||||
get() = findViewById(0) as? android.widget.EditText
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("login", "kotlinx.android.synthetic.main.test.view.login"))
|
||||
val android.view.View.login: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package kotlinx.android.synthetic.main.test
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
val android.app.Activity.includeTag: ft<android.view.View, android.view.View?>
|
||||
get() = findViewById(0)
|
||||
|
||||
val android.app.Fragment.includeTag: ft<android.view.View, android.view.View?>
|
||||
get() = getView().findViewById(0)
|
||||
|
||||
val android.support.v4.app.Fragment.includeTag: ft<android.view.View, android.view.View?>
|
||||
get() = getView().findViewById(0)
|
||||
|
||||
val android.app.Activity.fragmentTag: ft<android.app.Fragment, android.app.Fragment?>
|
||||
get() = getFragmentManager().findFragmentById(0) as? android.app.Fragment
|
||||
|
||||
val android.app.Fragment.fragmentTag: ft<android.app.Fragment, android.app.Fragment?>
|
||||
get() = getFragmentManager().findFragmentById(0) as? android.app.Fragment
|
||||
|
||||
val android.support.v4.app.Fragment.fragmentTag: ft<android.support.v4.app.Fragment, android.support.v4.app.Fragment?>
|
||||
get() = getFragmentManager().findFragmentById(0) as? android.support.v4.app.Fragment
|
||||
|
||||
val android.support.v4.app.FragmentActivity.fragmentTag: ft<android.support.v4.app.Fragment, android.support.v4.app.Fragment?>
|
||||
get() = getSupportFragmentManager().findFragmentById(0) as? android.support.v4.app.Fragment
|
||||
|
||||
val android.app.Activity.`fun`: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
val android.app.Fragment.`fun`: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = getView().findViewById(0) as? android.widget.TextView
|
||||
|
||||
val android.support.v4.app.Fragment.`fun`: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = getView().findViewById(0) as? android.widget.TextView
|
||||
|
||||
val android.app.Activity.`set`: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
val android.app.Fragment.`set`: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = getView().findViewById(0) as? android.widget.Button
|
||||
|
||||
val android.support.v4.app.Fragment.`set`: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = getView().findViewById(0) as? android.widget.Button
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package kotlinx.android.synthetic.main.test.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
val android.view.View.includeTag: ft<android.view.View, android.view.View?>
|
||||
get() = findViewById(0)
|
||||
|
||||
val android.view.View.`fun`: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
val android.view.View.`set`: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
Vendored
+13
@@ -2,42 +2,55 @@ package kotlinx.android.synthetic.test
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("includeTag", "kotlinx.android.synthetic.main.test.includeTag"))
|
||||
val android.app.Activity.includeTag: ft<android.view.View, android.view.View?>
|
||||
get() = findViewById(0)
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("includeTag", "kotlinx.android.synthetic.main.test.includeTag"))
|
||||
val android.app.Fragment.includeTag: ft<android.view.View, android.view.View?>
|
||||
get() = getView().findViewById(0)
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("includeTag", "kotlinx.android.synthetic.main.test.includeTag"))
|
||||
val android.support.v4.app.Fragment.includeTag: ft<android.view.View, android.view.View?>
|
||||
get() = getView().findViewById(0)
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("fragmentTag", "kotlinx.android.synthetic.main.test.fragmentTag"))
|
||||
val android.app.Activity.fragmentTag: ft<android.app.Fragment, android.app.Fragment?>
|
||||
get() = getFragmentManager().findFragmentById(0) as? android.app.Fragment
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("fragmentTag", "kotlinx.android.synthetic.main.test.fragmentTag"))
|
||||
val android.app.Fragment.fragmentTag: ft<android.app.Fragment, android.app.Fragment?>
|
||||
get() = getFragmentManager().findFragmentById(0) as? android.app.Fragment
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("fragmentTag", "kotlinx.android.synthetic.main.test.fragmentTag"))
|
||||
val android.support.v4.app.Fragment.fragmentTag: ft<android.support.v4.app.Fragment, android.support.v4.app.Fragment?>
|
||||
get() = getFragmentManager().findFragmentById(0) as? android.support.v4.app.Fragment
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("fragmentTag", "kotlinx.android.synthetic.main.test.fragmentTag"))
|
||||
val android.support.v4.app.FragmentActivity.fragmentTag: ft<android.support.v4.app.Fragment, android.support.v4.app.Fragment?>
|
||||
get() = getSupportFragmentManager().findFragmentById(0) as? android.support.v4.app.Fragment
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("`fun`", "kotlinx.android.synthetic.main.test.`fun`"))
|
||||
val android.app.Activity.`fun`: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("`fun`", "kotlinx.android.synthetic.main.test.`fun`"))
|
||||
val android.app.Fragment.`fun`: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = getView().findViewById(0) as? android.widget.TextView
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("`fun`", "kotlinx.android.synthetic.main.test.`fun`"))
|
||||
val android.support.v4.app.Fragment.`fun`: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = getView().findViewById(0) as? android.widget.TextView
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("`set`", "kotlinx.android.synthetic.main.test.`set`"))
|
||||
val android.app.Activity.`set`: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("`set`", "kotlinx.android.synthetic.main.test.`set`"))
|
||||
val android.app.Fragment.`set`: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = getView().findViewById(0) as? android.widget.Button
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("`set`", "kotlinx.android.synthetic.main.test.`set`"))
|
||||
val android.support.v4.app.Fragment.`set`: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = getView().findViewById(0) as? android.widget.Button
|
||||
|
||||
|
||||
Vendored
+3
@@ -2,12 +2,15 @@ package kotlinx.android.synthetic.test.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("includeTag", "kotlinx.android.synthetic.main.test.view.includeTag"))
|
||||
val android.view.View.includeTag: ft<android.view.View, android.view.View?>
|
||||
get() = findViewById(0)
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("`fun`", "kotlinx.android.synthetic.main.test.view.`fun`"))
|
||||
val android.view.View.`fun`: ft<android.widget.TextView, android.widget.TextView?>
|
||||
get() = findViewById(0) as? android.widget.TextView
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("`set`", "kotlinx.android.synthetic.main.test.view.`set`"))
|
||||
val android.view.View.`set`: ft<android.widget.Button, android.widget.Button?>
|
||||
get() = findViewById(0) as? android.widget.Button
|
||||
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package kotlinx.android.synthetic.main.test
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@kotlin.internal.flexible.InvalidWidgetType("a.b.c")
|
||||
val android.app.Activity.MyView: ft<a.b.c, a.b.c?>
|
||||
get() = findViewById(0) as? a.b.c
|
||||
|
||||
@kotlin.internal.flexible.InvalidWidgetType("a.b.c")
|
||||
val android.app.Fragment.MyView: ft<a.b.c, a.b.c?>
|
||||
get() = getView().findViewById(0) as? a.b.c
|
||||
|
||||
plugins/android-compiler-plugin/testData/android/converter/simple/unresolvedFqName/main_test_VIEW.kt
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
package kotlinx.android.synthetic.main.test.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@kotlin.internal.flexible.InvalidWidgetType("a.b.c")
|
||||
val android.view.View.MyView: ft<a.b.c, a.b.c?>
|
||||
get() = findViewById(0) as? a.b.c
|
||||
|
||||
Vendored
+2
@@ -2,10 +2,12 @@ package kotlinx.android.synthetic.test
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("MyView", "kotlinx.android.synthetic.main.test.MyView"))
|
||||
@kotlin.internal.flexible.InvalidWidgetType("a.b.c")
|
||||
val android.app.Activity.MyView: ft<a.b.c, a.b.c?>
|
||||
get() = findViewById(0) as? a.b.c
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("MyView", "kotlinx.android.synthetic.main.test.MyView"))
|
||||
@kotlin.internal.flexible.InvalidWidgetType("a.b.c")
|
||||
val android.app.Fragment.MyView: ft<a.b.c, a.b.c?>
|
||||
get() = getView().findViewById(0) as? a.b.c
|
||||
|
||||
Vendored
+1
@@ -2,6 +2,7 @@ package kotlinx.android.synthetic.test.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("MyView", "kotlinx.android.synthetic.main.test.view.MyView"))
|
||||
@kotlin.internal.flexible.InvalidWidgetType("a.b.c")
|
||||
val android.view.View.MyView: ft<a.b.c, a.b.c?>
|
||||
get() = findViewById(0) as? a.b.c
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package kotlinx.android.synthetic.main.test
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@kotlin.internal.flexible.InvalidWidgetType("KeyboardView")
|
||||
val android.app.Activity.MyKeyboardView: ft<android.view.View, android.view.View?>
|
||||
get() = findViewById(0)
|
||||
|
||||
@kotlin.internal.flexible.InvalidWidgetType("KeyboardView")
|
||||
val android.app.Fragment.MyKeyboardView: ft<android.view.View, android.view.View?>
|
||||
get() = getView().findViewById(0)
|
||||
|
||||
plugins/android-compiler-plugin/testData/android/converter/simple/unresolvedWidget/main_test_VIEW.kt
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
package kotlinx.android.synthetic.main.test.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@kotlin.internal.flexible.InvalidWidgetType("KeyboardView")
|
||||
val android.view.View.MyKeyboardView: ft<android.view.View, android.view.View?>
|
||||
get() = findViewById(0)
|
||||
|
||||
Vendored
+2
@@ -2,10 +2,12 @@ package kotlinx.android.synthetic.test
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("MyKeyboardView", "kotlinx.android.synthetic.main.test.MyKeyboardView"))
|
||||
@kotlin.internal.flexible.InvalidWidgetType("KeyboardView")
|
||||
val android.app.Activity.MyKeyboardView: ft<android.view.View, android.view.View?>
|
||||
get() = findViewById(0)
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("MyKeyboardView", "kotlinx.android.synthetic.main.test.MyKeyboardView"))
|
||||
@kotlin.internal.flexible.InvalidWidgetType("KeyboardView")
|
||||
val android.app.Fragment.MyKeyboardView: ft<android.view.View, android.view.View?>
|
||||
get() = getView().findViewById(0)
|
||||
|
||||
Vendored
+1
@@ -2,6 +2,7 @@ package kotlinx.android.synthetic.test.view
|
||||
|
||||
import kotlin.internal.flexible.ft
|
||||
|
||||
@Deprecated("Use the property from the 'main' variant instead", ReplaceWith("MyKeyboardView", "kotlinx.android.synthetic.main.test.view.MyKeyboardView"))
|
||||
@kotlin.internal.flexible.InvalidWidgetType("KeyboardView")
|
||||
val android.view.View.MyKeyboardView: ft<android.view.View, android.view.View?>
|
||||
get() = findViewById(0)
|
||||
|
||||
@@ -4,7 +4,7 @@ import android.app.Activity
|
||||
import android.view.View
|
||||
import android.widget.*
|
||||
import org.my.cool.MyButton
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
|
||||
class R {
|
||||
class id {
|
||||
|
||||
@@ -4,7 +4,7 @@ import android.app.Activity
|
||||
import android.view.View
|
||||
import android.widget.*
|
||||
import org.my.cool.MyButton
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
|
||||
class R {
|
||||
class id {
|
||||
|
||||
@@ -4,7 +4,7 @@ import android.app.Activity
|
||||
import android.view.View
|
||||
import android.widget.*
|
||||
import org.my.cool.MyButton
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
|
||||
class R {
|
||||
class id {
|
||||
|
||||
@@ -4,7 +4,7 @@ import android.app.Activity
|
||||
import android.view.View
|
||||
import android.widget.*
|
||||
import org.my.cool.MyButton
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
|
||||
class R {
|
||||
class id {
|
||||
|
||||
@@ -6,7 +6,7 @@ import android.content.Context
|
||||
import android.view.View
|
||||
import android.widget.*
|
||||
import org.my.cool.MyButton
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
|
||||
class R {
|
||||
class id {
|
||||
|
||||
@@ -6,7 +6,7 @@ import android.content.Context
|
||||
import android.view.View
|
||||
import android.widget.*
|
||||
import org.my.cool.MyButton
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
|
||||
class R {
|
||||
class id {
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.myapp
|
||||
import android.app.Activity
|
||||
import android.view.View
|
||||
import android.widget.*
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.layout1.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
import kotlinx.android.synthetic.main.layout1.*
|
||||
|
||||
class R {
|
||||
class id {
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.myapp
|
||||
import android.app.Activity
|
||||
import android.view.View
|
||||
import android.widget.*
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.layout1.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
import kotlinx.android.synthetic.main.layout1.*
|
||||
|
||||
class R {
|
||||
class id {
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.myapp
|
||||
import android.app.Activity
|
||||
import android.view.View
|
||||
import android.widget.*
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
|
||||
class R {
|
||||
class id {
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.myapp
|
||||
import android.app.Activity
|
||||
import android.view.View
|
||||
import android.widget.*
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
|
||||
class R {
|
||||
class id {
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.myapp
|
||||
import android.app.Activity
|
||||
import android.view.View
|
||||
import android.widget.*
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.layout.view.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
import kotlinx.android.synthetic.main.layout.view.*
|
||||
|
||||
class R {
|
||||
class id {
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.myapp
|
||||
import android.app.Activity
|
||||
import android.view.View
|
||||
import android.widget.*
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.layout.view.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
import kotlinx.android.synthetic.main.layout.view.*
|
||||
|
||||
class R {
|
||||
class id {
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package com.myapp
|
||||
|
||||
import android.app.Activity
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
|
||||
fun Activity.a() {
|
||||
val x = login
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package com.myapp
|
||||
|
||||
import android.app.Fragment
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
|
||||
fun Fragment.a() {
|
||||
val x = login
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package com.myapp
|
||||
import android.app.Activity
|
||||
import android.os.Bundle
|
||||
import java.io.File
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
|
||||
public class MyActivity : Activity() {
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package com.myapp
|
||||
import android.app.Fragment
|
||||
import android.os.Bundle
|
||||
import java.io.File
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
|
||||
public class MyFragment : Fragment()
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package com.myapp
|
||||
|
||||
import android.view.View
|
||||
import kotlinx.android.synthetic.layout.view.*
|
||||
import kotlinx.android.synthetic.main.layout.view.*
|
||||
|
||||
fun View.a() {
|
||||
val x = login
|
||||
|
||||
Vendored
+1
-1
@@ -1,7 +1,7 @@
|
||||
package com.myapp
|
||||
|
||||
import android.app.Activity
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
|
||||
class MyActivity: Activity() {
|
||||
val button = this.MyButton
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package com.myapp
|
||||
|
||||
import android.app.Fragment
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
|
||||
class MyFragment: Fragment() {
|
||||
val button = this.MyButton
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package com.myapp
|
||||
|
||||
import android.app.Activity
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
|
||||
class MyActivity: Activity() {
|
||||
val button = this.MyButton
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package com.myapp
|
||||
|
||||
import android.app.Fragment
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
|
||||
class MyFragment: Fragment() {
|
||||
val button = this.MyButton
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package com.myapp
|
||||
|
||||
import android.app.Activity
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.layout1.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
import kotlinx.android.synthetic.main.layout1.*
|
||||
|
||||
class MyActivity: Activity() {
|
||||
val button = this.login
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@ package com.myapp
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.Fragment
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.layout1.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
import kotlinx.android.synthetic.main.layout1.*
|
||||
|
||||
class MyActivity: Activity() {
|
||||
val button = this.login
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package com.myapp
|
||||
|
||||
import android.app.Fragment
|
||||
import java.io.File
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
|
||||
public class MyFragment : Fragment() {
|
||||
init {login}
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package com.myapp
|
||||
import android.app.Activity
|
||||
import android.os.Bundle
|
||||
import java.io.File
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
|
||||
public class MyActivity : Activity() {
|
||||
init {login}
|
||||
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@ package com.myapp
|
||||
|
||||
import android.app.Fragment
|
||||
import java.io.File
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
|
||||
public class MyFragment : Fragment() {
|
||||
init {login}
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import android.app.Activity
|
||||
import android.app.Fragment
|
||||
import android.os.Bundle
|
||||
import java.io.File
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
|
||||
public class MyActivity : Activity() {
|
||||
init { fragm }
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package com.myapp
|
||||
|
||||
import android.view.View
|
||||
import android.app.Activity
|
||||
import kotlinx.android.synthetic.layout.view.*
|
||||
import kotlinx.android.synthetic.main.layout.view.*
|
||||
|
||||
public class MyActivity : Activity() {
|
||||
init { View(this).login }
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import android.app.Activity
|
||||
import android.view.View
|
||||
import android.os.Bundle
|
||||
import java.io.File
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
|
||||
open class Fragment {
|
||||
open fun getActivity(): Activity = throw Exception("Function getActivity() is not overridden")
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package android.support.v4.app
|
||||
import android.app.Activity
|
||||
import android.view.View
|
||||
import java.io.File
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
|
||||
open class Fragment {
|
||||
open fun getActivity(): Activity = throw Exception("Function getActivity() is not overridden")
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package android.support.v4.app
|
||||
import android.app.Activity
|
||||
import android.os.Bundle
|
||||
import java.io.File
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
|
||||
open class FragmentManager {
|
||||
open fun findFragmentById(id: Int): Fragment = throw Exception("Function getFragmentById() is not overriden")
|
||||
|
||||
+11
-5
@@ -24,9 +24,7 @@ import org.jetbrains.kotlin.test.ConfigurationKind
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.TestJdkKind
|
||||
import java.io.File
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertNotNull
|
||||
import kotlin.test.fail
|
||||
|
||||
public abstract class AbstractAndroidXml2KConversionTest : UsefulTestCase() {
|
||||
|
||||
@@ -39,13 +37,21 @@ public abstract class AbstractAndroidXml2KConversionTest : UsefulTestCase() {
|
||||
val parser = CliSyntheticFileGeneratorForConversionTest(
|
||||
jetCoreEnvironment.project, File(testDirectory.parentFile, "AndroidManifest.xml").path, layoutPaths, supportV4)
|
||||
|
||||
val actual = parser.gen().toMap { it.name }
|
||||
val actual = parser.gen().toMapBy { it.name }
|
||||
|
||||
val expectedLayoutFiles = testDirectory
|
||||
.listFiles { it.isFile && it.name.endsWith(".kt") }
|
||||
?.toMap { it.name.substringBefore(".kt") } ?: mapOf()
|
||||
?.toMapBy { it.name.substringBefore(".kt") } ?: mapOf()
|
||||
|
||||
assertEquals(expectedLayoutFiles.size(), actual.size())
|
||||
if (expectedLayoutFiles.size == 0 && actual.size > 0) {
|
||||
for (file in actual) {
|
||||
val syntheticFile = file.value
|
||||
File(testDirectory, syntheticFile.name + ".kt").writeText(syntheticFile.contents)
|
||||
}
|
||||
fail("No expected synthetic .kt files found, generated from actual")
|
||||
}
|
||||
|
||||
assertEquals(expectedLayoutFiles.size, actual.size)
|
||||
|
||||
for ((name, file) in expectedLayoutFiles) {
|
||||
val actualContents = actual[name]
|
||||
|
||||
+4
-3
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.android.synthetic.AndroidExtensionPropertiesComponen
|
||||
import org.jetbrains.kotlin.android.synthetic.codegen.AndroidExpressionCodegenExtension
|
||||
import org.jetbrains.kotlin.android.synthetic.codegen.AndroidOnDestroyClassBuilderInterceptorExtension
|
||||
import org.jetbrains.kotlin.android.synthetic.res.AndroidSyntheticFile
|
||||
import org.jetbrains.kotlin.android.synthetic.res.AndroidVariant
|
||||
import org.jetbrains.kotlin.android.synthetic.res.CliSyntheticFileGenerator
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||
@@ -52,7 +53,7 @@ class CliSyntheticFileGeneratorForConversionTest(
|
||||
manifestPath: String,
|
||||
resDirectories: List<String>,
|
||||
private val supportV4: Boolean
|
||||
) : CliSyntheticFileGenerator(project, manifestPath, resDirectories) {
|
||||
) : CliSyntheticFileGenerator(project, manifestPath, listOf(AndroidVariant.createMainVariant(resDirectories))) {
|
||||
|
||||
fun gen() = generateSyntheticFiles(false, supportV4)
|
||||
|
||||
@@ -67,8 +68,8 @@ fun UsefulTestCase.createAndroidTestEnvironment(
|
||||
manifestPath: String,
|
||||
supportV4: Boolean
|
||||
): KotlinCoreEnvironment {
|
||||
configuration.put(AndroidConfigurationKeys.ANDROID_RES_PATH, resPaths)
|
||||
configuration.put(AndroidConfigurationKeys.ANDROID_MANIFEST, manifestPath)
|
||||
configuration.put(AndroidConfigurationKeys.VARIANT, resPaths)
|
||||
configuration.put(AndroidConfigurationKeys.PACKAGE, manifestPath)
|
||||
|
||||
val myEnvironment = KotlinCoreEnvironment.createForTests(testRootDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES)
|
||||
val project = myEnvironment.project
|
||||
|
||||
Reference in New Issue
Block a user