Skip to content

A view to handle resource states e.g. loading, data or error.

License

Notifications You must be signed in to change notification settings

TheHemantKaushik/resourceview

Repository files navigation

Download

ResourceView

ResourceView is a very useful library to handle resource states e.g. loading, data or error. Here is some simple steps to use ResourceView:


1. Configure:

// in project's build.gradle
allprojects {
repositories {
jcenter({ url "https://dl.bintray.com/thehemantkaushik/resourceview" })
}
}

// in app's build.gradle
compile 'com.thehemantkaushik:resourceview:1.0.0-alpha2'


2. Find view:

// find/bind view
ResourceView resourceView;


3. Show Loading:

// show loader without any message
resourceView.showLoadingLayout();

// show loader with message by passing string resource id
resourceView.showLoadingLayout(@StringRes int loaderMessage);

// show loader with message by passing string
resourceView.showLoadingLayout(String loaderMessage);

// want to show custom layout for loading
resourceView.showLoadingView(@LayoutRes int layoutRes);

// want to show custom view for loading
resourceView.showLoadingView(View view);


4. Show Error:

// show error message
resourceView.showErrorLayout(String message);

// show error image and message
resourceView.showErrorLayout(int imageRes, String message);

// show error message and action
resourceView.showErrorLayout(String message, String actionButtonText, Runnable actionButtonCallback);

// show error image, message and action
resourceView.showErrorLayout(int imageRes, String message, String actionButtonText, Runnable actionButtonCallback);

// show your own error layout by passing its resource id
resourceView.showErrorView(@LayoutRes int layout);

// show your own error view
resourceView.showErrorView(View view);


5. Show Contents:

// to show actual contents, just call this method:
resourceView.showContents();

About

A view to handle resource states e.g. loading, data or error.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages