private void callOnGlobalLayout(Crouton crouton, View croutonView) { var layoutListener = new GlobalLayoutListener(); layoutListener.OnGlobalLayout(delegate { if (Build.VERSION.SdkInt < BuildVersionCodes.JellyBean) { #pragma warning disable 618 croutonView?.ViewTreeObserver?.RemoveGlobalOnLayoutListener(layoutListener); #pragma warning restore 618 } else { croutonView?.ViewTreeObserver?.RemoveOnGlobalLayoutListener(layoutListener); } if (crouton.GetInAnimation() == null) { return; } croutonView?.StartAnimation(crouton.GetInAnimation()); AnnounceForAccessibilityCompat(crouton.GetActivity(), crouton.DataContext?.ToString() ?? "NULL"); sendMessageDelayed(crouton, REMOVE_CROUTON, crouton.DurationInMilliseconds + crouton.GetInAnimation().Duration); }); }
private void CallOnGlobalLayout(Crouton crouton, View croutonView) { var layoutListener = new GlobalLayoutListener(); layoutListener.OnGlobalLayout(delegate { if (Build.VERSION.SdkInt < Build.VERSION_CODES.JellyBean) { croutonView.ViewTreeObserver.RemoveGlobalOnLayoutListener(layoutListener); } else { croutonView.ViewTreeObserver.RemoveOnGlobalLayoutListener(layoutListener); } if (crouton.GetInAnimation() != null) { croutonView.StartAnimation(crouton.GetInAnimation()); AnnounceForAccessibilityCompat(crouton.GetActivity(), crouton.DataContext == null ? "NULL" : crouton.DataContext.ToString()); SendMessageDelayed(crouton, REMOVE_CROUTON, crouton.DurationInMilliseconds + crouton.GetInAnimation().Duration); } }); }