16 lines
632 B
Plaintext
16 lines
632 B
Plaintext
// 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"]
|
|
}
|