hunkar / mandh-android-loaderview

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mandh Android Loading Screen Helper

License


This project created for helping management of loading screens in Mandh Android applications.

πŸ“ Table of Contents

🧐 About

LoaderView is making easy for handle loading screens in our applications. We expect to prevent confusing and gaining time for creation loading view in every applications.

🎈 Usage

Add Jitpack to proect build.gradle

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

Add implementation to app/build.gradle

dependencies {
    ...
    implementation 'com.github.hunkar:mandh-android-loaderview:1.0.1'
    ...
}

You can imlement LoaderView from layout .xml file. Then you can show/hide loader view from activity.

    <com.mandh.loader.LoaderView
        android:id="@+id/loader_view"
        app:loaderSrc="@drawable/circular_arrow"
        app:loaderBackgroundColor="#112233"
        app:loaderImageHeight="500"
        app:loaderBackgroundOpacity="0.8"
        app:loaderOpacity="1"
        app:loaderImageWidth="500"
        app:rotationDirection="anticlockwise"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
    LoaderView loaderView = findViewById(R.id.loader_view);
    loaderView.setloaderStatus(true);
    loaderView.setloaderStatus(false);
  • loaderSrc = Drawable for loader icon
  • loaderOpacity = Loader icon opacity that is float between 0-1
  • loaderImageWidth = Loader icon width value that is integer
  • loaderImageHeight = Loader icon height value that is integer
  • loaderBackgroundColor = String color for background overlay
  • loaderBackgroundOpacity = Opacity of background overlay that is float between 0-1
  • rotationDirection = 'clockwise' or 'anticlockwise'

You don't need add anything to xml layout. You can create insstance and set parameters. And then you can show/hide.

    LoaderView loaderView = new LoaderView(this);       //Parameter is context
    loaderView.setLoaderImageHeight(75);                //Loader icon width value that is integer
    loaderView.setLoaderImageWidth(75);                 //Loader icon height value that is integer
    loaderView.setLoaderOpacity((float)0.7);                   //Loader icon opacity that is float between 0-1
    loaderView.setLoaderBackgroundColor("#ffffff");     //String color for background overlay
    loaderView.setLoaderBackgroundOpacity((float)0.8);         //Opacity of background overlay that is float between 0-1

    //RotationDirection.CLOCKWISE
    //RotationDirection.ANTI_CLOCKWISE
    loaderView.setLoaderDirection(RotationDirection.CLOCKWISE);

    loaderView.setLoaderImage(getDrawable(R.drawable.circular_arrow));

    loaderView.setloaderStatus(true);
    loaderView.setloaderStatus(false);

Also you can show loader view as a Dialog. So, you can show your loader front of another dialogs. TODO: Other customization will be added to dialog loader view. Currently it doesn't support customization.

    LoaderDialog loaderDialogView = new LoaderView(this);       //Parameter is context

    loaderDialogView.showLoader();
    loaderDialogView.hideLoader();

✍️ Authors

About


Languages

Language:Java 100.0%