{"id":21385901,"url":"https://github.com/islamdidarmd/multistate-layout","last_synced_at":"2025-03-16T12:13:45.968Z","repository":{"id":107626276,"uuid":"176650582","full_name":"islamdidarmd/multistate-layout","owner":"islamdidarmd","description":"A custom layout that helps to manage multiple states(LOADING, EMPTY, CONTENT) of view. This layout is also aware about network state.","archived":false,"fork":false,"pushed_at":"2019-03-20T04:20:23.000Z","size":313,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-22T23:44:11.552Z","etag":null,"topics":["android","custom","java","kotlin","layout","multi","network","state","ui"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/islamdidarmd.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":"2019-03-20T04:04:44.000Z","updated_at":"2019-04-27T16:36:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"0c36cd9c-d209-41e3-a123-d51741d9c587","html_url":"https://github.com/islamdidarmd/multistate-layout","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/islamdidarmd%2Fmultistate-layout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/islamdidarmd%2Fmultistate-layout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/islamdidarmd%2Fmultistate-layout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/islamdidarmd%2Fmultistate-layout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/islamdidarmd","download_url":"https://codeload.github.com/islamdidarmd/multistate-layout/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243864821,"owners_count":20360360,"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","custom","java","kotlin","layout","multi","network","state","ui"],"created_at":"2024-11-22T11:51:36.301Z","updated_at":"2025-03-16T12:13:45.948Z","avatar_url":"https://github.com/islamdidarmd.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Multistate Layout\nA custom layout that helps to manage multiple states(LOADING, EMPTY, CONTENT) of the layout. This layout is also aware\nabout network state.\n\n[![](https://jitpack.io/v/islamdidarmd/multistate-layout.svg)](https://jitpack.io/v/islamdidarmd/multistate-layout)\n\n## Installation (with Gradle)\nAdd the dependency to your root *build.gradle*:\n```groovy\n   repositories {\n        jcenter()\n        maven { url \"https://jitpack.io\" }\n   }\n   ```\nNow add this dependency in your module *build.gradle*\n```groovy\n   dependencies {\n         implementation 'com.github.islamdidarmd:multistate-layout:$latest_release'\n   }\n```\n\n### Demo\n  \u003cimg src=\"https://github.com/islamdidarmd/Multistate-Layout/blob/master/Screenshot_1552992432.png\" width=\"250\"\u003e \u003cimg src=\"https://github.com/islamdidarmd/Multistate-Layout/blob/master/Screenshot_1552992440.png\" width=\"250\"\u003e \u003cimg src=\"https://github.com/islamdidarmd/Multistate-Layout/blob/master/Screenshot_1552992443.png\" width=\"250\"\u003e \u003cimg src=\"https://github.com/islamdidarmd/Multistate-Layout/blob/master/Screenshot_1553055451.png\" width=\"250\"\u003e\n\n### How to use\nFor using custom attributes use `msl` namespace in the root element of the layout\n\n`xmlns:msl=\"http://schemas.android.com/apk/res-auto\"`\n\n`msl:loadingLayout`, `msl:emptyLayout` are optional. If you don't include these, a basic layout will be shown.\n\nif you set `msl:showConnectionStatus=\"true\"`, then a layout will be shown on top of the layout if device doesn't have a data\nconnection\n\n```xml\n \u003ccom.islamdidarmd.multistatelayout.MultiStateLayout\n            android:layout_width=\"match_parent\"\n            android:id=\"@+id/multiStateLayout\"\n            android:layout_height=\"match_parent\"\n            android:layout_above=\"@id/btnEmpty\"\n            msl:contentLayout=\"@id/content\"\n            msl:loadingLayout=\"@id/layoutLoading\"\n            msl:emptyLayout=\"@id/layoutNoData\"\n            msl:showConnectionStatus=\"true\"\u003e \n             \n            \u003cRelativeLayout\n                            android:id=\"@+id/layoutLoading\"\n                            android:layout_width=\"match_parent\"\n                            android:layout_height=\"match_parent\"\u003e     \n                       ...\n                    \u003c/RelativeLayout\u003e\n            \n                    \u003cRelativeLayout\n                            android:id=\"@+id/layoutNoData\"\n                            android:layout_width=\"match_parent\"\n                            android:layout_height=\"match_parent\"\u003e\n                       ...\n                    \u003c/RelativeLayout\u003e\n            \n                    \u003cRelativeLayout\n                            android:id=\"@+id/content\"\n                            android:layout_width=\"match_parent\"\n                            android:layout_height=\"match_parent\"\u003e\n            \n                        ...\n                    \u003c/RelativeLayout\u003e\n            \n                \u003c/com.islamdidarmd.multistatelayout.MultiStateLayout\u003e\n\n```\n\n### States\n``` \n    State.LOADING,\n    State.EMPTY,\n    State.CONTENT\n```\n### Changing States\n```kotlin\n        btnLoading.setOnClickListener {\n            multiStateLayout.setState(MultiStateLayout.State.LOADING)\n        }\n\n        btnContent.setOnClickListener {\n            multiStateLayout.setState(MultiStateLayout.State.CONTENT)\n        }\n\n        btnEmpty.setOnClickListener {\n            multiStateLayout.setState(MultiStateLayout.State.EMPTY)\n        }\n```\n\n\nFor a complete example see the sample app `https://github.com/islamdidarmd/Multistate-Layout/tree/master/app`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fislamdidarmd%2Fmultistate-layout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fislamdidarmd%2Fmultistate-layout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fislamdidarmd%2Fmultistate-layout/lists"}