Ejemplo n.º 1
0
		protected override View GetCellCore (Cell item, View convertView, ViewGroup parent, Context context)
		{
			var cell = (LinearLayout)base.GetCellCore(item, convertView, parent, context);
			cell.SetPadding(20, 30, 0, 30);
			cell.DividerPadding = 50;

			var div = new ShapeDrawable();
			div.SetIntrinsicHeight(1);
			div.Paint.Set(new Paint { Color = Color.FromHex("00FFFFFF").ToAndroid() });

			if (parent is ListView)
			{
				((ListView)parent).Divider = div;
				((ListView)parent).DividerHeight = 1;
			}

			var image = (ImageView)cell.GetChildAt(0);
			image.SetScaleType(ImageView.ScaleType.FitCenter);

			image.LayoutParameters.Width = 60;
			image.LayoutParameters.Height = 60;

			var linear = (LinearLayout)cell.GetChildAt(1);
			linear.SetGravity(GravityFlags.CenterVertical);

			var label = (TextView)linear.GetChildAt(0);
			label.SetTextColor(Color.White.ToAndroid());
			label.TextSize = Font.SystemFontOfSize(NamedSize.Medium).ToScaledPixel() * 1.25f;
			label.Gravity = (GravityFlags.CenterVertical);
			label.SetTextColor(Color.FromHex("FFFFFF").ToAndroid());
			var secondaryLabel = (TextView)linear.GetChildAt(1);
			secondaryLabel.Visibility = ViewStates.Gone;

			return cell;
		}
        protected override global::Android.Views.View GetCellCore(Xamarin.Forms.Cell item, global::Android.Views.View convertView, global::Android.Views.ViewGroup parent, global::Android.Content.Context context)
        {
            var cell = base.GetCellCore(item, convertView, parent, context) as ViewGroup;

            cell.SetOnDragListener(new ItemDragListener(cell));
            return(cell);
        }
Ejemplo n.º 3
0
		protected override Android.Views.View GetCellCore (Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Android.Content.Context context) {
			var cell = (LinearLayout)base.GetCellCore (item, convertView, parent, context);
			var label = (TextView)((LinearLayout)cell.GetChildAt(1)).GetChildAt(0);
			Typeface font = Typeface.CreateFromAsset (Forms.Context.Assets, "HelveticaTEDBold.otf");
			label.Typeface = font;
			return cell;
		}
		protected override View GetCellCore (Cell item, View convertView, ViewGroup parent, Context context)
		{
			var cell = (LinearLayout)base.GetCellCore (item, convertView, parent, context);
			cell.SetPadding(20, 10, 0, 10);
			cell.DividerPadding = 50;

			var div = new ShapeDrawable();
			div.SetIntrinsicHeight(1);
			//div.Paint.Set(new Paint { Color = Color.FromHex("00FFFFFF").ToAndroid() });

			if (parent is ListView) {
				((ListView)parent).Divider = div;
				((ListView)parent).DividerHeight = 1;
			}


			var label = (TextView)((LinearLayout)cell.GetChildAt(1)).GetChildAt(0);
			label.SetTextColor(Color.FromHex("000000").ToAndroid());
			label.TextSize = Font.SystemFontOfSize(NamedSize.Large).ToScaledPixel();

			var secondaryLabel = (TextView)((LinearLayout)cell.GetChildAt(1)).GetChildAt(1);
			secondaryLabel.SetTextColor(Color.FromHex("738182").ToAndroid());
			secondaryLabel.TextSize = Font.SystemFontOfSize(NamedSize.Medium).ToScaledPixel();


			return cell;
		}
 // Get the cell and add the disclosure indicator if the bindable property was set to true.
 public override UITableViewCell GetCell(Cell item,  UITableViewCell reusableCell, UITableView tv)
 {
     var cell = base.GetCell (item, reusableCell, tv);
     if( ( (DisclosureImageCell) item ).DisclosureEnabled)
         cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
     return cell;
 }
        public override UIKit.UITableViewCell GetCell(Cell item, UIKit.UITableViewCell reusableCell, UIKit.UITableView tv)
        {
            var cell = base.GetCell(item, reusableCell, tv);
            cell.SelectionStyle = UIKit.UITableViewCellSelectionStyle.None;

            return cell;
        }
Ejemplo n.º 7
0
        protected override View GetCellCore(Cell item, View convertView, ViewGroup parent, Context context)
        {
            var inflatorservice = (LayoutInflater)Forms.Context.GetSystemService(Android.Content.Context.LayoutInflaterService);
            var dataContext = item.BindingContext as EventViewModel;

            var textMsgVm = dataContext as TextMessageViewModel;
            if (textMsgVm != null)
            {
                if (textMsgVm.ImageId.HasValue)
                {
                    var template = (LinearLayout)inflatorservice.Inflate(textMsgVm.IsMine ? Resource.Layout.image_item_owner : Resource.Layout.image_item_opponent, null, false);
                    //template.FindViewById<TextView>(Resource.Id.timestamp).Text = textMsgVm.Timestamp.ToString("HH:mm");
                    template.FindViewById<TextView>(Resource.Id.nick).Text = textMsgVm.IsMine ? "Me:" : textMsgVm.AuthorName + ":";
                    template.FindViewById<ImageView>(Resource.Id.image).SetImageBitmap(GetImageBitmapFromUrl(textMsgVm.ImageUrl));
                    return template;
                }
                else
                {
                    var template = (LinearLayout)inflatorservice.Inflate(textMsgVm.IsMine ? Resource.Layout.message_item_owner : Resource.Layout.message_item_opponent, null, false);
                    //template.FindViewById<TextView>(Resource.Id.timestamp).Text = textMsgVm.Timestamp.ToString("HH:mm");
                    template.FindViewById<TextView>(Resource.Id.nick).Text = textMsgVm.IsMine ? "Me:" : textMsgVm.AuthorName + ":";
                    template.FindViewById<TextView>(Resource.Id.message).Text = textMsgVm.Text;
                    return template;
                }
            }

            return base.GetCellCore(item, convertView, parent, context);
        }
		public override UITableViewCell GetCell (Cell item, UITableViewCell reusableCell, UITableView tv)
		{
            var extendedCell = (ExtendedViewCell) item;
            _tableView = _tableView ?? tv;

			var cell = base.GetCell(item, reusableCell, tv);
            if (cell != null)
            {
                cell.SelectionStyle = extendedCell.HighlightSelection ? UITableViewCellSelectionStyle.Default : UITableViewCellSelectionStyle.None;

                cell.BackgroundColor = extendedCell.BackgroundColor.ToUIColor();
                cell.SeparatorInset = new UIEdgeInsets((float) extendedCell.SeparatorPadding.Top, (float) extendedCell.SeparatorPadding.Left,
                    (float) extendedCell.SeparatorPadding.Bottom, (float) extendedCell.SeparatorPadding.Right);
                SetDiscolosure(extendedCell, cell);

                if (!_cellMappings.ContainsKey(extendedCell))
                    extendedCell.PropertyChanged += ExtendedCellOnPropertyChanged;

                _cellMappings[extendedCell] = cell;
            }
            if (!extendedCell.ShowSeparator)
                tv.SeparatorStyle = UITableViewCellSeparatorStyle.None;
            tv.SeparatorColor = extendedCell.SeparatorColor.ToUIColor();
            return cell;
        }
Ejemplo n.º 9
0
        public override UITableViewCell GetCell(Xamarin.Forms.Cell item, UITableView tv)
        {
            TextCell             textCell       = (TextCell)item;
            UITableViewCellStyle style          = UITableViewCellStyle.Value1;
            string            text              = "Xamarin.Forms.TextCell";
            CellTableViewCell cellTableViewCell = tv.DequeueReusableCell(text) as CellTableViewCell;

            if (cellTableViewCell == null)
            {
                cellTableViewCell = new CellTableViewCell(style, text);
            }
            else
            {
                cellTableViewCell.Cell.PropertyChanged -= new PropertyChangedEventHandler(cellTableViewCell.HandlePropertyChanged);
            }
            cellTableViewCell.Cell                 = textCell;
            textCell.PropertyChanged              += new PropertyChangedEventHandler(cellTableViewCell.HandlePropertyChanged);
            cellTableViewCell.PropertyChanged      = new Action <object, PropertyChangedEventArgs>(this.HandlePropertyChanged);
            cellTableViewCell.TextLabel.Text       = textCell.Text;
            cellTableViewCell.DetailTextLabel.Text = textCell.Detail;
            //cellTableViewCell.TextLabel.TextColor = textCell.TextColor.ToUIColor(TextCellRenderer.DefaultTextColor);
            //cellTableViewCell.DetailTextLabel.TextColor = textCell.DetailColor.ToUIColor(TextCellRenderer.DefaultDetailColor);
            base.UpdateBackground(cellTableViewCell, item);


            cellTableViewCell.Accessory = UITableViewCellAccessory.DisclosureIndicator;

            return(cellTableViewCell);
        }
Ejemplo n.º 10
0
        protected override Android.Views.View GetCellCore(Xamarin.Forms.Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Android.Content.Context context)
        {
            var formsCell  = item as PhotoViewCell;
            var nativeCell = convertView as PhotoNativeCell;

            if (nativeCell == null)
            {
                // Creating a new real native cell.
                // 新規セル生成処理
                nativeCell = new PhotoNativeCell(context, formsCell);
            }

            // Unsubscribe the privious formscell propertychanged event on the nativecell.
            nativeCell.PhotoViewCell.PropertyChanged -= nativeCell.CellPropertyChanged;

            // Update the formscell reffered by the nativecell.
            nativeCell.PhotoViewCell = formsCell;

            // Subscribe the current formscell propertychanged event on the nativecell.
            nativeCell.PhotoViewCell.PropertyChanged += nativeCell.CellPropertyChanged;

            // Update the nativecell contents with the current formscell contents.
            nativeCell.UpdateCell();

            return(nativeCell);
        }
Ejemplo n.º 11
0
        //TODO add a lookup for the cells we piggy back of.
        protected override Android.Views.View GetCellCore(Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Android.Content.Context context)
        {
            var cellCache = FastCellCache.Instance.GetCellCache (parent);
            var fastCell = item as FastCell;

            Android.Views.View cellCore = convertView;

            if (cellCore != null && cellCache.IsCached (cellCore, fastCell.ReuseIdentifier)) {
                cellCache.RecycleCell (cellCore, fastCell);
            } else {
            //				var newCell = (FastCell) Activator.CreateInstance (item.GetType ());
            //				newCell.BindingContext = item.BindingContext;
            //				newCell.Parent = item.Parent;
            //
            //				if (!newCell.IsInitialized) {
            //					newCell.PrepareCell ();
            //				}
            //				cellCore = base.GetCellCore (newCell, convertView, parent, context);
            //				cellCache.CacheCell (newCell, cellCore);
            //
                if (!fastCell.IsInitialized) {
                    fastCell.PrepareCell ();
                }
                cellCore = base.GetCellCore (fastCell, convertView, parent, context);
                cellCache.CacheCell (fastCell, cellCore);
            }
            return cellCore;
        }
Ejemplo n.º 12
0
		public override UIKit.UITableViewCell GetCell (Cell item, UIKit.UITableViewCell reusableCell, UIKit.UITableView tv)
		{
			var cell = base.GetCell (item, reusableCell, tv);
			cell.Accessory = UIKit.UITableViewCellAccessory.DisclosureIndicator;

			return cell;
		}
        protected override Android.Views.View GetCellCore(Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Android.Content.Context context)
        {
            var cell = (TextLabelCell)item;

            var view = convertView;

            if (view == null) {
                view = (context as Activity).LayoutInflater.Inflate(Resource.Layout.cell, null);
            }

            TextView label =  (Android.Widget.TextView)view.FindViewById (Resource.Id.textLabel);
            label.Text = cell.Label;

            label.SetTextColor (cell.LabelColor.ToAndroid ());

            if (cell.XAlign == Xamarin.Forms.TextAlignment.Center) {
                label.Gravity = GravityFlags.Center;
            }

            // Detail on the right
            TextView DetailText = (Android.Widget.TextView) view.FindViewById (Resource.Id.detailTextLabel);

            if (cell.Text != null)
                DetailText.Text = cell.Text;
            else
                DetailText.Visibility = Android.Views.ViewStates.Invisible;

            view.SetBackgroundColor (cell.BackgroundColor.ToAndroid ());

            return view;
        }
Ejemplo n.º 14
0
 public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
 {
     var obj = base.GetCell(item, reusableCell, tv);
     var cellEx = item as TextCellEx;
     if (!cellEx.IsShow)
     {
         obj.Accessory = UITableViewCellAccessory.None;
     }
     else
     {
         switch (cellEx.ShowIndicator)
         {
         case RightIndicator.Entry:
             obj.Accessory = UITableViewCellAccessory.DisclosureIndicator;
             break;
         case RightIndicator.Check:
             obj.Accessory = UITableViewCellAccessory.Checkmark;
             break;
         case RightIndicator.None:
             obj.Accessory = UITableViewCellAccessory.None;
             break;
         }
     }
     return obj;
 }
    protected override Android.Views.View GetCellCore(Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Context context)
		{
      var cell = (LinearLayout)base.GetCellCore(item, convertView, parent, context);
      var image = (ImageView)cell.GetChildAt(0);
      image.SetScaleType(ImageView.ScaleType.CenterCrop);
      return cell;
		}
        public override UITableViewCell GetCell(Cell item, UITableView tv)
        {
            var extendedCell = (ExtendedViewCell)item;
            var cell = base.GetCell (item, tv);
            if (cell != null) {
                cell.BackgroundColor = extendedCell.BackgroundColor.ToUIColor ();
                cell.SeparatorInset = new UIEdgeInsets ((float)extendedCell.SeparatorPadding.Top, (float)extendedCell.SeparatorPadding.Left,
                    (float)extendedCell.SeparatorPadding.Bottom, (float)extendedCell.SeparatorPadding.Right);

                if (extendedCell.ShowDisclousure) {
                    cell.Accessory = MonoTouch.UIKit.UITableViewCellAccessory.DisclosureIndicator;
                    if (!string.IsNullOrEmpty (extendedCell.DisclousureImage)) {
                        var detailDisclosureButton = UIButton.FromType (UIButtonType.Custom);
                        detailDisclosureButton.SetImage (UIImage.FromBundle (extendedCell.DisclousureImage), UIControlState.Normal);
                        detailDisclosureButton.SetImage (UIImage.FromBundle (extendedCell.DisclousureImage), UIControlState.Selected);

                        detailDisclosureButton.Frame = new RectangleF (0f, 0f, 30f, 30f);
                        detailDisclosureButton.TouchUpInside += (object sender, EventArgs e) => {
                            var index = tv.IndexPathForCell (cell);
                            tv.SelectRow (index, true, UITableViewScrollPosition.None);
                            tv.Source.AccessoryButtonTapped (tv, index);
                        };
                        cell.AccessoryView = detailDisclosureButton;
                    }
                }
            }

            if(!extendedCell.ShowSeparator)
                tv.SeparatorStyle = UITableViewCellSeparatorStyle.None;

            tv.SeparatorColor = extendedCell.SeparatorColor.ToUIColor();

            return cell;
        }
Ejemplo n.º 17
0
        protected override View GetCellCore (Cell item, View convertView, ViewGroup parent, Context context)
        {
            var cell = (LinearLayout)base.GetCellCore (item, convertView, parent, context);
            cell.SetPadding(20, 10, 0, 10);
            cell.DividerPadding = 50;

            var div = new ShapeDrawable();
            div.SetIntrinsicHeight(1);

            div.Paint.Set(new Paint { Color = MobileCRM.Shared.Helpers.AppColors.SEPARATOR.ToAndroid() });


            if (parent is ListView) {
                ((ListView)parent).Divider = div;
                ((ListView)parent).DividerHeight = 1;
            }


            var label = (TextView)((LinearLayout)cell.GetChildAt(1)).GetChildAt(0);


            label.SetTextColor(MobileCRM.Shared.Helpers.AppColors.LABELWHITE.ToAndroid());

            
            label.TextSize = Font.SystemFontOfSize(NamedSize.Large).ToScaledPixel();

            var secondaryLabel = (TextView)((LinearLayout)cell.GetChildAt(1)).GetChildAt(1);

            secondaryLabel.SetTextColor(MobileCRM.Shared.Helpers.AppColors.LABELBLUE.ToAndroid());
           
            secondaryLabel.TextSize = Font.SystemFontOfSize(NamedSize.Medium).ToScaledPixel();


            return cell;
        }
        public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell,
            UITableView tv)
        {
            var cell = base.GetCell(item, reusableCell, tv);
            switch (item.StyleId)
            {
                case "none":
                    cell.Accessory = UITableViewCellAccessory.None;
                    break;

                case "checkmark":
                    cell.Accessory = UITableViewCellAccessory.Checkmark;
                    break;

                case "detail-button":
                    cell.Accessory = UITableViewCellAccessory.DetailButton;
                    break;

                case "detail-disclosure-button":
                    cell.Accessory = UITableViewCellAccessory.DetailDisclosureButton;
                    break;

                case "disclosure":
                    cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
                    break;

                default:
                    cell.Accessory = UITableViewCellAccessory.None;
                    break;
            }
            return cell;
        }
 public override UIKit.UITableViewCell GetCell(Cell item, UIKit.UITableViewCell reusableCell,
     UIKit.UITableView tv)
 {
     var cell = base.GetCell(item, reusableCell, tv);
     cell.Accessory = CellAccessoryHelper.GetCellAccessory(item.StyleId);
     return cell;
 }
Ejemplo n.º 20
0
        public override UITableViewCell GetCell(Xamarin.Forms.Cell item, UITableViewCell reusableCell, UITableView tv)
        {
            var x = (NativeCell)item;

            Console.WriteLine(x);

            NativeiOSCell c = reusableCell as NativeiOSCell;

            if (c == null)
            {
                c = new NativeiOSCell(s_rid);
            }

            UIImage i = null;

            if (!string.IsNullOrWhiteSpace(x.ImageFilename))
            {
                i = UIImage.FromFile("Images/" + x.ImageFilename + ".jpg");
            }

            base.WireUpForceUpdateSizeRequested(item, c, tv);

            c.UpdateCell(x.Name, x.Category, i);

            return(c);
        }
		public override UIKit.UITableViewCell GetCell (Cell item, UIKit.UITableViewCell reusableCell, UIKit.UITableView tv)
		{
			var cell = base.GetCell (item, reusableCell, tv);
			cell.SeparatorInset = UIEdgeInsets.Zero;
			cell.TextLabel.Font = UIFont.FromName ("baskervillebecker", 18f);
			return cell;
		}
        public override UITableViewCell GetCell (Cell item, UITableView tv)
        {
            var viewModel = (AgendaCellViewModel)item.BindingContext;
            var cellTableViewCell = tv.DequeueReusableCell ("cell") as CellTableViewCell
                ?? new CellTableViewCell (UITableViewCellStyle.Default, "cell");
            cellTableViewCell.Cell = item;
            cellTableViewCell.SelectionStyle = UITableViewCellSelectionStyle.None;

            var textColor = ((Xamarin.Forms.Color)new TrackTextColorConverter ()
                .Convert (viewModel.Track, typeof(Xamarin.Forms.Color), 
                    null, CultureInfo.CurrentCulture))
                .ToUIColor ();

            cellTableViewCell.AddSubview (CreateBackgroundView (cellTableViewCell.Bounds, viewModel));

            if (viewModel.IsBooked) {
                cellTableViewCell.AddSubview (CreateTitleLabel (viewModel, textColor));
                cellTableViewCell.AddSubview (CreateLocationLabel (viewModel, textColor));
                cellTableViewCell.AddSubview (CreateTrackLabel (viewModel, textColor));
            } else {
                cellTableViewCell.AddSubview (CreateChooseLabel ());
                cellTableViewCell.AddSubview (CreateAddIcon ());
            }

            cellTableViewCell.AddSubview (CreateTimeLabel (viewModel, textColor));
            cellTableViewCell.AddSubview (CreateAMPMLabel (viewModel, textColor));

            this.UpdateBackground (cellTableViewCell, item);
            return cellTableViewCell;
        }
        public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
        {
            var viewCell = (ViewCellExtended)item;

            var cell = base.GetCell(item, reusableCell, tv);
            if (cell != null)
            {
                cell.SelectionStyle = viewCell.IsHighlightSelection ? UITableViewCellSelectionStyle.Default : UITableViewCellSelectionStyle.None;


                if (viewCell.SelectColor != Color.Transparent)
                {
                    if (selView == null)
                    {
                        selView = new UIView(cell.SelectedBackgroundView.Bounds);
                        selView.BackgroundColor = new UIColor((nfloat)viewCell.SelectColor.R, (nfloat)viewCell.SelectColor.G, (nfloat)viewCell.SelectColor.B, (nfloat)viewCell.SelectColor.A);
                        //selView.Layer.BackgroundColor = UIColor.Blue;
                        //selView.Layer.BorderColor = UIColor.Yellow;
                        //selView.Layer.BorderWidth = 2.0f;
                    }

                    cell.SelectedBackgroundView = selView;
                }
            }

            return cell;
        }
        protected override Android.Views.View GetCellCore(Xamarin.Forms.Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Android.Content.Context context)
        {
            var view = base.GetCellCore(item, convertView, parent, context);

            view.ContentDescription = item.AutomationId;

            return(view);
        }
Ejemplo n.º 25
0
        public override UIKit.UITableViewCell GetCell(Xamarin.Forms.Cell item, UIKit.UITableViewCell reusableCell, UIKit.UITableView tv)
        {
            var cell = base.GetCell(item, reusableCell, tv);

            cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;

            return(cell);
        }
        public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
        {
            UITableViewCell tvc = base.GetCell (item, reusableCell, tv);
            tvc.Layer.CornerRadius = 9;
            tvc.Layer.MasksToBounds = true;

            return tvc;
        }
Ejemplo n.º 27
0
       // private UIView bgView;

        public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
        {
            var cell = base.GetCell(item, reusableCell, tv);



            return cell;
        }
Ejemplo n.º 28
0
        public override UIKit.UITableViewCell GetCell(Xamarin.Forms.Cell item, UIKit.UITableViewCell reusableCell,
                                                      UIKit.UITableView tv)
        {
            var cell = base.GetCell(item, reusableCell, tv);

            cell.BackgroundColor = UIColor.Red;
            return(cell);
        }
        public override UIKit.UITableViewCell GetCell(Xamarin.Forms.Cell item, UIKit.UITableViewCell reusableCell, UIKit.UITableView tv)
        {
            var cell = base.GetCell(item, reusableCell, tv);

            cell.SelectionStyle = UITableViewCellSelectionStyle.None;

            return(cell);
        }
Ejemplo n.º 30
0
        public CheckBoxCellView(Context context, Xamarin.Forms.Cell cell) : base(context, cell)
        {
            var cb = new global::Android.Widget.CheckBox(context);

            cb.SetOnCheckedChangeListener(this);
            SetAccessoryView(cb);
            SetImageVisible(false);
        }
        protected override void SetupContent(Cell content, int index)
        {
            base.SetupContent(content, index);

            var viewCell = content as ViewCell;
     
            viewCell.View.BackgroundColor = index % 2 == 0 ? Color.Blue : Color.Red;
        }
        /// <summary>
        /// Gets the cell.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="reusableCell">The reusable TableView cell.</param>
        /// <param name="tv">The TableView.</param>
        /// <returns>UITableViewCell.</returns>
        public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
		{
			var extendedCell = (ExtendedTextCell)item;

			TextCell textCell = (TextCell)item;
			UITableViewCellStyle style = UITableViewCellStyle.Subtitle;
			if (extendedCell.DetailLocation == TextCellDetailLocation.Right)
				style = UITableViewCellStyle.Value1;

			string fullName = item.GetType ().FullName;
			CellTableViewCell cell = tv.DequeueReusableCell (fullName) as CellTableViewCell;
			if (cell == null) {
				cell = new CellTableViewCell (style, fullName);
			}
			else {
				cell.Cell.PropertyChanged -= new PropertyChangedEventHandler (cell.HandlePropertyChanged);
			}
			cell.Cell = textCell;
			textCell.PropertyChanged += new PropertyChangedEventHandler (cell.HandlePropertyChanged);
			cell.PropertyChanged = new Action<object, PropertyChangedEventArgs> (HandlePropertyChanged);
			cell.TextLabel.Text = textCell.Text;
			cell.DetailTextLabel.Text = textCell.Detail;
			cell.TextLabel.TextColor = textCell.TextColor.ToUIColor (DefaultTextColor);
			cell.DetailTextLabel.TextColor = textCell.DetailColor.ToUIColor (DefaultDetailColor);

			UpdateBackground (cell, item);

			if (cell != null) {
				cell.BackgroundColor = extendedCell.BackgroundColor.ToUIColor ();
				cell.SeparatorInset = new UIEdgeInsets ((float)extendedCell.SeparatorPadding.Top, (float)extendedCell.SeparatorPadding.Left,
					(float)extendedCell.SeparatorPadding.Bottom, (float)extendedCell.SeparatorPadding.Right);

				if (extendedCell.ShowDisclousure) {
					cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
					if (!string.IsNullOrEmpty (extendedCell.DisclousureImage)) {
						var detailDisclosureButton = UIButton.FromType (UIButtonType.Custom);
						detailDisclosureButton.SetImage (UIImage.FromBundle (extendedCell.DisclousureImage), UIControlState.Normal);
						detailDisclosureButton.SetImage (UIImage.FromBundle (extendedCell.DisclousureImage), UIControlState.Selected);

						detailDisclosureButton.Frame = new CGRect (0f, 0f, 30f, 30f);
						detailDisclosureButton.TouchUpInside += (object sender, EventArgs e) => {
							var index = tv.IndexPathForCell (cell);
							tv.SelectRow (index, true, UITableViewScrollPosition.None);
							tv.Source.AccessoryButtonTapped (tv, index);
						};
						cell.AccessoryView = detailDisclosureButton;
					}
				}
			}

			if(!extendedCell.ShowSeparator)
				tv.SeparatorStyle = UITableViewCellSeparatorStyle.None;

			tv.SeparatorColor = extendedCell.SeparatorColor.ToUIColor();

			return cell;
		}
        protected override Android.Views.View GetCellCore(Xamarin.Forms.Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Android.Content.Context context)
        {
            var x = (NativeCell)item;

            var view = convertView;

            if (view == null)
            {// no view to re-use, create new
                view = (context as Activity).LayoutInflater.Inflate(Resource.Layout.NativeAndroidCell, null);
            }
            else
            { // re-use, clear image
              // doesn't seem to help
              //view.FindViewById<ImageView> (Resource.Id.Image).Drawable.Dispose ();
            }

            view.FindViewById <TextView>(Resource.Id.Text1).Text = x.Name;
            view.FindViewById <TextView>(Resource.Id.Text2).Text = x.Category;

            // grab the old image and dispose of it
            // TODO: optimize if the image is the *same* and we want to just keep it
            if (view.FindViewById <ImageView>(Resource.Id.Image).Drawable != null)
            {
                using (var image = view.FindViewById <ImageView>(Resource.Id.Image).Drawable as BitmapDrawable)
                {
                    if (image != null)
                    {
                        if (image.Bitmap != null)
                        {
                            //image.Bitmap.Recycle ();
                            image.Bitmap.Dispose();
                        }
                    }
                }
            }

            // If a new image is required, display it
            if (!String.IsNullOrWhiteSpace(x.ImageFilename))
            {
                context.Resources.GetBitmapAsync(x.ImageFilename).ContinueWith((t) =>
                {
                    var bitmap = t.Result;
                    if (bitmap != null)
                    {
                        view.FindViewById <ImageView>(Resource.Id.Image).SetImageBitmap(bitmap);
                        bitmap.Dispose();
                    }
                }, TaskScheduler.FromCurrentSynchronizationContext());
            }
            else
            {
                // clear the image
                view.FindViewById <ImageView>(Resource.Id.Image).SetImageBitmap(null);
            }

            return(view);
        }
		public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
		{
			var cell = base.GetCell(item, reusableCell, tv);
			if (cell != null)
			{
				OnBindingContextChanged(item);
			}
			return cell;
		}
		protected void OnBindingContextChanged(Cell cell)
		{
			var context = cell.BindingContext as MessageTable;
			if (context != null)
			{
				const int totalPadding = 20; // Width Padding
				cell.Height = Convert.ToDouble(EstimateHeight(context.Text, Convert.ToInt32(UIScreen.MainScreen.Bounds.Width) - totalPadding, UIFont.FromName("Helvetica Neue", 14)));
			}
		}
		public override UITableViewCell GetCell (Cell item, UITableView tv)
		{
			tv.SeparatorStyle = UITableViewCellSeparatorStyle.None;

			var cell = base.GetCell (item, tv);
			cell.SelectionStyle = UITableViewCellSelectionStyle.None;

			return cell;
		}
        public override UITableViewCell GetCell(Xamarin.Forms.Cell item, UITableView tv)
        {
            var cell = base.GetCell(item, tv);

            cell.ImageView.Layer.CornerRadius  = 15.0f;
            cell.ImageView.Layer.MasksToBounds = true;
            cell.ImageView.Layer.BorderColor   = UIColor.LightGray.CGColor;
            cell.ImageView.Layer.BorderWidth   = 1.0f;
            return(cell);
        }
		public override UITableViewCell GetCell (Cell item, UITableViewCell reusableCell, UITableView tv)
		{
			var cellView = base.GetCell (item, reusableCell, tv);

			cellView.BackgroundColor = Color.Transparent.ToUIColor();
			cellView.TextLabel.Font = UIFont.FromName("RijksoverheidSansTextTT-Regular", cellView.TextLabel.Font.PointSize);
			cellView.DetailTextLabel.Font = UIFont.FromName("RijksoverheidSansTextTT-Regular", cellView.DetailTextLabel.Font.PointSize);
		
			return cellView;
		}
        protected override View GetCellCore(Cell item, View convertView, ViewGroup parent, Context context)
        {
            var extendedCell = (ViewCellExtended)item;

            var cell = base.GetCellCore(item, convertView, parent, context);
            if (cell != null)
                cell.Selected = extendedCell.IsHighlightSelection;
            
            return cell;
        }
        protected override void SetupContent(Xamarin.Forms.Cell cell, int index)
        {
            base.SetupContent(cell, index);
            var currentViewCell = cell as ViewCell;

            if (currentViewCell != null)
            {
                currentViewCell.View.BackgroundColor = index % 2 == 0 ? Color.Transparent : Color.WhiteSmoke;
            }
        }
 public override UITableViewCell GetCell(Cell item, UITableView tv)
 {
     ExtendedEntryCell entryCell = ((ExtendedEntryCell)item);
     var cell = base.GetCell (item, tv);
     if (cell != null) {
         UITextField textField = (UITextField)cell.ContentView.Subviews [0]; 
         textField.SecureTextEntry = entryCell.IsPassword;
     }
     return cell;
 }
Ejemplo n.º 42
0
        public override UITableViewCell GetCell(Cell item, UITableView tv)
        {
            var cell = base.GetCell(item, tv);
            var imgWithCheckCell = (ImageCellWithCheck)item;

            cell.Accessory = imgWithCheckCell.Selected ? UITableViewCellAccessory.Checkmark : UITableViewCellAccessory.None;
            cell.SetNeedsDisplay();

            return cell;
        }
Ejemplo n.º 43
0
        protected override Android.Views.View GetCellCore(Xamarin.Forms.Cell item, Android.Views.View convertView, ViewGroup parent, Context context)
        {
            var view = base.GetCellCore(item, convertView, parent, context);

            Android.Views.View v = new Android.Views.View(context);
            if (view != null)
            {
                view.Focusable = false;
            }
            return(view);
        }
Ejemplo n.º 44
0
        public override UIKit.UITableViewCell GetCell(Xamarin.Forms.Cell item, UIKit.UITableViewCell reusableCell, UIKit.UITableView tv)
        {
            var navCell = (NavigationCell)item;
            var cell    = base.GetCell(item, reusableCell, tv);

            if (cell != null && navCell.UseIOSAccessory)
            {
                cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
            }
            return(cell);
        }
Ejemplo n.º 45
0
        public override UIKit.UITableViewCell GetCell(Xamarin.Forms.Cell item, UIKit.UITableViewCell reusableCell, UIKit.UITableView tv)
        {
            Contract.Ensures(Contract.Result <UITableViewCell>() != null);
            var cell = base.GetCell(item, reusableCell, tv);

            cell.SelectedBackgroundView = new UIView
            {
                BackgroundColor = UIColor.FromRGB(233, 217, 133)
            };

            return(cell);
        }
Ejemplo n.º 46
0
        protected override Android.Views.View GetCellCore(Xamarin.Forms.Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Android.Content.Context context)
        {
            var x = (NativeCell)item;

            var view = convertView;

            if (view == null)              // no view to re-use, create new
            {
                view = (context as Activity).LayoutInflater.Inflate(Resource.Layout.NativeAndroidCell, null);
            }
            else                 // re-use, clear image
                                 // doesn't seem to help
                                 //view.FindViewById<ImageView> (Resource.Id.Image).Drawable.Dispose ();
            {
            }

            view.FindViewById <TextView>(Resource.Id.Text1).Text = x.Name;
            view.FindViewById <TextView>(Resource.Id.Text2).Text = x.Category;


            if (view.FindViewById <ImageView> (Resource.Id.Image).Drawable != null)
            {
                using (var image = view.FindViewById <ImageView> (Resource.Id.Image).Drawable as BitmapDrawable) {
                    if (image != null)
                    {
                        if (image.Bitmap != null)
                        {
                            //image.Bitmap.Recycle ();
                            image.Bitmap.Dispose();
                        }
                    }
                }
            }

            // HACK: this makes for choppy scrolling I think :-(
            if (!String.IsNullOrWhiteSpace(x.ImageFilename))
            {
                context.Resources.GetBitmapAsync(x.ImageFilename).ContinueWith((t) => {
                    var bitmap = t.Result;
                    if (bitmap != null)
                    {
                        view.FindViewById <ImageView> (Resource.Id.Image).SetImageBitmap(bitmap);
                        bitmap.Dispose();
                    }
                });
            }
            else
            {
                view.FindViewById <ImageView> (Resource.Id.Image).SetImageBitmap(null);
            }

            return(view);
        }
Ejemplo n.º 47
0
        public override UIKit.UITableViewCell GetCell(Xamarin.Forms.Cell item, UIKit.UITableViewCell reusableCell, UIKit.UITableView tv)
        {
            var cell = base.GetCell(item, reusableCell, tv);

            cell.Accessory = UIKit.UITableViewCellAccessory.DisclosureIndicator;

            //set blue border for image
            cell.ImageView.Layer.BorderColor = Color.White.ToCGColor();
            cell.ImageView.Layer.BorderWidth = 1;
            cell.BackgroundColor             = Color.FromHex(ColorStyles.XamarinDark).ToUIColor();

            return(cell);
        }
Ejemplo n.º 48
0
        protected override Android.Views.View GetCellCore(Xamarin.Forms.Cell item, Android.Views.View convertView, ViewGroup parent, Context context)
        {
            var x = (TestCell)item;

            var view = convertView;

            if (view == null)
            {
                // no view to re-use, create new
                view = (context as Activity).LayoutInflater.Inflate(CustomRenderer.Droid.Resource.Layout.NativeAndroidCell, null);
            }

            view.FindViewById <TextView>(Resource.Id.Text1).Text = x.Name;


            return(view);
        }
Ejemplo n.º 49
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:AiForms.Renderers.Droid.RadioCellView"/> class.
        /// </summary>
        /// <param name="context">Context.</param>
        /// <param name="cell">Cell.</param>
        public RadioCellView(Context context, XF.Cell cell) : base(context, cell)
        {
            _simpleCheck           = new SimpleCheck(context);
            _simpleCheck.Focusable = false;

            var lparam = new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.WrapContent,
                ViewGroup.LayoutParams.WrapContent)
            {
                Width  = (int)context.ToPixels(30),
                Height = (int)context.ToPixels(30)
            };

            using (lparam) {
                AccessoryStack.AddView(_simpleCheck, lparam);
            }
        }
Ejemplo n.º 50
0
        public override UITableViewCell GetCell(Xamarin.Forms.Cell item, UITableViewCell reusableCell, UITableView tv)
        {
            var cell = base.GetCell(item, reusableCell, tv);

            if (cell != null)
            {
                switch (item.StyleId)
                {
                case "RemoveSelectionStyle": cell.SelectionStyle = UIKit.UITableViewCellSelectionStyle.None; break;

                case "TransparentStyle": cell.BackgroundColor = UIColor.Clear; break;

                default: break;
                }
            }
            return(cell);
        }
Ejemplo n.º 51
0
        protected override Android.Views.View GetCellCore(Xamarin.Forms.Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Android.Content.Context context)
        {
            _cellCore = base.GetCellCore(item, convertView, parent, context);


            var listView = parent as Android.Widget.ListView;

            if (listView != null)
            {
                listView.SetSelector(Resource.Color.ListViewSelector);
                listView.CacheColorHint = new Android.Graphics.Color(ContextCompat.GetColor(Forms.Context, Resource.Color.ListViewSelector));
            }



            return(_cellCore);
        }
Ejemplo n.º 52
0
        protected override AView GetCellCore(Xamarin.Forms.Cell item, AView convertView, ViewGroup parent, Context context)
        {
            var cell = (CheckBoxCell)Cell;

            if ((_view = convertView as CheckBoxCellView) == null)
            {
                _view = new CheckBoxCellView(context, item);
            }

            _view.Cell = cell;

            UpdateText();
            UpdateChecked();
            UpdateHeight();
            UpdateIsEnabled(_view, cell);

            return(_view);
        }
        public override UIKit.UITableViewCell GetCell(Xamarin.Forms.Cell item, UIKit.UITableViewCell reusableCell, UIKit.UITableView tv)
        {
            _nativeContactCell = reusableCell as iOSContactCell;
            if (_nativeContactCell == null)
            {
                var stuff = iOSContactCell.Nib.Instantiate(null, null);
                _nativeContactCell = stuff.First() as iOSContactCell;
            }
            else
            {
                _nativeContactCell.FormsContactCell.PropertyChanged -= FormsContactCell_PropertyChanged;
            }
            _nativeContactCell.FormsContactCell = item as FormsContactCell;
            _nativeContactCell.FormsContactCell.PropertyChanged += FormsContactCell_PropertyChanged;
            _nativeContactCell.UpdateCell((item as FormsContactCell).ContactName);

            return(_nativeContactCell);
        }
Ejemplo n.º 54
0
        public override UITableViewCell GetCell(Xamarin.Forms.Cell item, UITableView tv)
        {
            var cell = base.GetCell(item, tv);

            cell.Accessory = MonoTouch.UIKit.UITableViewCellAccessory.DisclosureIndicator;


            cell.BackgroundColor = Color.Transparent.ToUIColor();


            cell.TextLabel.TextColor = AppColors.LABELWHITE.ToUIColor();

            cell.DetailTextLabel.TextColor = AppColors.LABELBLUE.ToUIColor();

            tv.SeparatorColor = AppColors.SEPARATOR.ToUIColor();

            return(cell);
        }
Ejemplo n.º 55
0
        public override UIKit.UITableViewCell GetCell(Xamarin.Forms.Cell item, UIKit.UITableViewCell reusableCell, UIKit.UITableView tv)
        {
            var tvc = tv.DequeueReusableCell("BrandCell");

            if (tvc == null)
            {
                tv.RegisterNibForCellReuse(BrandCell.Nib, "BrandCell");
                tvc = tv.DequeueReusableCell("BrandCell");
            }
            //tvc.Cell = item;

            //WireUpForceUpdateSizeRequested(item, tvc, tv);

            //tvc.TextLabel.Text = item.ToString();

            //UpdateBackground(tvc, item);
            return(tvc);
        }
        /// <summary>
        /// Gets the cell core.
        /// </summary>
        /// <returns>The cell core.</returns>
        /// <param name="item">Item.</param>
        /// <param name="convertView">Convert view.</param>
        /// <param name="parent">Parent.</param>
        /// <param name="context">Context.</param>
        protected override Android.Views.View GetCellCore(Xamarin.Forms.Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Android.Content.Context context)
        {
            TnativeCell nativeCell = convertView as TnativeCell;

            if (nativeCell == null)
            {
                nativeCell = InstanceCreator <Context, Xamarin.Forms.Cell, TnativeCell> .Create(context, item);
            }

            ClearPropertyChanged(nativeCell);

            nativeCell.Cell = item;

            SetUpPropertyChanged(nativeCell);

            nativeCell.UpdateCell();

            return(nativeCell);
        }
        protected override Android.Views.View GetCellCore(Xamarin.Forms.Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Android.Content.Context context)
        {
            var x = (SelectLevelViewCellNative)item;

            var view = convertView;

            if (view == null)
            {// no view to re-use, create new
                view = (context as Activity).LayoutInflater.Inflate(Resource.Layout.SelectLevelNativeViewCell, null);
            }
            else
            { // re-use, clear image
              // doesn't seem to help
              //view.FindViewById<ImageView> (Resource.Id.Image).Drawable.Dispose ();
            }

            view.FindViewById <TextView>(Resource.Id.Text1).Text = x.LevelID.ToString();
            view.FindViewById <TextView>(Resource.Id.Text2).Text = x.LevelDescription;
            view.FindViewById <TextView>(Resource.Id.Text3).Text = x.GateNumber;
            return(view);
        }
Ejemplo n.º 58
0
        public override UIKit.UITableViewCell GetCell(Xamarin.Forms.Cell item, UIKit.UITableViewCell reusableCell, UIKit.UITableView tv)
        {
            var         tvc         = reusableCell as CellTableViewCell;
            BEMCheckBox bemCheckBox = null;

            if (tvc == null)
            {
                tvc = new CellTableViewCell(UIKit.UITableViewCellStyle.Value1, CellName);
            }
            else
            {
                bemCheckBox = tvc.AccessoryView as BEMCheckBox;
                tvc.Cell.PropertyChanged -= OnCellPropertyChanged;
            }

            SetRealCell(item, tvc);

            if (bemCheckBox == null)
            {
                bemCheckBox = new BEMCheckBox(Constants.CheckBoxSize);
                bemCheckBox.ValueChanged += OnCheckBoxValueChanged;
                tvc.AccessoryView         = bemCheckBox;
            }

            var boolCell = (CheckBoxCell)item;

            tvc.Cell = item;
            tvc.Cell.PropertyChanged += OnCellPropertyChanged;
            tvc.AccessoryView         = bemCheckBox;
            tvc.TextLabel.Text        = boolCell.Text;

            bemCheckBox.On = boolCell.On;

            WireUpForceUpdateSizeRequested(item, tvc, tv);

            UpdateBackground(tvc, item);
            UpdateIsEnabled(tvc, boolCell);

            return(tvc);
        }
Ejemplo n.º 59
0
        public override UIKit.UITableViewCell GetCell(Xamarin.Forms.Cell item, UIKit.UITableViewCell reusableCell, UIKit.UITableView tv)
        {
            var cell = base.GetCell(item, reusableCell, tv);

            if (item.Parent is WTableView)
            {
                if (!(item.Parent as WTableView).SelectionEnabled)
                {
                    cell.SelectionStyle = UIKit.UITableViewCellSelectionStyle.None;
                }
                else
                {
                    cell.SelectionStyle = UIKit.UITableViewCellSelectionStyle.Default;
                }
            }
            else if (item.Parent is WListView)
            {
                var listview = item.Parent as WListView;

                if (!(listview.Parent as WListView).SelectionEnabled)
                {
                    cell.SelectionStyle = UIKit.UITableViewCellSelectionStyle.None;
                }
                else
                {
                    cell.SelectionStyle = UIKit.UITableViewCellSelectionStyle.Default;
                }


                if (listview.SelectionColor != Color.Default)
                {
                    var bgView = new UIView();
                    bgView.BackgroundColor      = listview.SelectionColor.ToUIColor();
                    cell.SelectedBackgroundView = bgView;
                }
            }

            return(cell);
        }
        protected override Android.Views.View GetCellCore(Xamarin.Forms.Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Android.Content.Context context)
        {
            var x = (SelectImageViewCellNative)item;

            var view = convertView;

            if (view == null)
            {// no view to re-use, create new
                view = (context as Activity).LayoutInflater.Inflate(Resource.Layout.SelectImageNativeViewCell, null);
            }
            else
            { // re-use, clear image
              // doesn't seem to help
              //view.FindViewById<ImageView> (Resource.Id.Image).Drawable.Dispose ();
            }

            view.FindViewById <TextView>(Resource.Id.Text1).Text = x.PairIndex.ToString();
            view.FindViewById <TextView>(Resource.Id.Text2).Text = x.PairName;

            DisposeImage(context, view, Resource.Id.Image1, x.Image1);
            DisposeImage(context, view, Resource.Id.Image2, x.Image2);
            return(view);
        }