public SwipeActionViewHolder(SwipeLayout itemView) : base(itemView) { position = itemView.FindViewById <TextView>(ZC.Xamarin.Android.SwipeAction.Resource.Id.swipePosition); //textValue1 = itemView.FindViewById<TextView>(ZC.Xamarin.Android.SwipeAction.Resource.Id.textValue1); //textValue2 = itemView.FindViewById<RelativeLayout>(ZC.Xamarin.Android.SwipeAction.Resource.Id.SwipeRelativeLayoutContent); //textValue3 = itemView.FindViewById<TextView>(ZC.Xamarin.Android.SwipeAction.Resource.Id.textValue3); swipeLayout = itemView; swipe_content = itemView.FindViewById <LinearLayout>(ZC.Xamarin.Android.SwipeAction.Resource.Id.swipe_content); }
protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); SetContentView (Resource.Layout.main); //sample1 sample1 = FindViewById<SwipeLayout> (Resource.Id.sample1); sample1.SetShowMode (SwipeLayout.ShowMode.PullOut); sample1.AddDrag (SwipeLayout.DragEdge.Left, sample1.FindViewById (Resource.Id.bottom_wrapper)); sample1.AddDrag (SwipeLayout.DragEdge.Right, sample1.FindViewById (Resource.Id.bottom_wrapper_2)); sample1.AddDrag (SwipeLayout.DragEdge.Top, sample1.FindViewById (Resource.Id.starbott)); sample1.AddDrag (SwipeLayout.DragEdge.Bottom, sample1.FindViewById (Resource.Id.starbott)); sample1.AddRevealListener (Resource.Id.delete, (sender, e) => { }); sample1.SurfaceView.Click += (sender, e) => { Toast.MakeText (this, "Click on surface", ToastLength.Short).Show (); }; sample1.SurfaceView.LongClick += (sender, e) => { Toast.MakeText (this, "longClick on surface", ToastLength.Short).Show (); e.Handled = true; }; sample1.FindViewById (Resource.Id.star2).Click += (sender, e) => { Toast.MakeText (this, "Star", ToastLength.Short).Show (); }; sample1.FindViewById (Resource.Id.trash2).Click += (sender, e) => { Toast.MakeText (this, "Trash Bin", ToastLength.Short).Show (); }; sample1.FindViewById (Resource.Id.magnifier2).Click += (sender, e) => { Toast.MakeText (this, "Magnifier", ToastLength.Short).Show (); }; sample1.AddRevealListener (Resource.Id.starbott, (sender, e) => { View star = e.Child.FindViewById (Resource.Id.star); float d = e.Child.Height / 2 - star.Height / 2; ViewHelper.SetTranslationY (star, d * e.Fraction); ViewHelper.SetScaleX (star, e.Fraction + 0.6f); ViewHelper.SetScaleY (star, e.Fraction + 0.6f); }); //sample2 sample2 = FindViewById<SwipeLayout> (Resource.Id.sample2); sample2.SetShowMode (SwipeLayout.ShowMode.LayDown); sample2.AddDrag (SwipeLayout.DragEdge.Right, sample2.FindViewWithTag ("Bottom2")); sample2.FindViewById (Resource.Id.star).Click += (sender, e) => { Toast.MakeText (this, "Star", ToastLength.Short).Show (); }; sample2.FindViewById (Resource.Id.trash).Click += (sender, e) => { Toast.MakeText (this, "Trash Bin", ToastLength.Short).Show (); }; sample2.FindViewById (Resource.Id.magnifier).Click += (sender, e) => { Toast.MakeText (this, "Magnifier", ToastLength.Short).Show (); }; sample2.FindViewById (Resource.Id.click).Click += (sender, e) => { Toast.MakeText (this, "Yo!", ToastLength.Short).Show (); }; sample2.SurfaceView.Click += (sender, e) => { Toast.MakeText (this, "Click on surface", ToastLength.Short).Show (); }; //sample3 sample3 = FindViewById<SwipeLayout> (Resource.Id.sample3); sample3.AddDrag (SwipeLayout.DragEdge.Top, sample3.FindViewWithTag ("Bottom3")); sample3.AddRevealListener (Resource.Id.bottom_wrapper_child1, (sender, e) => { View star = e.Child.FindViewById (Resource.Id.star); float d = e.Child.Height / 2 - star.Height / 2; ViewHelper.SetTranslationY (star, d * e.Fraction); ViewHelper.SetScaleX (star, e.Fraction + 0.6f); ViewHelper.SetScaleY (star, e.Fraction + 0.6f); Color c = Evaluate (e.Fraction, Color.ParseColor ("#dddddd"), Color.ParseColor ("#4C535B")); e.Child.SetBackgroundColor (c); }); sample3.FindViewById (Resource.Id.bottom_wrapper_child1).Click += (sender, e) => { Toast.MakeText (this, "Yo!", ToastLength.Short).Show (); }; sample3.SurfaceView.Click += (sender, e) => { Toast.MakeText (this, "Click on surface", ToastLength.Short).Show (); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.main); //sample1 sample1 = FindViewById <SwipeLayout> (Resource.Id.sample1); sample1.SetShowMode(SwipeLayout.ShowMode.PullOut); sample1.AddDrag(SwipeLayout.DragEdge.Left, sample1.FindViewById(Resource.Id.bottom_wrapper)); sample1.AddDrag(SwipeLayout.DragEdge.Right, sample1.FindViewById(Resource.Id.bottom_wrapper_2)); sample1.AddDrag(SwipeLayout.DragEdge.Top, sample1.FindViewById(Resource.Id.starbott)); sample1.AddDrag(SwipeLayout.DragEdge.Bottom, sample1.FindViewById(Resource.Id.starbott)); sample1.AddRevealListener(Resource.Id.delete, (sender, e) => { }); sample1.SurfaceView.Click += (sender, e) => { Toast.MakeText(this, "Click on surface", ToastLength.Short).Show(); }; sample1.SurfaceView.LongClick += (sender, e) => { Toast.MakeText(this, "longClick on surface", ToastLength.Short).Show(); e.Handled = true; }; sample1.FindViewById(Resource.Id.star2).Click += (sender, e) => { Toast.MakeText(this, "Star", ToastLength.Short).Show(); }; sample1.FindViewById(Resource.Id.trash2).Click += (sender, e) => { Toast.MakeText(this, "Trash Bin", ToastLength.Short).Show(); }; sample1.FindViewById(Resource.Id.magnifier2).Click += (sender, e) => { Toast.MakeText(this, "Magnifier", ToastLength.Short).Show(); }; sample1.AddRevealListener(Resource.Id.starbott, (sender, e) => { View star = e.Child.FindViewById(Resource.Id.star); float d = e.Child.Height / 2 - star.Height / 2; ViewHelper.SetTranslationY(star, d * e.Fraction); ViewHelper.SetScaleX(star, e.Fraction + 0.6f); ViewHelper.SetScaleY(star, e.Fraction + 0.6f); }); //sample2 sample2 = FindViewById <SwipeLayout> (Resource.Id.sample2); sample2.SetShowMode(SwipeLayout.ShowMode.LayDown); sample2.AddDrag(SwipeLayout.DragEdge.Right, sample2.FindViewWithTag("Bottom2")); sample2.FindViewById(Resource.Id.star).Click += (sender, e) => { Toast.MakeText(this, "Star", ToastLength.Short).Show(); }; sample2.FindViewById(Resource.Id.trash).Click += (sender, e) => { Toast.MakeText(this, "Trash Bin", ToastLength.Short).Show(); }; sample2.FindViewById(Resource.Id.magnifier).Click += (sender, e) => { Toast.MakeText(this, "Magnifier", ToastLength.Short).Show(); }; sample2.FindViewById(Resource.Id.click).Click += (sender, e) => { Toast.MakeText(this, "Yo!", ToastLength.Short).Show(); }; sample2.SurfaceView.Click += (sender, e) => { Toast.MakeText(this, "Click on surface", ToastLength.Short).Show(); }; //sample3 sample3 = FindViewById <SwipeLayout> (Resource.Id.sample3); sample3.AddDrag(SwipeLayout.DragEdge.Top, sample3.FindViewWithTag("Bottom3")); sample3.AddRevealListener(Resource.Id.bottom_wrapper_child1, (sender, e) => { View star = e.Child.FindViewById(Resource.Id.star); float d = e.Child.Height / 2 - star.Height / 2; ViewHelper.SetTranslationY(star, d * e.Fraction); ViewHelper.SetScaleX(star, e.Fraction + 0.6f); ViewHelper.SetScaleY(star, e.Fraction + 0.6f); Color c = Evaluate(e.Fraction, Color.ParseColor("#dddddd"), Color.ParseColor("#4C535B")); e.Child.SetBackgroundColor(c); }); sample3.FindViewById(Resource.Id.bottom_wrapper_child1).Click += (sender, e) => { Toast.MakeText(this, "Yo!", ToastLength.Short).Show(); }; sample3.SurfaceView.Click += (sender, e) => { Toast.MakeText(this, "Click on surface", ToastLength.Short).Show(); }; }