Giter Site home page Giter Site logo

pageloader's Introduction

PageLoader

Android Arsenal

PageLoader is a simple android library for loading page with easy customization. Built by Arie Ridwansyah.

PageLoader Demo

Setup

Add PageLoader to your dependencies block:

dependencies {
    implementation 'id.arieridwan:pageloader:0.0.2'
}

Usage

PageLoader

Add a PageLoader to your layout just like any other view.

<id.arieridwan.lib.PageLoader
    android:id="@+id/pageloader"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

Define the action to load the page or displaying error page on the event

SomeMethod(){
pageLoader.startProgress();
...
    onComplete(){
        ...
    }
    onNext(){
        ...
        pageLoader.stopProgress();
    }
    onError(){
        ...
        pageLoader.stopProgressAndFailed();
    }
}

Set onClickListener when error page is displayed

pageLoader.setOnRetry(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                pageLoader.startProgress();
            }
        });

You can easily customize the text for loading page or when displaying the error page then change the dimensions with following attribute

app:setLoadingText="Please wait..."
app:setErrorText="Something happened"
app:setTextColor="@color/black"
app:setTextSize="16sp"

Or you can change the image for loading or error page and set the dimensions of the image

app:setLoadingImage="@drawable/ic_search"
app:setErrorImage="@drawable/ic_not_found"
app:setLoadingImageHeight="64dp"
app:setLoadingImageWidth="64dp"
app:setErrorImageHeight="64dp"
app:setErrorImageWidth="64dp"        

And also you can change the animation mode

app:setLoadingAnimationMode="rotate"
app:setLoadingAnimationMode="flip"
app:setLoadingAnimationMode="vibrate"
app:setLoadingAnimationMode="shake"
app:setLoadingAnimationMode="bounce"

And then, you can using custom animation or custom font

pageLoader.setCustomAnimation(myAnimation);
pageLoader.setCustomFont(myTypeface);

Screenshot

Sample Apps Loading Page Error Page

To Do

  • setDefaultFontEnabled
  • setLoadingProgressModeEnabled

Credits

Arie Ridwansyah

License

PageLoader is under Apache License 2.0.

pageloader's People

Contributors

arierie avatar donglua avatar eugeneogongo avatar xiryl 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.