{"action":"created","issue":{"url":"https://api.github.com/repos/googlesamples/android-architecture/issues/72","repository_url":"https://api.github.com/repos/googlesamples/android-architecture","labels_url":"https://api.github.com/repos/googlesamples/android-architecture/issues/72/labels{/name}","comments_url":"https://api.github.com/repos/googlesamples/android-architecture/issues/72/comments","events_url":"https://api.github.com/repos/googlesamples/android-architecture/issues/72/events","html_url":"https://github.com/googlesamples/android-architecture/issues/72","id":154367927,"number":72,"title":"On todo-databinding, remove logic from layout files","user":{"login":"hypest","id":1032913,"avatar_url":"https://avatars.githubusercontent.com/u/1032913?v=3","gravatar_id":"","url":"https://api.github.com/users/hypest","html_url":"https://github.com/hypest","followers_url":"https://api.github.com/users/hypest/followers","following_url":"https://api.github.com/users/hypest/following{/other_user}","gists_url":"https://api.github.com/users/hypest/gists{/gist_id}","starred_url":"https://api.github.com/users/hypest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypest/subscriptions","organizations_url":"https://api.github.com/users/hypest/orgs","repos_url":"https://api.github.com/users/hypest/repos","events_url":"https://api.github.com/users/hypest/events{/privacy}","received_events_url":"https://api.github.com/users/hypest/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-11T23:49:38Z","updated_at":"2016-05-12T09:56:42Z","closed_at":null,"body":"Hey guys, thanks for the awesome repo and the samples!\r\n\r\nNot sure if this is nitpicking or not but, even though the `databinding` lib offers quite an elaborate set of options to add logic directly into the layout files (example: [determining the visibility of an element in `statistics_frag.xml`](https://github.com/googlesamples/android-architecture/blob/todo-databinding/todoapp/app/src/main/res/layout/statistics_frag.xml#L41)) I think that _power_ should be relinquished to the Presenter since one is in place.\r\n\r\nIn essence, since the `todo-databinding` arch is based on MVP, it's probably more suitable to remove any logic from all layout files and put it in appropriate getters in the respective presenters (or ViewModels as depicted in [README.md](https://github.com/googlesamples/android-architecture/blob/todo-databinding/README.md)). Databinding will still be used in the layouts but only to _connect_ to the presenter.\r\n\r\nI could work on that goal if this gets a few 👍\r\nThanks! 😃 ❤️ "},"comment":{"url":"https://api.github.com/repos/googlesamples/android-architecture/issues/comments/218712295","html_url":"https://github.com/googlesamples/android-architecture/issues/72#issuecomment-218712295","issue_url":"https://api.github.com/repos/googlesamples/android-architecture/issues/72","id":218712295,"user":{"login":"JoseAlcerreca","id":609125,"avatar_url":"https://avatars.githubusercontent.com/u/609125?v=3","gravatar_id":"","url":"https://api.github.com/users/JoseAlcerreca","html_url":"https://github.com/JoseAlcerreca","followers_url":"https://api.github.com/users/JoseAlcerreca/followers","following_url":"https://api.github.com/users/JoseAlcerreca/following{/other_user}","gists_url":"https://api.github.com/users/JoseAlcerreca/gists{/gist_id}","starred_url":"https://api.github.com/users/JoseAlcerreca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoseAlcerreca/subscriptions","organizations_url":"https://api.github.com/users/JoseAlcerreca/orgs","repos_url":"https://api.github.com/users/JoseAlcerreca/repos","events_url":"https://api.github.com/users/JoseAlcerreca/events{/privacy}","received_events_url":"https://api.github.com/users/JoseAlcerreca/received_events","type":"User","site_admin":false},"created_at":"2016-05-12T09:56:42Z","updated_at":"2016-05-12T09:56:42Z","body":"Hey hypest,\r\n\r\nAs we wrote in the README\r\n\r\n> It's doesn't follow a strict Model-View-ViewModel or a Model-View-Presenter pattern, as it uses both View Models and Presenters.\r\n\r\nThat's why it's not called `todo-mvp-databinding`.\r\n\r\nIn this case I think the responsibilities are very well defined: the presenter loads the data, the viewmodel adapts it and the layout renders it, using very small chunks of logic. This is the idiomatic way. \r\n\r\nWe could explore a pure `todo-mvp-databinding` sample, though. You could start using this option: https://github.com/googlesamples/android-architecture/wiki/Unofficial-samples\r\n\r\nThanks!\r\n"}}