Giter Site home page Giter Site logo

progress-activity's Introduction

Android Arsenal

progress-activity

If you are tired of constantly having to set up progress bars, empty views and error views, than this library is for you.

About

Using progress-activity which extends from RelativeLayout, you can easily add states like

  • progress bar while the content is loading,
  • empty view to indicate when there are no data to display,
  • error view to indicate when something goes wrong with a button to try again.

Screenshots

Features

  • show/hide progress bar,
  • show/hide empty view,
  • show/hide error view,
  • show content when the data is ready to be displayed,

Usage

Add com.vlonjatg.progressactivity.ProgressActivity to your layout.

<com.vlonjatg.progressactivity.ProgressActivity
	android:id="@+id/progressActivity"
    android:layout_width="match_parent"
	android:layout_height="match_parent"
    android:layout_below="@+id/activityToolbar"
    progressActivity:loadingStateBackgroundColor="#FFFFFF"
    progressActivity:progressEmptyStateBackgroundColor="#fbc02d"
    progressActivity:progressErrorStateBackgroundColor="#42a5f5">

        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:gravity="center"
            android:text="@string/hello_world" />

    </com.vlonjatg.progressactivity.ProgressActivity>

Then in your code:

To display the loading view:

progressActivity.showLoading();

To display the empty view:

progressActivity.showEmpty(emptyDrawable, "Empty Shopping Cart", 
		"Please add things in the cart to continue.");

To display the error view:

progressActivity.showError(errorDrawable, "No Connection",
		"We could not establish a connection with our servers. Try again when you are connected to the interne.",
        "Try Again", errorClickListener);

Get It

allprojects {
        repositories {
            jcenter()
        }
    }

    dependencies {
        compile 'com.vlonjatg.android:progress-activity:1.1.1'
    }
```

### Customization

There are a bunch of attributes to customize the views.

```
<attr name="progressLoadingStateProgressBarWidth" format="dimension"/>
<attr name="progressLoadingStateProgressBarHeight" format="dimension"/>
<attr name="progressLoadingStateBackgroundColor" format="color"/>

<attr name="progressEmptyStateImageWidth" format="dimension"/>
<attr name="progressEmptyStateImageHeight" format="dimension"/>
<attr name="progressEmptyStateTitleTextSize" format="dimension"/>
<attr name="progressEmptyStateContentTextSize" format="dimension"/>
<attr name="progressEmptyStateTitleTextColor" format="color"/>
<attr name="progressEmptyStateContentTextColor" format="color"/>
<attr name="progressEmptyStateBackgroundColor" format="color"/>

<attr name="progressErrorStateImageWidth" format="dimension"/>
<attr name="progressErrorStateImageHeight" format="dimension"/>
<attr name="progressErrorStateTitleTextSize" format="dimension"/>
<attr name="progressErrorStateContentTextSize" format="dimension"/>
<attr name="progressErrorStateTitleTextColor" format="color"/>
<attr name="progressErrorStateContentTextColor" format="color"/>
<attr name="progressErrorStateButtonTextColor" format="color"/>
<attr name="progressErrorStateBackgroundColor" format="color"/>
```

### Example

An [example](https://github.com/vlonjatg/progress-activity/tree/master/sample) is available.

### Developed By

Vlonjat Gashi - [Twitter](https://twitter.com/vlonjatg)

### Attributes

This library is inspired by [AndroidProgressLayout](https://github.com/antonkrasov/AndroidProgressLayout) library from Anton Krasov.

### License

progress-activity is available under the [MIT](http://opensource.org/licenses/MIT) licence.

```
The MIT License (MIT)

Copyright (c) 2015 Vlonjat Gashi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
```

progress-activity's People

Contributors

vlonjat-gashi avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.