Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 230ecdbf authored by George Mount's avatar George Mount Committed by Yigit Boyar
Browse files

Use abstract base class instead of interfaces for Binding objects.

Bug 19627511
Bug 19709604

Changed generated classes to end with "Binding" instead of "Binder"
to avoid confusion with Android Binders.

Removed DataBinder class and moved the important aspects of its
contents to ViewDataBinding.

Improved mapping of Views in included layouts. Avoid traversing
included layouts while looking for bound expressions.

Change-Id: I1f28093b0792d5428d07192f1fc458a5b4b788b2
parent f5140a15
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
Properties databindingProperties = new Properties()
databindingProperties.load(new FileInputStream("databinding.properties"))
databindingProperties.load(new FileInputStream("${projectDir}/databinding.properties"))
databindingProperties.mavenRepoDir = "${projectDir}/${databindingProperties.mavenRepoName}"
ext.config = databindingProperties

+5 −7
Original line number Diff line number Diff line
@@ -19,14 +19,12 @@ package com.android.databinding;
import com.google.common.base.Preconditions;

import com.android.databinding.expr.Dependency;
import com.android.databinding.store.ResourceBundle;
import com.android.databinding.util.ParserHelper;
import com.android.databinding.writer.LayoutBinderWriter;
import com.android.databinding.expr.Expr;
import com.android.databinding.expr.ExprModel;
import com.android.databinding.expr.IdentifierExpr;
import com.android.databinding.expr.StaticIdentifierExpr;
import com.android.databinding.util.L;
import com.android.databinding.store.ResourceBundle;
import com.android.databinding.util.ParserHelper;
import com.android.databinding.writer.LayoutBinderWriter;

import java.util.ArrayList;
import java.util.HashMap;
@@ -60,7 +58,7 @@ public class LayoutBinder {
        mBundle = layoutBundle;
        mProjectPackage = resourceBundle.getAppPackage();
        mPackage = mProjectPackage + ".generated";
        mBaseClassName = ParserHelper.INSTANCE$.toClassName(layoutBundle.getFileName()) + "Binder";
        mBaseClassName = ParserHelper.INSTANCE$.toClassName(layoutBundle.getFileName()) + "Binding";
        // copy over data.
        for (Map.Entry<String, String> variable : mBundle.getVariables().entrySet()) {
            addVariable(variable.getKey(), variable.getValue());
@@ -144,7 +142,7 @@ public class LayoutBinder {

    public String writeViewBinderInterface() {
        ensureWriter();
        return mWriter.writeInterface();
        return mWriter.writeBaseClass();
    }


+2 −2
Original line number Diff line number Diff line
@@ -62,8 +62,8 @@ public abstract class ModelAnalyzer {
            "com.android.databinding.library.ObservableField",
    };

    public static final String I_VIEW_DATA_BINDER
            = "com.android.databinding.library.IViewDataBinder";
    public static final String VIEW_DATA_BINDING =
            "com.android.databinding.library.ViewDataBinding";

    private static ModelAnalyzer sAnalyzer;

+1 −2
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@ import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.ElementFilter;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;
import javax.tools.Diagnostic;

public class AnnotationAnalyzer extends ModelAnalyzer {

@@ -143,7 +142,7 @@ public class AnnotationAnalyzer extends ModelAnalyzer {

    private AnnotationClass getIViewDataBinderType() {
        if (mIViewDataBinderType == null) {
            mIViewDataBinderType = new AnnotationClass(findType(I_VIEW_DATA_BINDER).asType());
            mIViewDataBinderType = new AnnotationClass(findType(VIEW_DATA_BINDING).asType());
        }
        return mIViewDataBinderType;
    }
+1 −1
Original line number Diff line number Diff line
@@ -128,7 +128,7 @@ public class LayoutFileParser {
                // generated.
                String layoutName = includeValue.substring(LAYOUT_PREFIX.length());
                className = pkg + ".generated." +
                        ParserHelper.INSTANCE$.toClassName(layoutName) + "Binder";
                        ParserHelper.INSTANCE$.toClassName(layoutName) + "Binding";
                includedLayoutName = layoutName;
            } else {
                className = getFullViewClassName(nodeName);
Loading