Add new rules to layoutopt: UseCompoundDrawables and UselessLayout.
Change-Id: I5dfb2567d923da8442b1df1e703e4ebca6e9523b
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
// Rule: UseCompoundDrawables
|
||||
//
|
||||
// Description: Checks whether the current node can be replaced by a TextView
|
||||
// using compound drawables.
|
||||
//
|
||||
// Conditions:
|
||||
// - The node is a LinearLayout
|
||||
// - The node has two children, ImageView and TextView
|
||||
// - The ImageView does not have a weight
|
||||
|
||||
if (xml.is("LinearLayout") && xml['*'].size() == 2 && xml.'TextView'.size() == 1 &&
|
||||
xml.'ImageView'.size() == 1 && !xml.'ImageView'.'@android:layout_weight') {
|
||||
analysis << [node: node, description: "This tag and its children can be replaced by one " +
|
||||
"<TextView/> and a compound drawable for the image"]
|
||||
}
|
||||
Reference in New Issue
Block a user