diff options
author | George Mount <mount@google.com> | 2015-11-13 15:39:12 -0800 |
---|---|---|
committer | George Mount <mount@google.com> | 2015-11-13 17:07:39 -0800 |
commit | 90004de4330158be2351b9e26ba951f2ccbccfce (patch) | |
tree | 3729bbe32d20a8f0b286796591cc39d5019bad9c | |
parent | 28e7064d455e2ef9da31c817dfc05ec7405c60df (diff) | |
download | data-binding-90004de4330158be2351b9e26ba951f2ccbccfce.tar.gz |
Don't use DynamicUtil now that 1.0-rc5 has been released.
Change-Id: I017049ba3fb3c0d66982f504192d6a2814859f9a
3 files changed, 3 insertions, 30 deletions
diff --git a/compiler/src/main/java/android/databinding/annotationprocessor/ProcessDataBinding.java b/compiler/src/main/java/android/databinding/annotationprocessor/ProcessDataBinding.java index 4d1fadb3..5d563b0b 100644 --- a/compiler/src/main/java/android/databinding/annotationprocessor/ProcessDataBinding.java +++ b/compiler/src/main/java/android/databinding/annotationprocessor/ProcessDataBinding.java @@ -103,7 +103,7 @@ public class ProcessDataBinding extends AbstractProcessor { mLibraryProject = libraryProject; mMinSdk = minSdk; considerWritingMapper(); - mChef.writeDynamicUtil(); + //mChef.writeDynamicUtil(); } private void considerWritingMapper() { diff --git a/compiler/src/main/java/android/databinding/tool/expr/ResourceExpr.java b/compiler/src/main/java/android/databinding/tool/expr/ResourceExpr.java index 8ac352d7..f1cab64c 100644 --- a/compiler/src/main/java/android/databinding/tool/expr/ResourceExpr.java +++ b/compiler/src/main/java/android/databinding/tool/expr/ResourceExpr.java @@ -146,11 +146,11 @@ public class ResourceExpr extends Expr { if ("animator".equals(mResourceType)) return "android.animation.AnimatorInflater.loadAnimator(" + context + ", " + resourceName + ")"; if ("bool".equals(mResourceType)) return resources + ".getBoolean(" + resourceName + ")"; if ("color".equals(mResourceType)) return resources + ".getColor(" + resourceName + ")"; - if ("colorStateList".equals(mResourceType)) return "android.databinding.DynamicUtil.getColorStateListFromResource(getRoot(), " + resourceName + ")"; + if ("colorStateList".equals(mResourceType)) return "getColorStateListFromResource(" + resourceName + ")"; if ("dimen".equals(mResourceType)) return resources + ".getDimension(" + resourceName + ")"; if ("dimenOffset".equals(mResourceType)) return resources + ".getDimensionPixelOffset(" + resourceName + ")"; if ("dimenSize".equals(mResourceType)) return resources + ".getDimensionPixelSize(" + resourceName + ")"; - if ("drawable".equals(mResourceType)) return "android.databinding.DynamicUtil.getDrawableFromResource(getRoot(), " + resourceName + ")"; + if ("drawable".equals(mResourceType)) return "getDrawableFromResource(" + resourceName + ")"; if ("fraction".equals(mResourceType)) { String base = getChildCode(0, "1"); String pbase = getChildCode(1, "1"); diff --git a/compiler/src/main/kotlin/android/databinding/tool/writer/DynamicUtilWriter.kt b/compiler/src/main/kotlin/android/databinding/tool/writer/DynamicUtilWriter.kt index e180f956..07911e9b 100644 --- a/compiler/src/main/kotlin/android/databinding/tool/writer/DynamicUtilWriter.kt +++ b/compiler/src/main/kotlin/android/databinding/tool/writer/DynamicUtilWriter.kt @@ -3,37 +3,10 @@ package android.databinding.tool.writer; class DynamicUtilWriter() { public fun write(targetSdk : kotlin.Int) : KCode = kcode("package android.databinding;") { nl("") - nl("import android.content.res.ColorStateList;") - nl("import android.graphics.drawable.Drawable;") nl("import android.os.Build.VERSION;") nl("import android.os.Build.VERSION_CODES;") - nl("import android.view.View;") nl("") nl("public class DynamicUtil {") - tab("@SuppressWarnings(\"deprecation\")") { - nl("public static ColorStateList getColorStateListFromResource(View root, int resourceId) {") - if (targetSdk >= 23) { - tab("if (VERSION.SDK_INT >= VERSION_CODES.M) {") { - tab("return root.getContext().getColorStateList(resourceId);") - } - tab("}") - } - tab("return root.getResources().getColorStateList(resourceId);") - } - tab("}") - nl("") - - tab("@SuppressWarnings(\"deprecation\")") { - nl("public static Drawable getDrawableFromResource(View root, int resourceId) {") - if (targetSdk >= 21) { - tab("if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {") { - tab("return root.getContext().getDrawable(resourceId);") - } - tab("}") - } - tab("return root.getResources().getDrawable(resourceId);") - } - tab("}") nl("}") } }
\ No newline at end of file |