public IProgressDialog Progress(Activity activity, ProgressConfig config) { if (_progress != null && _progress.IsShowing) { _progress.Dismiss(); } _progress = KProgressHUD.Create(activity, KProgressHUD.Style.PieDeterminate).SetLabel(config.Text); _progress.SetMaxProgress(100); _progress.SetCancellable(config.Cancellable); if (config.Cancellable) { _progress.SetCancelAction(() => { _progress.Dismiss(); config.CancelAction?.Invoke(); }); } if (config.MarkType == MarkType.Black) { _progress.SetDimAmount(0.5f); } _progress.Show(); return(new LoadingDialog(_progress)); }
public IDisposable Loading(Activity activity, LoadingConfig config) { if (_progress != null && _progress.IsShowing) { _progress.Dismiss(); } _progress = KProgressHUD.Create(activity, KProgressHUD.Style.SpinIndeterminate).SetLabel(config.Text); _progress.SetCancellable(config.Cancellable); if (config.Cancellable) { _progress.SetCancelAction(() => { _progress.Dismiss(); config.CancelAction?.Invoke(); }); } if (config.MarkType == MarkType.Black) { _progress.SetDimAmount(0.5f); } _progress.Show(); if (config.Duration != null) { DelayDismiss((int)config.Duration.Value.TotalMilliseconds); } return(new DisposableAction(() => _progress.Dismiss())); }