From cde5b09943274e597479a3c6c13b6e473e45ec93 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Sat, 23 Dec 2017 23:48:47 -0500 Subject: [PATCH] dismiss previous toasts on android --- src/Android/Resources/Resource.Designer.cs | 33 ++++----------------- src/Android/Services/DeviceActionService.cs | 13 ++++++-- 2 files changed, 17 insertions(+), 29 deletions(-) diff --git a/src/Android/Resources/Resource.Designer.cs b/src/Android/Resources/Resource.Designer.cs index 10bb3b663..f5db89f59 100644 --- a/src/Android/Resources/Resource.Designer.cs +++ b/src/Android/Resources/Resource.Designer.cs @@ -4268,17 +4268,17 @@ namespace Bit.Android // aapt resource value: 0x7f090051 public const int ApplicationName = 2131296337; - // aapt resource value: 0x7f0900b2 - public const int AutoFillServiceDescription = 2131296434; + // aapt resource value: 0x7f0900ab + public const int AutoFillServiceDescription = 2131296427; - // aapt resource value: 0x7f0900b1 - public const int AutoFillServiceSummary = 2131296433; + // aapt resource value: 0x7f0900aa + public const int AutoFillServiceSummary = 2131296426; // aapt resource value: 0x7f090050 public const int Hello = 2131296336; - // aapt resource value: 0x7f0900b3 - public const int MyVault = 2131296435; + // aapt resource value: 0x7f0900ac + public const int MyVault = 2131296428; // aapt resource value: 0x7f090027 public const int abc_action_bar_home_description = 2131296295; @@ -4433,27 +4433,6 @@ namespace Bit.Android // aapt resource value: 0x7f09000f public const int common_signin_button_text_long = 2131296271; - // aapt resource value: 0x7f0900ac - public const int default_web_client_id = 2131296428; - - // aapt resource value: 0x7f0900ad - public const int firebase_database_url = 2131296429; - - // aapt resource value: 0x7f0900aa - public const int gcm_defaultSenderId = 2131296426; - - // aapt resource value: 0x7f0900ae - public const int google_api_key = 2131296430; - - // aapt resource value: 0x7f0900ab - public const int google_app_id = 2131296427; - - // aapt resource value: 0x7f0900af - public const int google_crash_reporting_api_key = 2131296431; - - // aapt resource value: 0x7f0900b0 - public const int google_storage_bucket = 2131296432; - // aapt resource value: 0x7f090052 public const int hockeyapp_crash_dialog_app_name_fallback = 2131296338; diff --git a/src/Android/Services/DeviceActionService.cs b/src/Android/Services/DeviceActionService.cs index fe329a116..a8b37e62b 100644 --- a/src/Android/Services/DeviceActionService.cs +++ b/src/Android/Services/DeviceActionService.cs @@ -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)