public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { var view = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.recyclerview_item, parent, false); var holder = new SimpleViewHolder(view); holder.SwipeLayout.SetShowMode(SwipeLayout.ShowMode.LayDown); holder.SwipeLayout.Opened += (sender, e) => { YoYo.With(Techniques.Tada) .Duration(500) .Delay(100) .PlayOn(e.Layout.FindViewById(Resource.Id.trash)); }; holder.SwipeLayout.DoubleClick += (sender, e) => { Toast.MakeText(context, "DoubleClick " + holder.AdapterPosition, ToastLength.Short).Show(); }; holder.ButtonDelete.Click += (sender, e) => { MItemManager.RemoveShownLayouts(holder.SwipeLayout); dataset.RemoveAt(holder.AdapterPosition); NotifyItemRemoved(holder.AdapterPosition); NotifyItemRangeChanged(holder.AdapterPosition, dataset.Count); MItemManager.CloseAllItems(); Toast.MakeText(holder.ButtonDelete.Context, "Deleted " + holder.TextViewData.Text + "!", ToastLength.Short).Show(); }; return(holder); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); var target = FindViewById(Resource.Id.hello_world); // after start, just click mTarget view, rope is not init var rope = YoYo.With(Techniques.FadeIn).Duration(1000).PlayOn(target); var listView = FindViewById <ListView> (Resource.Id.list_items); listView.Adapter = new EffectAdapter(this); listView.ItemClick += (sender, e) => { var technique = (Techniques)e.View.Tag; rope = YoYo.With(technique) .Duration(1200) .Interpolate(new AccelerateDecelerateInterpolator()) .WithCancelListener(ani => Toast.MakeText(this, "canceled", ToastLength.Short).Show()) .PlayOn(target); }; FindViewById(Resource.Id.hello_world).Click += delegate { if (rope != null) { rope.Stop(true); } }; }
private void HandleYoYo() { float cd = 0; switch (currentYoYo) { case YoYo.YELLOW: if (hasRed) { currentYoYo = YoYo.RED; ultPassivePwr = ultBurnPwr; cd = 45; } else if (hasViolet) { currentYoYo = YoYo.VIOLET; ultPassivePwr = ultBreakPwr; cd = 75; } break; case YoYo.RED: if (hasViolet) { currentYoYo = YoYo.VIOLET; ultPassivePwr = ultBreakPwr; cd = 75; } else if (hasYellow) { currentYoYo = YoYo.YELLOW; ultPassivePwr = ultParalysisPwr; cd = 60; } break; case YoYo.VIOLET: if (hasYellow) { currentYoYo = YoYo.YELLOW; ultPassivePwr = ultParalysisPwr; cd = 60; } else if (hasRed) { currentYoYo = YoYo.RED; ultPassivePwr = ultBurnPwr; cd = 45; } break; } skillThreeCooldownTime = cd; skillThreeTimer = skillThreeCooldownTime; }
private void DisplayViews() { YoYo.With(Techniques.FadeInUp) .Duration(400) .WithStartListener(animator => { txtPhone.Visibility = ViewStates.Visible; }) .PlayOn(FindViewById(Resource.Id.txtPhone)); YoYo.With(Techniques.FadeInUp) .Duration(400) .WithStartListener(animator => { txtPassword.Visibility = ViewStates.Visible; }) .PlayOn(FindViewById(Resource.Id.txtPassword)); YoYo.With(Techniques.FadeInUp) .Duration(400) .WithStartListener(animator => { btnLogin.Visibility = ViewStates.Visible; }) .PlayOn(FindViewById(Resource.Id.btnLogin)); }
public override View GenerateView(int position, ViewGroup parent) { var view = LayoutInflater.From(context).Inflate(Resource.Layout.listview_item, null); var swipeLayout = view.FindViewById <SwipeLayout> (GetSwipeLayoutResourceId(position)); swipeLayout.Opened += (sender, e) => { YoYo.With(Techniques.Tada) .Duration(500) .Delay(100) .PlayOn(e.Layout.FindViewById(Resource.Id.trash)); }; swipeLayout.DoubleClick += (sender, e) => { var pos = (int)view.Tag; Toast.MakeText(context, "DoubleClick " + pos, ToastLength.Short).Show(); }; view.FindViewById(Resource.Id.delete).Click += (sender, e) => { var pos = (int)view.Tag; Toast.MakeText(context, "click delete " + pos, ToastLength.Short).Show(); }; return(view); }