示例#1
0
        public void SetLayoutManager(CircularRecyclerLayoutManager manager, ViewHolder selectVh = null)
        {
            if (layoutManager == manager)
            {
                return;
            }

            if (selectVh != null)
            {
                currentIndex = selectVh.BindingIndex;
            }
            else
            {
                //Show Watchface view
                currentIndex = CENTER_INDEX;
            }

            layoutManager = manager;
            layoutManager.animator.animationFinished += FinishAnimation;

            extraItemIdx = currentIndex;
            layoutManager.OrderByIndex(this);
            if (adapter.GetItemCount() == 1)
            {
                MakeLastWidgetPage(1);
            }
            MakeLastNotifyPage();
        }
示例#2
0
        public void SetAdapter(Adapter adapter)
        {
            this.adapter = adapter;
            int dataCount = adapter.GetItemCount();
            int sIdx      = CENTER_INDEX;

            for (int i = 0; i < DefaultLayoutManager.CIRCLE_ITEM_COUNT; i++)
            {
                ViewHolder holder = adapter.OnCreateViewHolder();
                holder.BindingIndex = i;

                View childView = holder.GetView();

                viewHolderList.Add(holder);
                if (i < dataCount)
                {
                    adapter.OnBindViewHolder(holder, sIdx++);
                }
                containerView.Add(childView);
            }
            layoutManager.OrderByIndex(this);
        }