From ece784c583edbbeb56e8a74d4ddf039121d0df71 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Tue, 6 Oct 2009 16:22:58 -0700 Subject: [PATCH] Fix error in InefficientWeight rule. It would wrongly assume 0dip != 0dip. Change-Id: I2ab9b3c6b57744563c87cb8457c55afd0cbfcb57 --- .../src/resources/rules/InefficientWeight.rule | 2 +- tools/layoutopt/samples/inefficient_weight.xml | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/tools/layoutopt/libs/uix/src/resources/rules/InefficientWeight.rule b/tools/layoutopt/libs/uix/src/resources/rules/InefficientWeight.rule index 0de935072..928d7a175 100644 --- a/tools/layoutopt/libs/uix/src/resources/rules/InefficientWeight.rule +++ b/tools/layoutopt/libs/uix/src/resources/rules/InefficientWeight.rule @@ -12,7 +12,7 @@ if (parent.is("LinearLayout") && node.'@android:layout_weight' && parent.'*'.findAll{ it.'@android:layout_weight' }.size() == 1) { def dimension = parent.'@android:orientation' == "vertical" ? "android:layout_height" : "android:layout_width" - if (node."@${dimension}"[0] != 0) { + if (node."@${dimension}"[0] != '0') { analysis << "Use an ${dimension} of 0dip instead of ${node."@${dimension}"} " + "for better performance" } diff --git a/tools/layoutopt/samples/inefficient_weight.xml b/tools/layoutopt/samples/inefficient_weight.xml index c687ed84f..785350a9f 100644 --- a/tools/layoutopt/samples/inefficient_weight.xml +++ b/tools/layoutopt/samples/inefficient_weight.xml @@ -25,5 +25,20 @@ android:layout_weight="1.0" /> + + + +