Skip to content

Instantly share code, notes, and snippets.

@gerryhigh
Created February 5, 2014 04:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gerryhigh/8817463 to your computer and use it in GitHub Desktop.
Save gerryhigh/8817463 to your computer and use it in GitHub Desktop.
Wrapper classes over BTProgressHUD and AndHUD to provide a unified interface
using System;
using Android.App;
using AndroidHUD;
namespace XHUD
{
public enum MaskType
{
// None = 1,
Clear,
Black,
// Gradient
}
public static class HUD
{
public static Activity MyActivity;
public static void Show(string message, int progress = -1, MaskType maskType = MaskType.Black)
{
AndHUD.Shared.Show(HUD.MyActivity, message, progress,(AndroidHUD.MaskType)maskType);
}
public static void Dismiss()
{
AndHUD.Shared.Dismiss(HUD.MyActivity);
}
public static void ShowToast(string message)
{
AndHUD.Shared.ShowToast(HUD.MyActivity, message);
}
}
}
And for iOS
using System;
using BigTed;
namespace XHUD
{
public enum MaskType
{
None = 1,
Clear,
Black,
Gradient
}
public static class HUD
{
public static void Show(string message, int progress = -1, MaskType maskType = MaskType.None)
{
float p = (float)progress / 100f;
BTProgressHUD.Show(message, p, (ProgressHUD.MaskType)maskType);
}
public static void Dismiss()
{
BTProgressHUD.Dismiss();
}
public static void ShowToast(string message)
{
BTProgressHUD.ShowToast(message);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment