/Xamarin.Android.AVLoadingIndicatorView

:beginner: AVLoadingIndicatorView is a collection of nice loading animations for Xamarin.Android.

Primary LanguageC#MIT LicenseMIT

Build status NuGet

Xamarin.Android.AVLoadingIndicatorView

This is a Xamarin Android Binding for the AVLoadingIndicatorView.

AVLoadingIndicatorView is a collection of nice loading animations for Android.

Demo

Usage

(see the sample project for a detailed working example)

Step 1

Install NuGet package.

Step 2

Add the AVLoadingIndicatorView to your layout:

Define xmlns:app in your root view.

xmlns:app="http://schemas.android.com/apk/res-auto"

Simple Loading

<com.wang.avi.AVLoadingIndicatorView
    android:id="@+id/avi"
    android:layout_width="wrap_content"  
    android:layout_height="wrap_content"
    app:indicatorName="BallPulseIndicator" />

Advanced Loading

<com.wang.avi.AVLoadingIndicatorView
    android:id="@+id/avi"
    android:layout_width="wrap_content"     // or your custom size
    android:layout_height="wrap_content"    // or your custom size
    style="@style/AVLoadingIndicatorView"   // or AVLoadingIndicatorView.Large or AVLoadingIndicatorView.Small
    android:visibility="visible"            // visibility
    app:indicatorName="BallPulseIndicator"  // indicator Name
    app:indicatorColor="your color" />      // indicator color

Step 3

Show or hide the progress. (starts showing by default)

protected override void OnCreate(Bundle savedInstanceState)
{
    base.OnCreate(savedInstanceState);

    avi = FindViewById<AVLoadingIndicatorView>(Resource.Id.avi);
    avi.Show():
}  

void ShowLoading()
{
    avi.Show();
    // or avi.SmoothToShow();
}

void HideLoading()
{
    avi.Hide();
    // or avi.SmoothToHide();
}
   

Using programmatically

protected override void OnCreate(Bundle savedInstanceState)
{
    base.OnCreate(savedInstanceState);

    var avLoadingIndicatorView = new AVLoadingIndicatorView(this);
    avLoadingIndicatorView.SetIndicator("SquareSpinIndicator");
    AddContentView(avLoadingIndicatorView, new ViewGroup.LayoutParams(80, 80));
}            

Proguard

When using proguard need to add this rules:

-keep class com.wang.avi.** { *; }
-keep class com.wang.avi.indicators.** { *; }

Indicators are loaded from class names, proguard may change it (rename).

Indicators

As seen above in the Demo, the indicators are as follows:

Row 1

  • BallPulseIndicator
  • BallGridPulseIndicator
  • BallClipRotateIndicator
  • BallClipRotatePulseIndicator

Row 2

  • SquareSpinIndicator
  • BallClipRotateMultipleIndicator
  • BallPulseRiseIndicator
  • BallRotateIndicator

Row 3

  • CubeTransitionIndicator
  • BallZigZagIndicator
  • BallZigZagDeflectIndicator
  • BallTrianglePathIndicator

Row 4

  • BallScaleIndicator
  • LineScaleIndicator
  • LineScalePartyIndicator
  • BallScaleMultipleIndicator

Row 5

  • BallPulseSyncIndicator
  • BallBeatIndicator
  • LineScalePulseOutIndicator
  • LineScalePulseOutRapidIndicator

Row 6

  • BallScaleRippleIndicator
  • BallScaleRippleMultipleIndicator
  • BallSpinFadeLoaderIndicator
  • LineSpinFadeLoaderIndicator

Row 7

  • TriangleSkewSpinIndicator
  • PacmanIndicator
  • BallGridBeatIndicator
  • SemiCircleSpinIndicator

License

MIT Licence