public void Bind(View view, int position) { int resId = swipeAdapterInterface.GetSwipeLayoutResourceId(position); SwipeLayout swipeLayout = view.FindViewById<SwipeLayout>(resId); if (swipeLayout == null) throw new IllegalStateException("can not find SwipeLayout in target view"); if (swipeLayout.GetTag(resId) == null) { OnLayoutListener onLayoutListener = new OnLayoutListener(this, position); SwipeMemory swipeMemory = new SwipeMemory(this, position); swipeLayout.AddSwipeListener(swipeMemory); swipeLayout.AddOnLayoutListener(onLayoutListener); swipeLayout.SetTag(resId, new ValueBox(position, swipeMemory, onLayoutListener)); mShownLayouts.Add(swipeLayout); } else { ValueBox valueBox = (ValueBox) swipeLayout.GetTag(resId); valueBox.SwipeMemory.Position = position; valueBox.OnLayoutListener.Position = position; valueBox.Position = position; } }
public ValueBox(int position, SwipeMemory swipeMemory, OnLayoutListener onLayoutListener) { this.SwipeMemory = swipeMemory; this.OnLayoutListener = onLayoutListener; Position = position; }
public void AddOnLayoutListener(OnLayoutListener l) { if (OnLayoutListeners == null) OnLayoutListeners = new List<OnLayoutListener>(); OnLayoutListeners.Add(l); }