예제 #1
0
        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);
        }
예제 #2
0
        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);
                }
            };
        }
예제 #3
0
        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));
        }
예제 #4
0
        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);
        }