Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nguyenhoanglam/ProgressLayout
An extension of RelativeLayout that helps show loading, empty and error layout.
https://github.com/nguyenhoanglam/ProgressLayout
Last synced: about 1 month ago
JSON representation
An extension of RelativeLayout that helps show loading, empty and error layout.
- Host: GitHub
- URL: https://github.com/nguyenhoanglam/ProgressLayout
- Owner: nguyenhoanglam
- License: apache-2.0
- Created: 2016-09-09T08:27:31.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-07-01T08:40:57.000Z (over 4 years ago)
- Last Synced: 2024-08-03T01:26:23.464Z (4 months ago)
- Language: Java
- Size: 119 KB
- Stars: 108
- Watchers: 5
- Forks: 19
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-github-android-ui - ProgressLayout - 展示加载布局空白布局和error布局 (空白页)
README
## ProgressLayout
An extension of RelativeLayout that helps show loading, empty and error layout.## Screenshot
## Download
Add to your module's build.gradle:```java
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
```
and:```java
dependencies {
compile 'com.github.nguyenhoanglam:ProgressLayout:1.0.0'
}
```## How to use
- Use ProgressLayout like RelativeLayout in xml file.```java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle("Progress Layout");
ProgressLayout progressLayout = (ProgressLayout) findViewById(R.id.progressLayout);
// Show progress layout and keep main views visible
// skipIds is a list of view's ids which you want to show with ProgressLayout (in this case is the Toobar)
List skipIds = new ArrayList<>();
skipIds.add(R.id.toolbar);
progressLayout.showLoading(skipIds);
progressLayout.showEmpty(ContextCompat.getDrawable(this, R.drawable.ic_empty), "Empty data",skipIds);
progressLayout.showError(ContextCompat.getDrawable(this, R.drawable.ic_no_connection), "No connection", "RETRY", new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(MainActivity.this, "Reloading...", Toast.LENGTH_SHORT).show();
}
},skipIds);
// Show progress layout, hide all main views
progressLayout.showLoading();
progressLayout.showEmpty(ContextCompat.getDrawable(this, R.drawable.ic_empty), "Empty data");
progressLayout.showError(ContextCompat.getDrawable(this, R.drawable.ic_no_connection), "No connection", "RETRY", new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(MainActivity.this, "Reloading...", Toast.LENGTH_SHORT).show();
}
});
}
```- Custom ProgressLayout's attributes
```java
```
##License
Copyright 2016 Nguyen Hoang LamLicensed 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.