/// <summary>
    ///     Presents a snackbar based on the provided configuration.
    /// </summary>
    /// <param name="config">The dialog configuration.</param>
    protected override void PresentSnackbar(ISnackbarConfig config)
    {
        if (MessagingServiceCore.ActivityLifecycleCallbacks.CurrentActivity is AppCompatActivity appCompatActivity)
        {
            appCompatActivity.SafeRunOnUIThread(() =>
            {
                using var snackbar = ConstructSnackbar(appCompatActivity, config);

                snackbar.Show();
            });
        }
    }
    /// <summary>
    ///     Constructs the internal snackbar.
    /// </summary>
    /// <param name="config">The dialog configuration.</param>
    protected virtual Material_Snackbar ConstructSnackbar(AppCompatActivity appCompatActivity, ISnackbarConfig config)
    {
        var snackbar = Material_Snackbar.Make(FindSnackbarContainerView(appCompatActivity), config.Message, config.Duration ?? BaseTransientBottomBar.LengthLong);

        // Configure the animation mode, if provided.
        if (config.AnimationMode.HasValue)
        {
            snackbar.SetAnimationMode(config.AnimationMode.Value);
        }

        // Configure the anchor view, if available.
        if (config.AnchorView == null)
        {
            if (MessagingServiceCore.ViewManager.SnackbarAnchorViews.TryGetValue(appCompatActivity, out var snackbarAnchorView))
            {
                snackbar.SetAnchorView(snackbarAnchorView);
            }
        }
        else
        {
            snackbar.SetAnchorView(config.AnchorView);
        }

        // Configure the background, if provided.
        if (config.BackgroundColor.HasValue)
        {
            // Without this, setting the background tint removes rounded corners.
            snackbar.View.BackgroundTintMode = PorterDuff.Mode.SrcAtop;

            snackbar.View.BackgroundTintList = ColorStateList.ValueOf(config.BackgroundColor.Value);
        }

        // Configure the Snackbar action, if any.
        if (!string.IsNullOrWhiteSpace(config.ActionButtonText))
        {
            snackbar = snackbar.SetAction(config.ActionButtonText, (view) => config.ActionButtonClickAction?.Invoke());

            if (config.ActionButtonTextColor.HasValue)
            {
                snackbar = snackbar.SetActionTextColor(config.ActionButtonTextColor.Value);
            }
        }

        // Find the Snackbar action TextView and configure it, if avaialble.
        if (snackbar.View.FindViewById <TextView>(Resource.Id.snackbar_action) is TextView snackbarActionTextView)
        {
            if (config.ActionButtonTypeface != null)
            {
                snackbarActionTextView.SetTypeface(config.ActionButtonTypeface, config.ActionButtonTypefaceStyle);
            }
        }

        // Find the Snackbar message TextView and configure it, if available.
        if (snackbar.View.FindViewById <TextView>(Resource.Id.snackbar_text) is TextView snackbarMessageTextView)
        {
            if (config.MessageTextColor.HasValue)
            {
                snackbarMessageTextView.SetTextColor(config.MessageTextColor.Value);
            }

            if (config.MessageTypeface != null)
            {
                snackbarMessageTextView.SetTypeface(config.MessageTypeface, config.MessageTypefaceStyle);
            }
        }

        return(snackbar);
    }