Title: Extend new Fragment Scope for EBean · Issue #2214 · androidannotations/androidannotations · GitHub
Open Graph Title: Extend new Fragment Scope for EBean · Issue #2214 · androidannotations/androidannotations
X Title: Extend new Fragment Scope for EBean · Issue #2214 · androidannotations/androidannotations
Description: We resently added Fragment Scope for EBean annotated classes on #2206. Its usage right now is simply to ensure that the EBean is the same if it is injected in the same fragment scope. There is some cases of uses in which could be useful,...
Open Graph Description: We resently added Fragment Scope for EBean annotated classes on #2206. Its usage right now is simply to ensure that the EBean is the same if it is injected in the same fragment scope. There is some...
X Description: We resently added Fragment Scope for EBean annotated classes on #2206. Its usage right now is simply to ensure that the EBean is the same if it is injected in the same fragment scope. There is some...
Opengraph URL: https://github.com/androidannotations/androidannotations/issues/2214
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Extend new Fragment Scope for EBean","articleBody":"We resently added Fragment Scope for EBean annotated classes on #2206. Its usage right now is simply to ensure that the EBean is the same if it is injected in the same fragment scope. There is some cases of uses in which could be useful, though there are other cases in which its usability increases. \r\n\r\nIt is common to have fragments which contains multiple subfragments. Or to have a collection of fragments which are related in functionality. \r\n\r\nI do propose to extend the Fragment scope for this cases, for doing so, `@EBean` should support 2 extra parameters, `fragmentId`, and `fragmentTag`. This is an example of usage:\r\n\r\n```java\r\n@EBean(scope = Scope.Fragment, fragmentId = {R.id.fragment1, R.id.fragment2})\r\npublic class SomeBean {\r\n //Code\r\n}\r\n```\r\n\r\nThis will increase the usability of the new Fragment scope. You could have complete sections on the app sharing the same instance of a Bean, which is really useful. \r\n\r\nFor doing this, basically to inject the Bean, it is used exactly the same mechanism implemented on #2206, merged with a search of Fragment by ID or by Tag (similar to how the `@FragmentById` or `@FragmentByTag` work). \r\n\r\nThe fragment will be injected using the first `BeanHolder` found, so if a serie of fragmentsId is provided, the first one would be the \"holder\" of the bean. In the case of not existing the second and so on. \r\n\r\nIn cases where there is a \"parent fragment\" of course, the best is that the programmer select this parent fragment as the holder (only providing its ID to the `@EBean`) (like a fragment with a ViewPager which contains multiple other fragments). \r\n\r\nIf the parameters `fragmentId` or `fragmentTag` are not provided, then it works exactly how it is currently implemented. \r\n\r\n","author":{"url":"https://github.com/smaugho","@type":"Person","name":"smaugho"},"datePublished":"2019-02-17T15:08:35.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/2214/androidannotations/issues/2214"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a813fa1c-49d8-f506-e572-1c0344586679 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8C98:D24CA:2ECE20:3D7350:6A616197 |
| html-safe-nonce | bbf5d7842f79af715ac4165f94f2538a531c874018979274e9c39f0821d21140 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Qzk4OkQyNENBOjJFQ0UyMDozRDczNTA6NkE2MTYxOTciLCJ2aXNpdG9yX2lkIjoiNTY5MTgxMDQ3NDg1MTY1NjA4NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 733a69d9dc985cc50dd9793539d7209e53eac47a135061aff05d7352f5fbea3d |
| hovercard-subject-tag | issue:411197231 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/androidannotations/androidannotations/2214/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2bf98bf4c7b9d8e7700e20ca328b0bf92203c07050f1f74c4e3b51418f56e61c/androidannotations/androidannotations/issues/2214 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2bf98bf4c7b9d8e7700e20ca328b0bf92203c07050f1f74c4e3b51418f56e61c/androidannotations/androidannotations/issues/2214 |
| og:image:alt | We resently added Fragment Scope for EBean annotated classes on #2206. Its usage right now is simply to ensure that the EBean is the same if it is injected in the same fragment scope. There is some... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | smaugho |
| hostname | github.com |
| expected-hostname | github.com |
| None | c258d2b06b498220e3b94af28b26bbbf58f4203a6373725f779afcc867afd263 |
| turbo-cache-control | no-preview |
| go-import | github.com/androidannotations/androidannotations git https://github.com/androidannotations/androidannotations.git |
| octolytics-dimension-user_id | 1315313 |
| octolytics-dimension-user_login | androidannotations |
| octolytics-dimension-repository_id | 3116751 |
| octolytics-dimension-repository_nwo | androidannotations/androidannotations |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3116751 |
| octolytics-dimension-repository_network_root_nwo | androidannotations/androidannotations |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 5f67bc431418961e0814f1eb30a4231250e4726d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width