Fix error in InefficientWeight rule. It would wrongly assume 0dip != 0dip.

Change-Id: I2ab9b3c6b57744563c87cb8457c55afd0cbfcb57
This commit is contained in:
Romain Guy
2009-10-06 16:22:58 -07:00
parent b5c1840392
commit ece784c583
2 changed files with 16 additions and 1 deletions

View File

@@ -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"
}

View File

@@ -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>