Giter Site home page Giter Site logo

android-loadingdialog's Introduction

Android Loading Views

  • A non blocking customisable progress view that can can block click events without blocking the back button
  • A better looking loading dialog for Android inspired by ios

alt tag

Installation:

Add this to the main gradle file:

	allprojects {
   	repositories {
   		...
   		maven { url 'https://jitpack.io' }
   	}
   }

Add this to your project gradle file:

	dependencies {
	        compile 'com.github.ravindu1024:android-loadingdialog:1.0.2'
	}

Usage

To create a new loading view

LoadingView loadingView = new LoadingView.Builder(act)
                .setProgressColorResource(R.color.ew_dark_pink)
                .setBackgroundColorRes(R.color.ew_white)
                .setProgressStyle(LoadingView.ProgressStyle.HORIZONTAL)
                .setCustomMargins(0, 100, 100, 0)
                .attachTo(act);

loadingView.show();

To set the failed state with a retry calback

loadingView.setLoadingFailed("Operation failed", "retry", new LoadingView.OnRefreshClickListener()
                {
                    @Override
                    public void onRefreshClicked()
                    {
		    	//do stuff here
                    }
                });

To set a custom layout to the operation failed view

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:gravity="center"
              android:orientation="vertical">

    <TextView
        android:id="@+id/label"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fontFamily="sans-serif-light"
        android:text="Operation Failed"
        android:textAlignment="center"
        android:textSize="14sp"/>

    <TextView
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:background="@color/colorPrimaryDark"
        android:padding="10dp"
        android:text="TextView"
        android:textColor="@android:color/white"
        android:textSize="16sp"/>
</LinearLayout>

The custom layout should contain two views that inherit from TextView (or support the setText method) named "label" and "button". The onRefreshClicked click event is added to the view named "button".

android-loadingdialog's People

Contributors

ravindu1024 avatar

Watchers

Michael jentsch 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.