{"id":22986088,"url":"https://github.com/dora4/dora_empty_layout","last_synced_at":"2025-08-13T20:32:55.055Z","repository":{"id":162680532,"uuid":"415372122","full_name":"dora4/dora_empty_layout","owner":"dora4","description":"空数据、空态布局控件","archived":false,"fork":false,"pushed_at":"2021-10-10T06:38:41.000Z","size":3735,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-30T03:05:56.952Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/dora4.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-10-09T17:08:18.000Z","updated_at":"2024-10-30T17:05:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"a5955953-6e23-4db7-8bc3-c7063b0385c8","html_url":"https://github.com/dora4/dora_empty_layout","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dora4/dora_empty_layout","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dora4%2Fdora_empty_layout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dora4%2Fdora_empty_layout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dora4%2Fdora_empty_layout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dora4%2Fdora_empty_layout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dora4","download_url":"https://codeload.github.com/dora4/dora_empty_layout/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dora4%2Fdora_empty_layout/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270305842,"owners_count":24562109,"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-08-13T02:00:09.904Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":[],"created_at":"2024-12-15T03:39:10.031Z","updated_at":"2025-08-13T20:32:55.001Z","avatar_url":"https://github.com/dora4.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DoraEmptyLayout\n\n描述：一个用来显示暂无数据、加载中和加载错误的布局容器\n\n复杂度：★★☆☆☆\n\n分组：【Dora大控件组】\n\n关系：暂无\n\n技术要点：自定义属性、向ViewGroup中添加控件\n\n### 照片\n\n![avatar](https://github.com/dora4/dora_empty_layout/blob/main/art/dora_empty_layout_1.jpg)![avatar](https://github.com/dora4/dora_empty_layout/blob/main/art/dora_empty_layout_2.jpg)![avatar](https://github.com/dora4/dora_empty_layout/blob/main/art/dora_empty_layout_3.jpg)![avatar](https://github.com/dora4/dora_empty_layout/blob/main/art/dora_empty_layout_4.jpg)\n\n### 动图\n\n![avatar](https://github.com/dora4/dora_empty_layout/blob/main/art/dora_empty_layout.gif)\n\n### 软件包\n\nhttps://github.com/dora4/dora_empty_layout/blob/main/art/dora_empty_layout.apk\n\n### 用法\n\n它只能有且只有一个子控件，这个唯一的子控件作为content。通过调用showEmpty、showError、showLoading、showContent来改变显示，在onEmpty、onError、onLoading、onRefresh中处理回调。\n\n```kotlin\nemptyLayout = findViewById(R.id.emptyLayout)\n        emptyLayout\n                .onEmpty {\n                    Toast.makeText(this@MainActivity, \"onEmpty\", Toast.LENGTH_SHORT).show()\n                }\n                .onError { e -\u003e\n                    val tvError = findViewById\u003cTextView\u003e(R.id.tvError)\n                    tvError.text = e.message\n                    Toast.makeText(this@MainActivity, \"onError\", Toast.LENGTH_SHORT).show()\n                }\n                .onLoading {\n                    ((this as ImageView).drawable as AnimationDrawable).start()\n                    Toast.makeText(this@MainActivity, \"onLoading\", Toast.LENGTH_SHORT).show()\n                }\n                .onRefresh {\n                    Toast.makeText(this@MainActivity, \"onRefresh\", Toast.LENGTH_SHORT).show()\n                }\n```\n\n| 自定义属性         | 描述               |\n| ------------------ | ------------------ |\n| dora_emptyLayout   | 配置空数据的布局   |\n| dora_errorLayout   | 配置加载错误的布局 |\n| dora_loadingLayout | 配置加载中的布局   |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdora4%2Fdora_empty_layout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdora4%2Fdora_empty_layout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdora4%2Fdora_empty_layout/lists"}