{"id":19260686,"url":"https://github.com/evant/android-shard","last_synced_at":"2025-04-21T16:32:09.927Z","repository":{"id":57736727,"uuid":"145117681","full_name":"evant/android-shard","owner":"evant","description":"'Fragments' with a simpler api built on top of the android architecture components","archived":false,"fork":false,"pushed_at":"2020-06-14T22:55:25.000Z","size":982,"stargazers_count":29,"open_issues_count":2,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-01T14:38:12.173Z","etag":null,"topics":[],"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/evant.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-17T12:26:08.000Z","updated_at":"2022-06-19T08:13:57.000Z","dependencies_parsed_at":"2022-08-24T14:57:22.809Z","dependency_job_id":null,"html_url":"https://github.com/evant/android-shard","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/evant%2Fandroid-shard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evant%2Fandroid-shard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evant%2Fandroid-shard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evant%2Fandroid-shard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evant","download_url":"https://codeload.github.com/evant/android-shard/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250091023,"owners_count":21373303,"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:22:31.316Z","updated_at":"2025-04-21T16:32:08.968Z","avatar_url":"https://github.com/evant.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shard\n\nShards are 'Fragments' with a simpler api built on top of the android architecture components. \n\n**Stability**: All important features are implemented but there may be some api changes before `1.0.0`.\n\n## Download\n[![Maven Central](https://img.shields.io/maven-central/v/me.tatarka.shard/shard.svg)](https://search.maven.org/search?q=g:me.tatarka.shard)\n[![Sonatype Snapshot](https://img.shields.io/nexus/s/https/oss.sonatype.org/me.tatarka.shard/shard.svg)](https://oss.sonatype.org/content/repositories/snapshots/me/tatarka/shard/)\n\n```groovy\ndef shard_version = '1.0.0-beta03'\n// The core lib\nimplementation \"me.tatarka.shard:shard:$shard_version\"\n// For use with appcompat\nimplementation \"me.tatarka.shard:shard-appcompat:$shard_version\"\n// For use with the material design lib \nimplementation \"me.tatarka.shard:shard-host-ui:$shard_version\"\n// For use with the android architecture navigation component\nimplementation \"me.tatarka.shard:shard-nav:$shard_version\"\n// For use in a ViewPager\nimplementation \"me.tatarka.shard:shard-pager:$shard_version\"\n// For use in a ViewPager2\nimplementation \"me.tatarka.shard:shard-pager2:$shard_version\"\n// For using androidx.transition\nimplementation \"me.tatarka.shard:shard-transition:$shard_version\"\n// For interop with fragments\nimplementation \"me.tatarka.shard:shard-fragment-interop:$shard_version\"\n```\n\n### Kotlin\n\nThere's a few additional artifacts for kotlin extensions.\n\n```groovy\nimplementation \"me.tatarka.shard:shard-ktx:$shard_version\"\nimplementation \"me.tatarka.shard:shard-host-ui-ktx:$shard_version\"\n```\n\n### SNAPSHOT\n\nYou can also follow the bleeding-edge with SNAPSHOT releases.\n```groovy\nrepositories {\n    maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }\n}\ndef shard_version = '1.0.0-beta03-SNAPSHOT'\n```\n\n## Usage\n\nCreating a shard is as simple as\n```kotlin\nclass MyShard: Shard() {\n    const val REQUEST_CODE = 1\n\n    // get a ViewModel\n    val vm by viewModels\u003cMyViewModel\u003e()\n\n    override fun onCreate() {\n        setContentView(R.layout.my_shard)\n        // find a view\n        val name: TextView = requireViewById(R.id.name)\n        // listen with LiveData\n        vm.name.observe(this, Observer { value -\u003e name.text = value })\n        // handle back presses\n        onBackPressedDispatcher.addCallback(this, enabled = true) {\n            remove()\n        }\n        // start an activity for result\n        activityCallbacks.addOnActivityResultCallback(REQUEST_CODE) { resultCode, data -\u003e }\n        requireViewById\u003cButton\u003e(R.id.button).setOnClickListener {\n            activityCallbacks.startActivityForResult(Intent(context, MyActivity::class.java), REQUEST_CODE)\n        }\n    }\n}\n```\n\n```xml\n\u003cme.tatarka.shard.wiget.ShardHost\n    android:id=\"@+id/host\"\n    android:name=\"com.example.MyShard\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    tools:layout=\"@layout/my_shard\" /\u003e\n```\n\n## Full Documentation\n\n- [Getting Started](/docs/getting-started.md)\n- [Implementing Shards](/docs/implementing-shards.md)\n- [Hosting Shards](/docs/hosting-shards.md)\n- [Transition Animations](/docs/transition-animations.md)\n- [Migrating from Fragments](/docs/migrating-from-fragments.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevant%2Fandroid-shard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevant%2Fandroid-shard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevant%2Fandroid-shard/lists"}