{"id":13989150,"url":"https://github.com/MaksTuev/ferro","last_synced_at":"2025-07-22T10:31:25.572Z","repository":{"id":217314923,"uuid":"62454784","full_name":"MaksTuev/ferro","owner":"MaksTuev","description":"Simple and powerful MVP library for Android","archived":false,"fork":false,"pushed_at":"2022-10-31T19:17:24.000Z","size":1677,"stargazers_count":428,"open_issues_count":0,"forks_count":32,"subscribers_count":18,"default_branch":"master","last_synced_at":"2024-11-29T08:38:12.647Z","etag":null,"topics":["android","mvp","mvp-library","retained-fragments","rx","rxjava"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MaksTuev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-07-02T14:32:17.000Z","updated_at":"2024-04-26T00:04:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"2149c349-5d54-49ed-a914-426763e178c3","html_url":"https://github.com/MaksTuev/ferro","commit_stats":null,"previous_names":["makstuev/ferro"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/MaksTuev/ferro","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaksTuev%2Fferro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaksTuev%2Fferro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaksTuev%2Fferro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaksTuev%2Fferro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MaksTuev","download_url":"https://codeload.github.com/MaksTuev/ferro/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaksTuev%2Fferro/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266475079,"owners_count":23934877,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","mvp","mvp-library","retained-fragments","rx","rxjava"],"created_at":"2024-08-09T13:01:32.403Z","updated_at":"2025-07-22T10:31:25.514Z","avatar_url":"https://github.com/MaksTuev.png","language":"Java","funding_links":[],"categories":["Java"],"sub_categories":[],"readme":"#### ** THIS REPO IS DEPRECATED AND IS NO LONGER BEING ACTIVELY MAINTAINED **\n\nFerro evolved into modules `core-ui`, `core-mvp`, `mvp-dialog`, `mvp-widjet` [Surf Android Standard](https://github.com/surfstudio/SurfAndroidStandard/) repository (Documentation in Russian). It contains modules, which is used for developing Android projects by mobile studio [Surf](http://surfstudio.ru/).\n\n# Ferro\n\nSimple and powerful MVP library for Android \n\nFerro elegantly solves two age-old problems of Android Framework related to configuration changes:\n* restore screen's data\n* managing background tasks\n\nFirst problem is solved using permanent presenter, second - using freezing rx events (Observable doesn't unsubscribe).\nAlso new feature was added - Ferro can freeze rx event when screen becomes invisible, and defreeze it when screen goes to foreground.\n\nThe schematic work of ferro:\n\n![SchematicImage](ferro.gif)\n\nFerro is divided into 3 layers, each of one adds behavior to the previous. So you can use only part of Ferro, if you want.\n\nThe first layer:\n## ferro-core\nThis library contains base classes for Activity and Fragment (`PSSActivity, PSSFragmentV4`, PSS - persistent screen scope). For each activity and fragment, based on this classes, will be created `PersistentScreenScope`.  You can get it by calling the method `PSSActivity#getPersistentScreenScope` or `PSSFragmentV4#getPersistentScreenScope`. This object isn't destroyed when configuration changed, it is only destroyed when screen is finally destroyed (e.g. after call `Activity#finish()`). You can add listener, which will be called when `PersistentScreenScope` destroyed. It has methods for storing and getting objects.\nIn reality, `PersistentScreenScope` is actually a retained Fragment without view.\n\nThis mechanism is perfect for storing a presenter, that is done in the next extention:\n## ferro-mvp\nThis library contains base classes for view, presenter and screen component. For each screen you need to extend `ScreenComponent`, `MvpPresenter` and `MvpActivityView` or `MvpFragmentV4View`. \n\nThe `ScreenComponent` will be saved in `PersistentScreenScope` and reused when view recreated. In method `ScreenComponent#inject(view)` you need to insert presenter to the view. The easiest way to do it is to use dagger component as `ScreenComponent`. Due to this mechanism presenter is reused after configuration change. \n\nMethod `MvpPresenter#onLoad(viewRecreated)` will be called, when view is ready. Boolean parameter `viewRecreated` means that view is recreated after configuration change. You should show previously loaded data via this method, it data exists.\n\nIn `MvpActivityView` you should override method `#onCreate()` with parameter `viewRecreated` instead of default method `#onCreate()`. Same for `MvpFragmentV4View` and `onActivityCreated` method.\n\nIf you use Dagger, this library contains two scope annotations `@PerApplication` and `@PerScreen`. It also contains `ActivityProvider` and `FragmentProvider`, which can be used for getting access to Activity or Fragment inside objects, provided by Dagger screen component (e.g. inside Navigator class).\n\nIt's lifecycle of screen's objects: \n![lifecycle](ferro_lifecycle.png)\n\nThe next extention adds freeze logic for Rx events:\n## ferro-mvp-rx\nClass `MvpRxPesenter` contains freeze logic, scematic work of which shown in gif above. This class should be extended instead of `MvpPresenter`.\n\nIf you subscribe to `Observable` via one of `MvpRxPesenter#subscribe()` methods,\nall rx events (onNext, onError, onComplete) would be frozen when view destroyed and unfrozen\nwhen view recreated.\nIf option `freezeEventOnPause` is enabled (it is enabled by default), all Rx events\nwould be also frozen when screen is paused and unfrozen when screen is resumed.\n\nWhen screen is finally destroyed, all subscriptions would be automatically unsubscribed.\n\n## ferro-rx\nThis library contains rx operators (`ObservableOperatorFreeze`, `MaybeOperatorFreeze`, `SingleOperatorFreeze`, `CompletableOperatorFreeze`, `FlowableOperatorFreeze` for RxJava2 and `OperatorFreeze` for RxJava1), which contains freeze logic. To apply it, you should pass this operator in method `Observable#lift()`.\n\n\n## Conclusion \nNobody likes to do the basic logic of the project dependent on third-party libraries. So, the Ferro is, generally speaking, set of simple ideas, and you can create you own base classes by using this ideas.\n\n## Dependency\n```groovy\nrepositories {\n      jcenter()\n   }\n```\n\n```groovy\ndependencies {\n      //for use the full ferro (still not support RxJava2)\n      compile 'com.agna.ferro:ferro-mvp-rx:1.1.2'\n      //for use the part of ferro\n      compile 'com.agna.ferro:ferro-core:1.1.2'\n      compile 'com.agna.ferro:ferro-mvp:1.1.2'\n      compile 'com.agna.ferro:ferro-rx:1.0.2' \n      //or if you use RxJava2\n      compile 'com.agna.ferro:ferro-rx:2.0.0'\n   }\n```\n\n## License\n```\nCopyright 2016 Maxim Tuev\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMaksTuev%2Fferro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMaksTuev%2Fferro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMaksTuev%2Fferro/lists"}