Skip to content

Commit

Permalink
replace toasts with snackbar
Browse files Browse the repository at this point in the history
  • Loading branch information
jamie-mh committed Sep 11, 2023
1 parent 7369ed0 commit 6017883
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
8 changes: 4 additions & 4 deletions AuthenticatorPro.Droid/src/Activity/ErrorActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using AndroidX.Core.Widget;
using AuthenticatorPro.Droid.Util;
using Google.Android.Material.Dialog;
using Google.Android.Material.Snackbar;
using Google.Android.Material.TextView;

namespace AuthenticatorPro.Droid.Activity
Expand Down Expand Up @@ -93,8 +94,7 @@ private void ReportGitHub()
var clip = ClipData.NewPlainText("error", _exception);
clipboard.PrimaryClip = clip;

Toast.MakeText(this, Resource.String.errorCopiedToClipboard, ToastLength.Short).Show();

ShowSnackbar(Resource.String.errorCopiedToClipboard, Snackbar.LengthShort);
var intent = new Intent(Intent.ActionView, Uri.Parse($"{GetString(Resource.String.githubRepo)}/issues"));

try
Expand All @@ -103,7 +103,7 @@ private void ReportGitHub()
}
catch (ActivityNotFoundException)
{
Toast.MakeText(this, Resource.String.webBrowserMissing, ToastLength.Short).Show();
ShowSnackbar(Resource.String.webBrowserMissing, Snackbar.LengthShort);
}
}

Expand Down Expand Up @@ -179,7 +179,7 @@ private void ReportEmail()
}
catch (ActivityNotFoundException)
{
Toast.MakeText(this, Resource.String.emailClientMissing, ToastLength.Short).Show();
ShowSnackbar(Resource.String.emailClientMissing, Snackbar.LengthShort);
}
}

Expand Down
2 changes: 1 addition & 1 deletion AuthenticatorPro.Droid/src/Activity/MainActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ private void OnBottomAppBarNavigationClick(object sender, Toolbar.NavigationClic
}
catch (ActivityNotFoundException)
{
Toast.MakeText(this, Resource.String.googlePlayNotInstalledError, ToastLength.Short).Show();
ShowSnackbar(Resource.String.googlePlayNotInstalledError, Snackbar.LengthShort);
}
};

Expand Down
9 changes: 5 additions & 4 deletions AuthenticatorPro.Droid/src/Activity/SettingsActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using AuthenticatorPro.Droid.Interface.Fragment;
using AuthenticatorPro.Droid.Interface.Preference;
using AuthenticatorPro.Droid.Storage;
using Google.Android.Material.Snackbar;
using Javax.Crypto;

namespace AuthenticatorPro.Droid.Activity
Expand Down Expand Up @@ -175,12 +176,12 @@ private void RegisterClickableEvents()
try
{
await _authenticatorService.ResetCopyCountsAsync();
Toast.MakeText(this, Resource.String.copyCountReset, ToastLength.Short).Show();
ShowSnackbar(Resource.String.copyCountReset, Snackbar.LengthShort);
}
catch (Exception e)
{
Logger.Error(e);
Toast.MakeText(this, Resource.String.genericError, ToastLength.Short).Show();
ShowSnackbar(Resource.String.genericError, Snackbar.LengthShort);
}
};

Expand Down Expand Up @@ -322,13 +323,13 @@ private void EnableBiometrics(Action<bool> callback)

authCallback.Failed += delegate
{
Toast.MakeText(this, Resource.String.genericError, ToastLength.Long).Show();
ShowSnackbar(Resource.String.genericError, Snackbar.LengthShort);
callback(false);
};

authCallback.Errored += (_, args) =>
{
Toast.MakeText(this, args.Message, ToastLength.Long).Show();
ShowSnackbar(args.Message, Snackbar.LengthLong);
callback(false);
};

Expand Down

0 comments on commit 6017883

Please sign in to comment.