{"id":19260860,"url":"https://github.com/evant/kotlin-fragment-dsl","last_synced_at":"2025-04-21T17:30:23.864Z","repository":{"id":144875500,"uuid":"94711558","full_name":"evant/kotlin-fragment-dsl","owner":"evant","description":"A nice kotlin dsl for dealing with the fragment backstack. ","archived":false,"fork":false,"pushed_at":"2020-06-14T22:48:59.000Z","size":137,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-01T14:45:51.047Z","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":"2017-06-18T20:32:18.000Z","updated_at":"2024-08-23T05:20:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"e2a5bd79-46de-4c81-986b-0cfe6761699c","html_url":"https://github.com/evant/kotlin-fragment-dsl","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%2Fkotlin-fragment-dsl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evant%2Fkotlin-fragment-dsl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evant%2Fkotlin-fragment-dsl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evant%2Fkotlin-fragment-dsl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evant","download_url":"https://codeload.github.com/evant/kotlin-fragment-dsl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250100098,"owners_count":21374869,"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:10.728Z","updated_at":"2025-04-21T17:30:23.851Z","avatar_url":"https://github.com/evant.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kotlin-fragment-dsl\nA nice kotlin dsl for dealing with the fragment backstack.\n\n## Download\nTODO: upload somewhere.\nNote: this lib depends on `com.android.support:support-fragment:26.0.0-beta2`\n\n## Usage\nYou modify the fragment backstack inside a transaction in the `fragmentStack` function in your activity or fragment.\n```kotlin\nfragmentStack(R.id.container) {\n  pop()\n  push(MyFragment())\n}\n```\nAll opertaions will be optomized with `FragmentManager#setReorderingAllowed(true)`.\n\n### Initial Fragment\nWhen an activity is created you usally want to ensure it has an initial fragment. You can do this with `startWith`\n```kotlin\noverride fun onCreate(savedInstanceState: Bundle?) {\n  super.onCreate(savedInstanceState)\n  setContentView(R.layout.activity_main)\n  fragmentStack(R.id.container) {\n    startWith(InitialFragment())\n  }\n}\n```\nThis will only add the fragment if no fragments yet exist in the container.\n\n### Push Options\nWhen pushing a fragment (or with the starting the fragment) you can specify tranaction options. This is usually animations.\n```kotlin\nfragmentStack(R.id.container) {\n  push(MyFragment()) {\n    enter = android.R.animator.enter\n    exit = android.R.animator.exit\n    popEnter = android.R.animator.pop_enter\n    popExit = android.R.animator.pop_exit\n    \n    transition = TRANSIT_FRAGMENT_OPEN\n    \n    transityStyle = R.style.myStyle\n    \n    sharedElements[\"name\"] = sharedView\n  }\n}\n```\n\n### Pop Options\n\n- `pop()` will pop the top pushed fragment, or do nothing if there isn't anything to pop. The initial fragment will never be popped.\n- `popAll()` will pop all fragments (except the initial fragment).\n- `popTo(backStackName, inclusive = false)` will pop to the given back stack name. This is provided when pushing a fragment with\n`push(MyFragment(), backStackName = \"foo\")`. There is an optional `inclusive` flag, the default is non-inclusive.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevant%2Fkotlin-fragment-dsl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevant%2Fkotlin-fragment-dsl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevant%2Fkotlin-fragment-dsl/lists"}