{"id":13642347,"url":"https://github.com/gturedi/StatefulLayout","last_synced_at":"2025-04-20T16:31:52.501Z","repository":{"id":68183717,"uuid":"82232720","full_name":"gturedi/StatefulLayout","owner":"gturedi","description":"Android layout to show template for loading, empty, error etc. states","archived":false,"fork":false,"pushed_at":"2020-01-05T10:37:27.000Z","size":1035,"stargazers_count":802,"open_issues_count":2,"forks_count":70,"subscribers_count":18,"default_branch":"master","last_synced_at":"2024-11-03T08:08:48.101Z","etag":null,"topics":["android","android-layout","android-library","anroid-layout","custom-view","layout","loader","loading","stateful"],"latest_commit_sha":null,"homepage":null,"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/gturedi.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}},"created_at":"2017-02-16T22:32:39.000Z","updated_at":"2024-11-02T04:46:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"e244a03f-c95a-423a-aa76-bdf3c5484a92","html_url":"https://github.com/gturedi/StatefulLayout","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gturedi%2FStatefulLayout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gturedi%2FStatefulLayout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gturedi%2FStatefulLayout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gturedi%2FStatefulLayout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gturedi","download_url":"https://codeload.github.com/gturedi/StatefulLayout/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223832972,"owners_count":17210756,"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-layout","android-library","anroid-layout","custom-view","layout","loader","loading","stateful"],"created_at":"2024-08-02T01:01:30.304Z","updated_at":"2025-04-20T16:31:52.471Z","avatar_url":"https://github.com/gturedi.png","language":"Java","readme":"## StatefulLayout\n\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-StatefulLayout-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/5325)  [![API](https://img.shields.io/badge/API-14%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=14)  [![MavenCentral](https://maven-badges.herokuapp.com/maven-central/com.github.gturedi/stateful-layout/badge.svg?style=flat)](https://oss.sonatype.org/content/repositories/releases/com/github/gturedi/stateful-layout/)  [![Build Status](https://travis-ci.org/gturedi/StatefulLayout.svg?branch=master)](https://travis-ci.org/gturedi/StatefulLayout)  [![License](http://img.shields.io/:license-apache-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)\n\nAndroid layout to show most common state templates like loading, empty, error etc. To do that all you need to is wrap \nthe target area(view) with StatefulLayout.\n\n![alt text](sample.gif)\n\n## Usage\nYou can download it from jitpack.io\n```groovy\nallprojects {\n    repositories {\n        maven { url 'https://jitpack.io' }\n    }\n}\ndependencies {\n     compile 'com.github.gturedi:StatefulLayout:1.2.2'\n}\n```\n\nAlternatively you can use Sonatype Repository, add dependecy to app/build.gradle\n```groovy\ndependencies {\n     compile 'com.github.gturedi:stateful-layout:1.2.1'\n}\n```\nSnapshots of the development version are available in [Sonatype's `snapshots` repository](https://oss.sonatype.org/content/repositories/snapshots/com/github/gturedi)\n\n```\n\nThen wrap a view which target area(view) to show states with StatefulLayout\n```xml\n  \u003ccom.gturedi.views.StatefulLayout\n        android:id=\"@+id/stateful\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        app:stfAnimationEnabled=\"true\"\n        app:stfInAnimation=\"@android:anim/slide_in_left\"\n        app:stfOutAnimation=\"@android:anim/slide_out_right\"\n        \u003e\n    \n        \u003c!-- your content here  --\u003e\n        \u003cLinearLayout\n            android:id=\"@+id/target\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            \u003e\n            ...\n        \u003c/LinearLayout\u003e\n\n    \u003c/com.gturedi.views.StatefulLayout\u003e\n```\n\nFinally in your activity/fragment get StatefulLayout reference and call showXXX methods\n```java\nStatefulLayout stateful = (StatefulLayout) findViewById(R.id.stateful);\nstateful.showLoading();\n//stateful.showEmpty(getString(R.string.testMessage));\n//stateful.showError(getString(R.string.testMessage), clickListener);\n//etc.\n```\n\n## API\nState methods have overloads for customization. If you pass clickListener parameter as null, relevant state button \nwill be hided. More customization please look [CustomStateOptions.java](library/src/main/java/com/gturedi/views/CustomStateOptions.java)\n\n- setAnimationEnabled(boolean animationEnabled)\n- setInAnimation(@AnimRes int inAnimation)\n- setOutAnimation(@AnimRes int outAnimation)\n- showContent()\n- showLoading(String message)\n- showEmpty(String message)\n- showError(String message, OnClickListener clickListener)\n- showOffline(String message, OnClickListener clickListener)\n- showLocationOff(String message, OnClickListener clickListener)\n- showCustom(CustomStateOptions options)\n\n## Xml Attributes\n| Name | Type | Default | Description |\n|:----:|:----:|:-------:|:-----------:|\n| stfAnimationEnabled | boolean | true | Indicates whether to place the animation on state changes |\n| stfInAnimation | anim | @android:anim/fade_in | Animation started begin of state change |\n| stfOutAnimation | anim | @android:anim/fade_out | Animation started end of state change |\n\n## Customization\nJust override relevant resource in your app to customize state views appearance\n\n- To Override **strings** [strings.xml variables](library/src/main/res/values/strings.xml)\n\n- To Override **styles** [styles.xml](library/src/main/res/values/styles.xml)\n\n- To Override **layout** [stf_template.xml](library/src/main/res/layout/stf_template.xml)\n\n## License\n    Copyright 2017 Gökhan Türedi (turedi.gokhan@gmail.com)\n    \n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n    \n      http://www.apache.org/licenses/LICENSE-2.0\n    \n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","funding_links":[],"categories":["空白页"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgturedi%2FStatefulLayout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgturedi%2FStatefulLayout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgturedi%2FStatefulLayout/lists"}