1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-05 23:53:33 +00:00

dismiss previous toasts on android

This commit is contained in:
Kyle Spearrin
2017-12-23 23:48:47 -05:00
parent db42b6a3a5
commit cde5b09943
2 changed files with 17 additions and 29 deletions

View File

@@ -33,6 +33,7 @@ namespace Bit.Android.Services
private bool _cameraPermissionsDenied;
private DateTime? _lastAction;
private ProgressDialog _progressDialog;
private global::Android.Widget.Toast _toast;
public DeviceActionService(
IAppSettingsService appSettingsService)
@@ -44,8 +45,16 @@ namespace Bit.Android.Services
public void Toast(string text, bool longDuration = false)
{
global::Android.Widget.Toast.MakeText(CurrentContext, text,
longDuration ? global::Android.Widget.ToastLength.Long : global::Android.Widget.ToastLength.Short).Show();
if(_toast != null)
{
_toast.Cancel();
_toast.Dispose();
_toast = null;
}
_toast = global::Android.Widget.Toast.MakeText(CurrentContext, text,
longDuration ? global::Android.Widget.ToastLength.Long : global::Android.Widget.ToastLength.Short);
_toast.Show();
}
public void CopyToClipboard(string text)