{"id":19260887,"url":"https://github.com/evant/fragstack","last_synced_at":"2025-04-21T17:30:29.247Z","repository":{"id":144875482,"uuid":"138443737","full_name":"evant/fragstack","owner":"evant","description":"A better android fragment backstack","archived":false,"fork":false,"pushed_at":"2020-06-14T22:47:21.000Z","size":141,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-01T14:46:02.734Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","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/evant.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2018-06-24T01:04:45.000Z","updated_at":"2020-02-03T20:29:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"84cab21f-2413-4434-8800-e19911a2df28","html_url":"https://github.com/evant/fragstack","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evant%2Ffragstack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evant%2Ffragstack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evant%2Ffragstack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evant%2Ffragstack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evant","download_url":"https://codeload.github.com/evant/fragstack/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250100122,"owners_count":21374875,"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":[],"created_at":"2024-11-09T19:23:21.946Z","updated_at":"2025-04-21T17:30:29.241Z","avatar_url":"https://github.com/evant.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fragstack\nA better fragment back-stack™\n\nThe major difference from the built-in fragment back-stack is that\nfragments in the back-stack on completely destroyed, not just their views. This removes the weird\nextra `onViewCreated(View, Bundle)`/`Fragment#onDestroyView()` lifecycle\nthat fragments have.\n\n## Usage\n\nSpecify the intial fragment, then use `push()` and `pop` to manipulate the back-stack.\n\n```kotlin\nimport android.support.v7.app.AppCompatActivity\nimport android.os.Bundle\nimport me.tatarka.fragstack.ktx.backStack\n\nclass MainActivity : AppCompatActivity {\n  override fun onCreate(savedInstanceState: Bundle?) {\n    backStack.startWith(R.id.content, DashboardFragment.newInstance())\n  }\n  \n  override fun onBackPressed() {\n    if (!backStack.popImmediate()) {\n      super.onBackPressed()\n    }\n  }\n}\n\n...\n\nbackStack.push(DetailFragment.newInstance())\nbackStack.pop()\n```\n\nTransactions will automatically be optimised, so you are free to edit the\nback-stack with multiple operations. For example, to go from [A, B, C] to [A, B, D] you can do\n\n```kotlin\nbackStack.pop().push(fragmentD)\n```\n\n### From Java\n\nGet an instance of the backstack with `FragmentBackstack.of(activity.getSupportFragmentManager())` or\n`FragmentBackstack.of(fragment.getChildFragmentManager())`.\n\n## Differences with Fragment Transitions\n\nUnfortunatly the fragment transitions api is tied deeply with the built-in back-stack. It will see a pop from\nthis lib the same way as a push. This means pop animations will run in the new fragment instead of the old one.\nMethods like `setSharedElementReturnTransition()`, `setReenterTransition()` and `setReturnTransition()` will \nbe ignored.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevant%2Ffragstack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevant%2Ffragstack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevant%2Ffragstack/lists"}