Created
February 5, 2014 04:32
-
-
Save gerryhigh/8817463 to your computer and use it in GitHub Desktop.
Wrapper classes over BTProgressHUD and AndHUD to provide a unified interface
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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