{"id":20099653,"url":"https://github.com/tananaev/fmelib","last_synced_at":"2025-05-06T06:31:38.231Z","repository":{"id":57727437,"uuid":"49937997","full_name":"tananaev/fmelib","owner":"tananaev","description":"Fragments Made Easy library for Android","archived":false,"fork":false,"pushed_at":"2017-05-30T09:23:15.000Z","size":198,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-26T10:22:32.885Z","etag":null,"topics":["android","fragments","java"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tananaev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-19T08:28:18.000Z","updated_at":"2024-04-26T10:22:32.886Z","dependencies_parsed_at":"2022-09-26T21:51:24.400Z","dependency_job_id":null,"html_url":"https://github.com/tananaev/fmelib","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tananaev%2Ffmelib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tananaev%2Ffmelib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tananaev%2Ffmelib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tananaev%2Ffmelib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tananaev","download_url":"https://codeload.github.com/tananaev/fmelib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224490674,"owners_count":17319983,"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","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","fragments","java"],"created_at":"2024-11-13T17:11:50.297Z","updated_at":"2024-11-13T17:11:52.002Z","avatar_url":"https://github.com/tananaev.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fragments Made Easy\n\nAndroid library that makes [Fragments](http://developer.android.com/guide/components/fragments.html) easy to work with.\n\n- Easy asynchronous callbacks management\n\nMain goal of the library is to allow developers focus more about business logic they are implementing and think less about proper handling of fragment lifecycle.\n\nCurrent version of the library only provides classes based on Android Support Library Fragment, so you have to include Support Library dependency if you want to use `EasyFragment`.\n\n## Download\nJust include Gradle dependency into your project:\n```groovy\ncompile \"com.tananaev:fmelib:${version}\"\n```\n\n## Callbacks and listeners\n\nIt was always a pain to handle various asynchronous callbacks is fragments because fragments can be recreated by Android. With `EasyFragment` and magic `runWhenStarted(Task)` method you don't need to worry about it anymore.\n\n```java\npublic class LoginFragment extends EasyFragment {\n    ...\n    public void login() {\n        sendLoginRequest(user -\u003e runWhenStarted(fragmentDestroyed -\u003e {\n            Intent intent = new Intent(getActivity(), MainActivity.class);\n            intent.putExtra(MainActivity.USER_KEY, user);\n            startActivity(intent);\n        }));\n    }\n    ...\n```\n\nTask will be executed immediately if fragment is in started state. If it's not currently visible, the task will be executed when fragment is started. If fragment is destroyed, task will be executed with `fragmentDestroyed` flag allowing you to handle this condition as well.\n\nYou can use anonymous clasess or lambda expressions for implementing `Task` interface. Nice benefit of this approach is that you can cache response using standard Java closure which makes code shorter and simpler. Library will automatically serialize your callback instance and associate it with a new fragment if your activity has been recreated.\n\nJust make sure that all extra variables captured by your `Task` class or lambda are `Serializable`.\n\n## Team\n\n- [Anton Tananaev](https://github.com/tananaev)\n- [Nader Ayyad](https://github.com/naderz)\n\n## License\n\n    Apache License, Version 2.0\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftananaev%2Ffmelib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftananaev%2Ffmelib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftananaev%2Ffmelib/lists"}