Ejemplo n.º 1
0
        public View GetView(int position, View convertView, ViewGroup parent)
        {
            SwipeMenuLayout layout = null;

            if (convertView == null)
            {
                View      contentView = mAdapter.GetView(position, convertView, parent);
                SwipeMenu menu        = new SwipeMenu(mContext);
                menu.SetViewType(GetItemViewType(position));
                CreateMenu(menu);
                SwipeMenuView menuView = new SwipeMenuView(menu, (SwipeMenuListView)parent)
                {
                    SwipeItemClickListener = this
                };
                SwipeMenuListView listView = (SwipeMenuListView)parent;
                layout = new SwipeMenuLayout(contentView, menuView, listView.CloseInterpolator, listView.OpenInterpolator);
                layout.SetPosition(position);
            }
            else
            {
                layout = (SwipeMenuLayout)convertView;
                layout.CloseMenu();
                layout.SetPosition(position);
                View view = mAdapter.GetView(position, layout.ContentView,
                                             parent);
            }
            if (mAdapter is BaseSwipListAdapter)
            {
                bool swipEnable = (((BaseSwipListAdapter)mAdapter).getSwipEnableByPosition(position));
                layout.SwipEnable = swipEnable;
            }
            return(layout);
        }
Ejemplo n.º 2
0
        public SwipeMenuView(SwipeMenu menu, SwipeMenuListView listView) : base(menu.Context)
        {
            mListView = listView;
            mMenu     = menu;
            List <SwipeMenuItem> items = menu.GetMenuItems();
            int id = 0;

            foreach (SwipeMenuItem item in items)
            {
                AddItem(item, id++);
            }
        }