示例#1
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            var item = ItemsList[indexPath.Row];

            if (ConfigStyle.DropMode == SupportAutoCompleteDropMode.TitleWithDescription)
            {
                var cellChild = tableView.DequeueReusableCell("DropItemTitleDescriptionID") as DropItemTitleDescription;
                cellChild = new DropItemTitleDescription();
                var viewChild = NSBundle.MainBundle.LoadNib("DropItemTitleDescription", cellChild, null);
                cellChild = Runtime.GetNSObject(viewChild.ValueAt(0)) as DropItemTitleDescription;
                cellChild.BindDataToCell(item, delegate {
                    IDropItemSelected.IF_ItemSelectd(indexPath.Row);
                }, ConfigStyle, IsShowCheckbox);
                return(cellChild);
            }
            else if (ConfigStyle.DropMode == SupportAutoCompleteDropMode.IconAndTitle)
            {
                var cellChild = tableView.DequeueReusableCell("DropItemIconTitleID") as DropItemIconTitle;
                cellChild = new DropItemIconTitle();
                var viewChild = NSBundle.MainBundle.LoadNib("DropItemIconTitle", cellChild, null);
                cellChild = Runtime.GetNSObject(viewChild.ValueAt(0)) as DropItemIconTitle;
                cellChild.BindDataToCell(item, delegate {
                    IDropItemSelected.IF_ItemSelectd(indexPath.Row);
                }, ConfigStyle, IsShowCheckbox);
                return(cellChild);
            }
            else if (ConfigStyle.DropMode == SupportAutoCompleteDropMode.FullTextAndIcon)
            {
                var cellChild = tableView.DequeueReusableCell("DropItemFullTextIconID") as DropItemFullTextIcon;
                cellChild = new DropItemFullTextIcon();
                var viewChild = NSBundle.MainBundle.LoadNib("DropItemFullTextIcon", cellChild, null);
                cellChild = Runtime.GetNSObject(viewChild.ValueAt(0)) as DropItemFullTextIcon;
                cellChild.BindDataToCell(item, delegate {
                    IDropItemSelected.IF_ItemSelectd(indexPath.Row);
                }, ConfigStyle, IsShowCheckbox);
                return(cellChild);
            }
            else
            {
                var cellChild = tableView.DequeueReusableCell("DropItemSingleTitleID") as DropItemSingleTitle;
                cellChild = new DropItemSingleTitle();
                var viewChild = NSBundle.MainBundle.LoadNib("DropItemSingleTitle", cellChild, null);
                cellChild = Runtime.GetNSObject(viewChild.ValueAt(0)) as DropItemSingleTitle;
                cellChild.BindDataToCell(item, delegate {
                    IDropItemSelected.IF_ItemSelectd(indexPath.Row);
                }, ConfigStyle, IsShowCheckbox);
                return(cellChild);
            }
        }
示例#2
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            var cellChild = tableView.DequeueReusableCell("GalleryDirectoryViewCell") as GalleryDirectoryViewCell;

            cellChild = new GalleryDirectoryViewCell();
            var viewChild = NSBundle.MainBundle.LoadNib("GalleryDirectoryViewCell", cellChild, null);

            cellChild     = Runtime.GetNSObject(viewChild.ValueAt(0)) as GalleryDirectoryViewCell;
            cellChild.Tag = indexPath.Row;
            cellChild.BindDataToCell(galleryDirectories[indexPath.Row], delegate {
                IDropItemSelected.IF_ItemSelectd(indexPath.Row);
            });
            return(cellChild);
        }
示例#3
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            TextView  txtTitle = null, txtDescription = null, txtSeperator = null;
            ImageView imgIcon = null;
            Button    bttClick;
            CheckBox  checkBox = null;

            IAutoDropItem item = items[position];

            if (ConfigStyle.DropMode == SupportAutoCompleteDropMode.TitleWithDescription)
            {
                convertView    = LayoutInflater.From(mContext).Inflate(Resource.Layout.layout_title_and_description, parent, false);
                txtDescription = convertView.FindViewById <TextView>(Resource.Id.txtDescription);
            }
            else if (ConfigStyle.DropMode == SupportAutoCompleteDropMode.IconAndTitle)
            {
                convertView = LayoutInflater.From(mContext).Inflate(Resource.Layout.layout_title_and_icon, parent, false);
                imgIcon     = convertView.FindViewById <ImageView>(Resource.Id.imgIcon);
            }
            else if (ConfigStyle.DropMode == SupportAutoCompleteDropMode.FullTextAndIcon)
            {
                convertView    = LayoutInflater.From(mContext).Inflate(Resource.Layout.layout_full_text_and_icon, parent, false);
                txtDescription = convertView.FindViewById <TextView>(Resource.Id.txtDescription);
                imgIcon        = convertView.FindViewById <ImageView>(Resource.Id.imgIcon);
            }
            else
            {
                convertView = LayoutInflater.From(mContext).Inflate(Resource.Layout.layout_single_title, parent, false);
            }

            txtTitle     = convertView.FindViewById <TextView>(Resource.Id.txtTitle);
            txtSeperator = convertView.FindViewById <TextView>(Resource.Id.txtSeperator);
            bttClick     = convertView.FindViewById <Button>(Resource.Id.bttClick);


            txtTitle.Text = item.IF_GetTitle();
            if (txtDescription != null)
            {
                txtDescription.Text = item.IF_GetDescription();
                txtDescription.SetTextColor(ConfigStyle.DescriptionTextColor.ToAndroid());
            }
            txtSeperator.SetBackgroundColor(ConfigStyle.SeperatorColor.ToAndroid());

            bttClick.Click += (sender, e) => {
                IDropItemSelected.IF_ItemSelectd(position);
            };

            try
            {
                if (imgIcon != null)
                {
                    if (item.IF_GetIcon() != null)
                    {
                        var image = Context.Resources.GetIdentifier(item.IF_GetIcon(), "drawable", Context.PackageName);
                        imgIcon.SetImageResource(image);
                    }
                }
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
            return(convertView);
        }
示例#4
0
        public override View GetDropDownView(int position, View convertView, ViewGroup parent)
        {
            IAutoDropItem item   = items[position];
            ViewHolder    holder = null;

            if (convertView == null)
            {
                holder = new ViewHolder();
                if (ConfigStyle.DropMode == SupportAutoCompleteDropMode.TitleWithDescription)
                {
                    convertView           = LayoutInflater.From(mContext).Inflate(Resource.Layout.layout_title_and_description, parent, false);
                    holder.txtDescription = convertView.FindViewById <TextView>(Resource.Id.txtDescription);
                }
                else if (ConfigStyle.DropMode == SupportAutoCompleteDropMode.IconAndTitle)
                {
                    convertView    = LayoutInflater.From(mContext).Inflate(Resource.Layout.layout_title_and_icon, parent, false);
                    holder.imgIcon = convertView.FindViewById <ImageView>(Resource.Id.imgIcon);
                }
                else if (ConfigStyle.DropMode == SupportAutoCompleteDropMode.FullTextAndIcon)
                {
                    convertView           = LayoutInflater.From(mContext).Inflate(Resource.Layout.layout_full_text_and_icon, parent, false);
                    holder.txtDescription = convertView.FindViewById <TextView>(Resource.Id.txtDescription);
                    holder.imgIcon        = convertView.FindViewById <ImageView>(Resource.Id.imgIcon);
                }
                else
                {
                    convertView = LayoutInflater.From(mContext).Inflate(Resource.Layout.layout_single_title, parent, false);
                }

                holder.txtTitle        = convertView.FindViewById <TextView>(Resource.Id.txtTitle);
                holder.txtSeperator    = convertView.FindViewById <TextView>(Resource.Id.txtSeperator);
                holder.bttClick        = convertView.FindViewById <Button>(Resource.Id.bttClick);
                holder.checkBox        = convertView.FindViewById <CheckBox>(Resource.Id.checkBox);
                holder.bttClick.Click += (sender, e) => {
                    IDropItemSelected.IF_ItemSelectd(position);
                };

                convertView.Tag = (holder);
            }
            else
            {
                holder = (ViewHolder)convertView.Tag;
            }

            holder.txtTitle.Text = item.IF_GetTitle();
            if (holder.txtDescription != null)
            {
                holder.txtDescription.Text = item.IF_GetDescription();
                holder.txtDescription.SetTextColor(ConfigStyle.DescriptionTextColor.ToAndroid());
            }
            holder.txtSeperator.SetBackgroundColor(ConfigStyle.SeperatorColor.ToAndroid());
            holder.checkBox.Visibility = ConfigStyle.IsAllowMultiSelect ? ViewStates.Visible : ViewStates.Gone;
            holder.checkBox.Tag        = (position);
            holder.checkBox.Checked    = item.IF_GetChecked();

            try
            {
                if (holder.imgIcon != null)
                {
                    if (item.IF_GetIcon() != null)
                    {
                        var image = Context.Resources.GetIdentifier(item.IF_GetIcon(), "drawable", Context.PackageName);
                        holder.imgIcon.SetImageResource(image);
                    }
                }
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }

            return(convertView);
        }