1// Rule: UseCompoundDrawables 2// 3// Description: Checks whether the current node can be replaced by a TextView 4// using compound drawables. 5// 6// Conditions: 7// - The node is a LinearLayout 8// - The node has two children, ImageView and TextView 9// - The ImageView does not have a weight 10 11if (node.is("LinearLayout") && node.'*'.size() == 2 && node.'TextView'.size() == 1 && 12 node.'ImageView'.size() == 1 && !node.'ImageView'[0].'@android:layout_weight') { 13 analysis << "This tag and its children can be replaced by one <TextView/> and " + 14 "a compound drawable" 15} 16