diff options
author | Romain Guy <romainguy@android.com> | 2009-10-06 16:22:58 -0700 |
---|---|---|
committer | Romain Guy <romainguy@android.com> | 2009-10-06 16:22:58 -0700 |
commit | 53daffb84c519847eb8d911657ab98dc2a72bc7f (patch) | |
tree | fda09e71cda5aeaa29cd453508d88a077c22c5da /layoutopt | |
parent | 1b77ee25c8a57b148e541a724fb86d53edbdb844 (diff) | |
download | sdk-53daffb84c519847eb8d911657ab98dc2a72bc7f.zip sdk-53daffb84c519847eb8d911657ab98dc2a72bc7f.tar.gz sdk-53daffb84c519847eb8d911657ab98dc2a72bc7f.tar.bz2 |
Fix error in InefficientWeight rule. It would wrongly assume 0dip != 0dip.
Change-Id: I2ab9b3c6b57744563c87cb8457c55afd0cbfcb57
Diffstat (limited to 'layoutopt')
-rw-r--r-- | layoutopt/libs/uix/src/resources/rules/InefficientWeight.rule | 2 | ||||
-rw-r--r-- | layoutopt/samples/inefficient_weight.xml | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/layoutopt/libs/uix/src/resources/rules/InefficientWeight.rule b/layoutopt/libs/uix/src/resources/rules/InefficientWeight.rule index 0de9350..928d7a1 100644 --- a/layoutopt/libs/uix/src/resources/rules/InefficientWeight.rule +++ b/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/layoutopt/samples/inefficient_weight.xml b/layoutopt/samples/inefficient_weight.xml index c687ed8..785350a 100644 --- a/layoutopt/samples/inefficient_weight.xml +++ b/layoutopt/samples/inefficient_weight.xml @@ -25,5 +25,20 @@ android:layout_weight="1.0" /> </LinearLayout> + + <LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + + android:layout_width="fill_parent" + android:layout_height="fill_parent" + + android:orientation="vertical"> + + <Button + android:layout_width="fill_parent" + android:layout_height="0dip" + android:layout_weight="1.0" /> + + </LinearLayout> </LinearLayout>
\ No newline at end of file |