diff options
Diffstat (limited to 'layoutopt/libs/uix/src/resources/rules/NestedScrollingWidgets.rule')
-rw-r--r-- | layoutopt/libs/uix/src/resources/rules/NestedScrollingWidgets.rule | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/layoutopt/libs/uix/src/resources/rules/NestedScrollingWidgets.rule b/layoutopt/libs/uix/src/resources/rules/NestedScrollingWidgets.rule new file mode 100644 index 0000000..15d54bc --- /dev/null +++ b/layoutopt/libs/uix/src/resources/rules/NestedScrollingWidgets.rule @@ -0,0 +1,19 @@ +// Rule: NestedScrollingWidgets +// +// Description: Checks whether a scrolling widget has nested scrolling widgets. +// +// Conditions: +// - The node is a scrolling widget +// - The node has a descendant who is also a scrolling widget + +def widgets = ["ScrollView", "ListView", "GridView"] +if (xml.name() in widgets && xml.all().any{ it.name() in widgets }) { + analysis << [node: node, description: "The vertically scrolling ${xml.name()} should " + + "not contain another vertically scrolling widget"] +} + +widgets = ["HorizontalScrollView", "Gallery"] +if (xml.name() in widgets && xml.all().any{ it.name() in widgets }) { + analysis << [node: node, description: "The horizontally scrolling ${xml.name()} should " + + "not contain another horizontally scrolling widget"] +} |