Esempio n. 1
0
        private void setLockSwipe(bool lockSwipe, params string[] ids)
        {
            if (ids == null || ids.Length == 0)
            {
                return;
            }

            if (lockSwipe)
            {
                foreach (var item in ids)
                {
                    lockedSwipeSet.TryAdd(item, 0);
                }
            }
            else
            {
                foreach (var item in ids)
                {
                    byte ignore = 0;
                    lockedSwipeSet.TryRemove(item, out ignore);
                }
            }

            foreach (string item in ids)
            {
                SwipeRevealLayout layout = mapLayouts.get(item);
                if (layout != null)
                {
                    layout.setLockDrag(lockSwipe);
                }
            }
        }
Esempio n. 2
0
        /**
         * Close others swipe layout.
         * @param id layout which bind with this data object id will be excluded.
         * @param swipeLayout will be excluded.
         */
        private void closeOthers(String id, SwipeRevealLayout swipeLayout)
        {
            lock (stateChangeLock)
            {
                // close other rows if openOnlyOne is true.
                if (getOpenCount() > 1)
                {
                    var keys = mapStates.Keys.ToList();
                    foreach (var key in keys)
                    {
                        if (key != id)
                        {
                            mapStates[key] = SwipeRevealLayout.STATE_CLOSE;
                        }
                    }

                    foreach (SwipeRevealLayout layout in mapLayouts.Values)
                    {
                        if (layout != swipeLayout)
                        {
                            layout.close(true);
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        /**
         * Close a specific layout.
         * @param id unique id which identifies the data object which is bind to the layout.
         */
        public void closeLayout(string id)
        {
            lock (stateChangeLock)
            {
                mapStates.put(id, SwipeRevealLayout.STATE_CLOSE);

                SwipeRevealLayout layout = null;
                if (mapLayouts.TryGetValue(id, out layout) && layout != null)
                {
                    layout.close(true);
                }
            }
        }
Esempio n. 4
0
        /**
         * Open a specific layout.
         * @param id unique id which identifies the data object which is bind to the layout.
         */
        public void openLayout(string id)
        {
            lock (stateChangeLock)
            {
                mapStates.put(id, SwipeRevealLayout.STATE_OPEN);

                SwipeRevealLayout layout = null;
                if (mapLayouts.TryGetValue(id, out layout) && layout != null)
                {
                    layout.open(true);
                }
                else if (openOnlyOne)
                {
                    closeOthers(id, mapLayouts.get(id));
                }
            }
        }
Esempio n. 5
0
        /**
         * Help to save and restore open/close state of the swipeLayout. Call this method
         * when you bind your view holder with the data object.
         *
         * @param swipeLayout swipeLayout of the current view.
         * @param id a string that uniquely defines the data object of the current view.
         */
        public void bind(SwipeRevealLayout swipeLayout, string id)
        {
            base.ExecuteMethod("bind", delegate()
            {
                if (swipeLayout.shouldRequestLayout())
                {
                    swipeLayout.RequestLayout();
                }

                mapLayouts.removeAllWithValue(swipeLayout);
                mapLayouts.put(id, swipeLayout);

                swipeLayout.abort();

                swipeLayout.setDragStateChangeListener(new CustomListener(this, swipeLayout, id));


                // first time binding.
                if (!mapStates.ContainsKey(id))
                {
                    mapStates.put(id, SwipeRevealLayout.STATE_CLOSE);
                    swipeLayout.close(false);
                }

                // not the first time, then close or open depends on the current state.
                else
                {
                    int state = mapStates.get(id);

                    if (state == SwipeRevealLayout.STATE_CLOSE || state == SwipeRevealLayout.STATE_CLOSING ||
                        state == SwipeRevealLayout.STATE_DRAGGING)
                    {
                        swipeLayout.close(false);
                    }
                    else
                    {
                        swipeLayout.open(false);
                    }
                }

                // set lock swipe
                swipeLayout.setLockDrag(lockedSwipeSet.ContainsKey(id));
            });
        }
Esempio n. 6
0
 public CustomViewDragHelper(SwipeRevealLayout layout)
 {
     _layout = layout;
 }
Esempio n. 7
0
 public CustomGestureListener(SwipeRevealLayout layout)
 {
     _layout = layout;
 }
Esempio n. 8
0
 public void onSlide(SwipeRevealLayout view, float slideOffset)
 {
 }
Esempio n. 9
0
 public void onOpened(SwipeRevealLayout view)
 {
 }
Esempio n. 10
0
 public void onClosed(SwipeRevealLayout view)
 {
 }
Esempio n. 11
0
 public CustomListener(SwipeRevealLayoutViewBinderHelper helper, SwipeRevealLayout swipeLayout, string id)
 {
     _swipeLayout = swipeLayout;
     _helper      = helper;
     _id          = id;
 }