public void ClearMsg(AppMsg appMsg) { if (msgQueue.Contains(appMsg)) { RemoveMessages(MessageRemove); msgQueue.ToList().Remove(appMsg); RemoveMsg(appMsg); } }
public void Add(AppMsg appMsg) { msgQueue.Enqueue(appMsg); if (inAnimation == null) { inAnimation = AnimationUtils.LoadAnimation(appMsg.Activity, Android.Resource.Animation.FadeIn); } if (outAnimation == null) { outAnimation = AnimationUtils.LoadAnimation(appMsg.Activity, Android.Resource.Animation.FadeOut); } DisplayMsg(); }
private static AppMsg MakeText(Activity context, string text, Style style, View view, bool floating) { var result = new AppMsg(context); view.SetBackgroundResource(style.Background); var tv = (TextView)view.FindViewById(Android.Resource.Id.Message); tv.Text = text; result.View = view; result.Duration = style.Duration; result.SetFloating(floating); return result; }
public OutAnimationListener(AppMsg appMsg) { this.appMsg = appMsg; }
private void RemoveMsg(AppMsg appMsg) { var parent = ((ViewGroup) appMsg.View.Parent); if (parent != null) { outAnimation.SetAnimationListener(new OutAnimationListener(appMsg)); appMsg.View.StartAnimation(outAnimation); msgQueue.Dequeue(); if (appMsg.IsFloating) { parent.RemoveView(appMsg.View); } else { appMsg.View.Visibility = ViewStates.Invisible; } Message msg = ObtainMessage(MessageDisplay); SendMessage(msg); } }
private void AddMsgToView(AppMsg appMsg) { View view = appMsg.View; if (view.Parent == null) { appMsg.Activity.AddContentView( view, appMsg.LayoutParams); } view.StartAnimation(inAnimation); if (view.Visibility != ViewStates.Visible) { view.Visibility = ViewStates.Visible; } var msg = ObtainMessage(MessageRemove); msg.Obj = appMsg; SendMessageDelayed(msg, appMsg.Duration); }