# MultiStateView
**Repository Path**: applibgroup/MultiStateView
## Basic Information
- **Project Name**: MultiStateView
- **Description**: Universal State Switch View (maintenance stopped)
- **Primary Language**: Java
- **License**: Apache-2.0
- **Default Branch**: main
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2021-12-16
- **Last Updated**: 2022-01-04
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
[](https://github.com/applibgroup/MultiStateView/actions/workflows/main.yml) [](https://sonarcloud.io/summary/new_code?id=applibgroup_MultiStateView)
# MultiStateView
A HMOS library which provide MultiStateView feature.
## Source
Inspired by [XuDaojie/MultiStateView](https://github.com/XuDaojie/MultiStateView/)
## Feature
This library provides different switching states of View, included by default are Content, Empty, Fail, Loading states.
## Dependency
1. For using multistateview module in sample app, include the source code and add the below dependencies in entry/build.gradle to generate hap/support.har.
```groovy
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
implementation project(path: ':multistateview')
testImplementation 'junit:junit:4.13'
ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.100'
}
```
2. For using multistateview in separate application using har file, add the har file in the entry/libs folder and add the dependencies in entry/build.gradle file.
```groovy
dependencies {
implementation fileTree(dir: 'libs', include: ['*.har'])
testImplementation 'junit:junit:4.13'
}
```
3. For using multistateview from a remote repository in separate application, add the below dependencies in entry/build.gradle file.
``` groovy
dependencies {
implementation ('dev.applibgroup:multistateview:1.0.0')
testCompile 'junit:junit:4.13'
}
```
## Usage
### Include following code in your layout
``` xml
```
### Include following code in your activity
``` java
public void setViewState(int state); // Set the view state
public int getViewState(); // Get the current state
public View getView(int state); // Get the view of the specified state
public void addViewForStatus(int status, int resLayoutID); // Increase the state
public void setOnInflaterListener(OnInflateListener onInflateListener); // Triggered when each state is Layout inflate (except CONTENT)
```
## License
Copyright XuDaojie
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.