Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
mobile ruleP2stack specificStack: android
androidadapterinterfacecallbacks
Pass one listener interface when a view needs several callbacks
When an adapter/view needs multiple click callbacks, define a single interface with those methods and pass one instance, instead of several separate lambdas.
PR: mobile-mining-2026-06Created: Jul 5, 2026
Bad example
Old codekotlin
| 1 | Adapter(onClose = {...}, onClearAll = {...}, onSelect = {...}) |
Explanation (EN)
Objašnjenje (HR)
Good example
New codekotlin
| 1 | interface FilterActions { fun onClose(i: Int); fun onClearAll() } |
| 2 | Adapter(actions) |
Explanation (EN)
Objašnjenje (HR)