Loading tools/data-binding/annotationprocessor/src/main/java/android/databinding/annotationprocessor/ProcessExpressions.java +1 −1 Original line number Diff line number Diff line Loading @@ -124,7 +124,7 @@ public class ProcessExpressions extends ProcessDataBinding.ProcessingStep { CompilerChef compilerChef = CompilerChef.createChef(resourceBundle, getWriter()); if (compilerChef.hasAnythingToGenerate()) { compilerChef.addBRVariables(mProcessBindable); compilerChef.writeViewBinderInterfaces(); compilerChef.writeViewBinderInterfaces(forLibraryModule); if (!forLibraryModule) { compilerChef.writeDbrFile(); compilerChef.writeViewBinders(); Loading tools/data-binding/compiler/src/main/java/android/databinding/tool/CompilerChef.java +3 −3 Original line number Diff line number Diff line Loading @@ -74,14 +74,14 @@ public class CompilerChef { ensureDataBinder(); for (LayoutBinder layoutBinder : mDataBinder.mLayoutBinders) { for (String variableName : layoutBinder.getUserDefinedVariables().keySet()) { bindables.addVariable(variableName, layoutBinder.getInterfaceName()); bindables.addVariable(variableName, layoutBinder.getClassName()); } } } public void writeViewBinderInterfaces() { public void writeViewBinderInterfaces(boolean isLibrary) { ensureDataBinder(); mDataBinder.writerBinderInterfaces(); mDataBinder.writerBaseClasses(isLibrary); } public void writeViewBinders() { Loading tools/data-binding/compiler/src/main/java/android/databinding/tool/DataBinder.java +12 −9 Original line number Diff line number Diff line Loading @@ -47,23 +47,26 @@ public class DataBinder { return mLayoutBinders; } public void writerBinderInterfaces() { public void writerBaseClasses(boolean isLibrary) { Set<String> writtenFiles = new HashSet<String>(); for (LayoutBinder layoutBinder : mLayoutBinders) { String interfaceName = layoutBinder.getInterfaceName(); if (writtenFiles.contains(interfaceName)) { if (isLibrary || layoutBinder.hasVariations()) { String className = layoutBinder.getClassName(); if (writtenFiles.contains(className)) { continue; } mFileWriter.writeToFile(layoutBinder.getPackage() + "." + interfaceName, layoutBinder.writeViewBinderInterface()); writtenFiles.add(interfaceName); mFileWriter.writeToFile(layoutBinder.getPackage() + "." + className, layoutBinder.writeViewBinderBaseClass()); writtenFiles.add(className); } } } public void writeBinders() { for (LayoutBinder layoutBinder : mLayoutBinders) { L.d("writing data binder %s", layoutBinder.getClassName()); mFileWriter.writeToFile(layoutBinder.getPackage() + "." + layoutBinder.getClassName(), String className = layoutBinder.getImplementationName(); L.d("writing data binder %s", className); mFileWriter.writeToFile(layoutBinder.getPackage() + "." + className, layoutBinder.writeViewBinder()); } } Loading tools/data-binding/compiler/src/main/java/android/databinding/tool/LayoutBinder.java +11 −8 Original line number Diff line number Diff line Loading @@ -155,7 +155,7 @@ public class LayoutBinder { } } public String writeViewBinderInterface() { public String writeViewBinderBaseClass() { ensureWriter(); return mWriter.writeBaseClass(); } Loading Loading @@ -190,7 +190,8 @@ public class LayoutBinder { return mBundle.getFileName(); } public String getClassName() { public String getImplementationName() { if (hasVariations()) { final String suffix; if (hasVariations()) { suffix = mBundle.getConfigName(); Loading @@ -198,10 +199,12 @@ public class LayoutBinder { suffix = ""; } return mBaseClassName + suffix + "Impl"; } else { return mBaseClassName; } } public String getInterfaceName() { public String getClassName() { return mBaseClassName; } Loading tools/data-binding/compiler/src/main/kotlin/android/databinding/tool/writer/DataBinderWriter.kt +2 −2 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ class DataBinderWriter(val pkg: String, val projectPackage: String, val classNam layoutBinders.groupBy{it.getLayoutname()}.forEach { tab("case ${it.value.first!!.getModulePackage()}.R.layout.${it.value.first!!.getLayoutname()}:") { if (it.value.size() == 1) { tab("return new ${it.value.first!!.getPackage()}.${it.value.first!!.getClassName()}(view);") tab("return ${it.value.first!!.getPackage()}.${it.value.first!!.getImplementationName()}.bind(view);") } else { // we should check the tag to decide which layout we need to inflate tab("{") { Loading @@ -36,7 +36,7 @@ class DataBinderWriter(val pkg: String, val projectPackage: String, val classNam it.value.forEach { // TODO don't use strings. not necessary tab("if (tag.equals(String.valueOf(${it.getId()}))) {") { tab("return new ${it.getPackage()}.${it.getClassName()}(view);") tab("return new ${it.getPackage()}.${it.getImplementationName()}(view);") } tab("}") } }tab("}") Loading Loading
tools/data-binding/annotationprocessor/src/main/java/android/databinding/annotationprocessor/ProcessExpressions.java +1 −1 Original line number Diff line number Diff line Loading @@ -124,7 +124,7 @@ public class ProcessExpressions extends ProcessDataBinding.ProcessingStep { CompilerChef compilerChef = CompilerChef.createChef(resourceBundle, getWriter()); if (compilerChef.hasAnythingToGenerate()) { compilerChef.addBRVariables(mProcessBindable); compilerChef.writeViewBinderInterfaces(); compilerChef.writeViewBinderInterfaces(forLibraryModule); if (!forLibraryModule) { compilerChef.writeDbrFile(); compilerChef.writeViewBinders(); Loading
tools/data-binding/compiler/src/main/java/android/databinding/tool/CompilerChef.java +3 −3 Original line number Diff line number Diff line Loading @@ -74,14 +74,14 @@ public class CompilerChef { ensureDataBinder(); for (LayoutBinder layoutBinder : mDataBinder.mLayoutBinders) { for (String variableName : layoutBinder.getUserDefinedVariables().keySet()) { bindables.addVariable(variableName, layoutBinder.getInterfaceName()); bindables.addVariable(variableName, layoutBinder.getClassName()); } } } public void writeViewBinderInterfaces() { public void writeViewBinderInterfaces(boolean isLibrary) { ensureDataBinder(); mDataBinder.writerBinderInterfaces(); mDataBinder.writerBaseClasses(isLibrary); } public void writeViewBinders() { Loading
tools/data-binding/compiler/src/main/java/android/databinding/tool/DataBinder.java +12 −9 Original line number Diff line number Diff line Loading @@ -47,23 +47,26 @@ public class DataBinder { return mLayoutBinders; } public void writerBinderInterfaces() { public void writerBaseClasses(boolean isLibrary) { Set<String> writtenFiles = new HashSet<String>(); for (LayoutBinder layoutBinder : mLayoutBinders) { String interfaceName = layoutBinder.getInterfaceName(); if (writtenFiles.contains(interfaceName)) { if (isLibrary || layoutBinder.hasVariations()) { String className = layoutBinder.getClassName(); if (writtenFiles.contains(className)) { continue; } mFileWriter.writeToFile(layoutBinder.getPackage() + "." + interfaceName, layoutBinder.writeViewBinderInterface()); writtenFiles.add(interfaceName); mFileWriter.writeToFile(layoutBinder.getPackage() + "." + className, layoutBinder.writeViewBinderBaseClass()); writtenFiles.add(className); } } } public void writeBinders() { for (LayoutBinder layoutBinder : mLayoutBinders) { L.d("writing data binder %s", layoutBinder.getClassName()); mFileWriter.writeToFile(layoutBinder.getPackage() + "." + layoutBinder.getClassName(), String className = layoutBinder.getImplementationName(); L.d("writing data binder %s", className); mFileWriter.writeToFile(layoutBinder.getPackage() + "." + className, layoutBinder.writeViewBinder()); } } Loading
tools/data-binding/compiler/src/main/java/android/databinding/tool/LayoutBinder.java +11 −8 Original line number Diff line number Diff line Loading @@ -155,7 +155,7 @@ public class LayoutBinder { } } public String writeViewBinderInterface() { public String writeViewBinderBaseClass() { ensureWriter(); return mWriter.writeBaseClass(); } Loading Loading @@ -190,7 +190,8 @@ public class LayoutBinder { return mBundle.getFileName(); } public String getClassName() { public String getImplementationName() { if (hasVariations()) { final String suffix; if (hasVariations()) { suffix = mBundle.getConfigName(); Loading @@ -198,10 +199,12 @@ public class LayoutBinder { suffix = ""; } return mBaseClassName + suffix + "Impl"; } else { return mBaseClassName; } } public String getInterfaceName() { public String getClassName() { return mBaseClassName; } Loading
tools/data-binding/compiler/src/main/kotlin/android/databinding/tool/writer/DataBinderWriter.kt +2 −2 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ class DataBinderWriter(val pkg: String, val projectPackage: String, val classNam layoutBinders.groupBy{it.getLayoutname()}.forEach { tab("case ${it.value.first!!.getModulePackage()}.R.layout.${it.value.first!!.getLayoutname()}:") { if (it.value.size() == 1) { tab("return new ${it.value.first!!.getPackage()}.${it.value.first!!.getClassName()}(view);") tab("return ${it.value.first!!.getPackage()}.${it.value.first!!.getImplementationName()}.bind(view);") } else { // we should check the tag to decide which layout we need to inflate tab("{") { Loading @@ -36,7 +36,7 @@ class DataBinderWriter(val pkg: String, val projectPackage: String, val classNam it.value.forEach { // TODO don't use strings. not necessary tab("if (tag.equals(String.valueOf(${it.getId()}))) {") { tab("return new ${it.getPackage()}.${it.getClassName()}(view);") tab("return new ${it.getPackage()}.${it.getImplementationName()}(view);") } tab("}") } }tab("}") Loading