{"id":13428796,"url":"https://github.com/xiprox/ErrorView","last_synced_at":"2025-03-16T02:30:31.389Z","repository":{"id":22484060,"uuid":"25823250","full_name":"xiprox/ErrorView","owner":"xiprox","description":"A custom view that displays an image, a title, and a subtitle. Use it for errors, empty states, or just messages with images!","archived":true,"fork":false,"pushed_at":"2018-08-12T03:58:23.000Z","size":2492,"stargazers_count":569,"open_issues_count":2,"forks_count":93,"subscribers_count":18,"default_branch":"master","last_synced_at":"2024-08-01T01:30:50.169Z","etag":null,"topics":["android","android-library"],"latest_commit_sha":null,"homepage":"","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/xiprox.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}},"created_at":"2014-10-27T14:35:21.000Z","updated_at":"2024-07-13T13:07:42.000Z","dependencies_parsed_at":"2022-08-20T17:40:11.399Z","dependency_job_id":null,"html_url":"https://github.com/xiprox/ErrorView","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiprox%2FErrorView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiprox%2FErrorView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiprox%2FErrorView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiprox%2FErrorView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xiprox","download_url":"https://codeload.github.com/xiprox/ErrorView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221637432,"owners_count":16855730,"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","android-library"],"created_at":"2024-07-31T01:01:05.374Z","updated_at":"2024-10-27T06:30:24.911Z","avatar_url":"https://github.com/xiprox.png","language":"Kotlin","readme":"# ErrorView\n\nA custom view that displays an image, a title, and a subtitle. It can be used for various purposes like displaying errors, empty states, or just messages with images.\n\n![](/graphics/screenshots/ss_01.png)\n\n\u003cp align=\"right\"\u003e\n\u003ca href='https://github.com/xiprox/ErrorView/releases/latest'\u003e\u003cimg height=\"48\" alt='Get apk' src='https://cloud.githubusercontent.com/assets/2550945/21590907/dd74e0f0-d0ff-11e6-971f-d429148fd03d.png'/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## Download\n```gradle\nimplementation 'tr.xip.errorview:library:4.0.0'\n```\n**Note:** You might have to add `jcenter()` to your repositories.\n\nPre-3.0 versions were `com.github.xiprox.errorview:library:x.y.z`.\n\nIf you're migrating from v2, you may find the changelog in the [releases](https://github.com/xiprox/ErrorView/releases) page helpful.\n\n## Usage\n\n#### Image\n```java\nsetImage(int res)\nsetImage(Drawable)\nsetImage(Bitmap)\n\nsetImageTint(int color)\n\nsetImageVisible(boolean)\n\nsetImageSize(int width) // The ImageView adjusts its height to preserve aspect ratio.\n\n.isImageVisible\n```\n```xml\napp:ev_image=\"@drawable/,,,\"\napp:ev_imageTint=\"@color/...\"\napp:ev_imageVisible=\"boolean\"\napp:ev_imageSize=\"123dp\"\n```\n\n#### Title\n```java\nsetTitle(String)\nsetTitle(int res)\nsetTitleColor(int color)\nsetTitleVisible(boolean)\n.title\n.isTitleVisible\n```\n```xml\napp:ev_title=\"@string/...\"\napp:ev_titleColor=\"@color/...\"\napp:ev_titleVisible=\"boolean\"\n```\n\n#### Subtitle\n```java\nsetSubtitle(String)\nsetSubtitle(int res)\nsetSubtitleColor(int color)\nsetSubtitleVisible(boolean visible)\n.subtitle\n.isSubtitleVisible\n```\n```xml\napp:ev_subtitle=\"@string/...\"\napp:ev_subtitleColor=\"@color/...\"\napp:ev_subtitleVisible=\"boolean\"\n```\n\n#### Retry button\n```java\nsetRetryText(String)\nsetRetryText(int res)\nsetRetryColor(int color)\nsetRetryVisible(boolean)\n.retryText\n.isRetryVisible\n```\n```xml\napp:ev_retryText=\"@string/...\"\napp:ev_retryBackground=\"@drawable/...\"\napp:ev_retryColor=\"@color/...\"\napp:ev_retryVisible=\"boolean\"\n```\n#### Retry listener\n```java\nsetRetryListener(RetryListener)\n```\n\n#### Builder pattern\nAll set methods return `ErrorView`, so you can chain them like such:\n```java\nerrorView.setImage(image).setTitle(e.title).setSubtitle(e.message).setRetryVisible(false)\n```\n\n## Theming\nYou can theme ErrorView app-wide:\n```xml\n\u003cstyle name=\"AppTheme\" parent=\"Theme.AppCompat.DayNight.DarkActionBar\"\u003e\n    ...\n    \u003citem name=\"ev_style\"\u003e@style/MyErrorView\u003c/item\u003e\n\u003c/style\u003e\n \n\u003cstyle name=\"MyErrorView\"\u003e\n    \u003citem name=\"ev_retryText\"\u003e@string/error_retry\u003c/item\u003e\n    \u003citem name=\"ev_image\"\u003e@drawable/sadface\u003c/item\u003e\n\u003c/style\u003e\n```\n\nYou can also apply themes to specific ErrorViews:\n```xml\n\u003ctr.xip.errorview.ErrorView\n    android:id=\"@+id/specialErrorView\"\n    android:layout_width=\"wrap_content\"\n    android:layout_height=\"wrap_content\"\n    android:theme=\"@style/MySpecialErrorView\"/\u003e\n```\n```xml\n\u003cstyle name=\"MySpecialErrorView\"\u003e\n    \u003citem name=\"ev_imageSize\"\u003e120dp\u003c/item\u003e\n    \u003citem name=\"ev_retryColor\"\u003e@color/apptheme_accent\u003e\u003e\n\u003c/style\u003e\n```\n\nAnd yes, ErrorView supports `AppCompat.DayNight` out-of-the-box. In fact the above style snippet is from the sample app. \n\n## Further customization\nIf you are looking for further customization, you can always do something like the following, albeit a bit hacky:\n```java\nval image = errorView.findViewById(R.id.ev_image)\nval title = errorView.findViewById(R.id.ev_title)\nval subtitle = errorView.findViewById(R.id.ev_subtitle)\nval retryButton = errorView.findViewById(R.id.ev_retry)\n```\nThese view ids will not be changed unless there is a major version increment (e.g. 4.0.0 -\u003e 5.0.0).\n\n## License\n```\nCopyright (C) 2014 İhsan Işık\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\nApache License Version 2.0 ([LICENSE](/LICENSE))\n","funding_links":[],"categories":["Libraries","空白页"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiprox%2FErrorView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxiprox%2FErrorView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiprox%2FErrorView/lists"}