Popups & Preloaders

Android Native provides an API to display native android popups and preloaders.

Preloader

The Native preloader feature gives you the ability to show nice looking native preloader, in case you need to lock the screen and show preloader to a user while you performing an operation in the background. 

When you need to lock the screen, just call the LockScreen method:

using SA.Android.App;

//Show the preloader
AN_Preloader.LockScreen("Please Wait...");

//and hide it in 2 sec
SA_Coroutine.WaitForSeconds(2f, () => {
    AN_Preloader.UnlockScreen();
});

Dialogs

With Android Native dialogs you can create object base on AlertDialog android class. There also default themes you may use to make dialogs look better with your app UI:

public enum AN_DialogTheme
{
    Default = 0,
    Light = 1,
    Material = 2,
    Material_Light = 3
}

For example, to create a simple message you can use:

var message = new AN_AlertDialog(AN_DialogTheme.Material);
message.Title = "Message";
message.Message = "Some message text";
message.SetPositiveButton("Okay", () => {
    AN_Logger.Log("message: ok button was clicked");
});

message.Show();

Or a dialog:

var dialog = new AN_AlertDialog(AN_DialogTheme.Light);
dialog.Title = "Dialog";
dialog.Message = "Some dialog text";

dialog.SetPositiveButton("Yes", () => {
    AN_Logger.Log("dialog: Yes button was clicked");
});

dialog.SetNegativeButton("No", () => {
    AN_Logger.Log("dialog: No button was clicked");
});

dialog.Show();

You can also create a more complicated Rate Us Dialog for your app