Fix error in InefficientWeight rule. It would wrongly assume 0dip != 0dip.
Change-Id: I2ab9b3c6b57744563c87cb8457c55afd0cbfcb57
This commit is contained in:
@@ -12,7 +12,7 @@ if (parent.is("LinearLayout") && node.'@android:layout_weight' &&
|
|||||||
parent.'*'.findAll{ it.'@android:layout_weight' }.size() == 1) {
|
parent.'*'.findAll{ it.'@android:layout_weight' }.size() == 1) {
|
||||||
def dimension = parent.'@android:orientation' == "vertical" ?
|
def dimension = parent.'@android:orientation' == "vertical" ?
|
||||||
"android:layout_height" : "android:layout_width"
|
"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}"} " +
|
analysis << "Use an ${dimension} of 0dip instead of ${node."@${dimension}"} " +
|
||||||
"for better performance"
|
"for better performance"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,4 +26,19 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</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>
|
</LinearLayout>
|
||||||
Reference in New Issue
Block a user