Hello everyone, I've somewhat of a specific (not s...
# android-architecture
c
Hello everyone, I've somewhat of a specific (not sure) problem. I've a NewMenuOptionsListData data class that is for representing an item of a recyclerView, thus recyclerview adapter takes List<NewMenuOptionsListData>. In another version of the app, team had used a lambda paramater as onClick for the item, and onClick had functionality such as navigating, opening a toast or a dialog and such. I'm instead passing a navAction, and navigating inside with the navAction of the NewMenuOptionsListData. But like this, I can't allow the item to open a dialog or toast when it's pressed (lead wants to pass onClick in decleration of the data class instance). One solution, perhaps naïve one, is to pass a boolean and an onClick lambda paramater with default {}, and call both onClick and navigate in adapter. Any thoughts are appreciated.
Copy code
data class NewMenuListOptionsData(
    val itemName: Int,
    val navAction: NavAction = NavAction(
        R.id.some_action,
        null,
        Bundle().apply {
            putSerializable(
                Constants.some_constant,
                MenuListOptions.some_report.header
            ) 
        }
    ),
)
a
a
If this a domain model it is a bad idea to put Android NavActions inside it