Ejemplo n.º 1
0
 // Create new views (invoked by the layout manager)
 public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
 {
     try
     {
         //Setup your layout here >> Style_Event_Cell
         var itemView = LayoutInflater.From(parent.Context)
                        .Inflate(Resource.Layout.Style_Event_Cell, parent, false);
         var vh = new Event_AdapterViewHolder(itemView, OnClick, OnLongClick);
         return(vh);
     }
     catch (Exception exception)
     {
         Crashes.TrackError(exception);
         return(null);
     }
 }
Ejemplo n.º 2
0
        public void Initialize(Event_AdapterViewHolder holder, Get_Events_Object.Event item)
        {
            try
            {
                if (holder.Image.Tag?.ToString() != "loaded")
                {
                    var CoverSplit     = item.cover.Split('/').Last();
                    var getImage_Cover = IMethods.MultiMedia.GetMediaFrom_Disk(IMethods.IPath.FolderDiskEvent, CoverSplit);
                    if (getImage_Cover != "File Dont Exists")
                    {
                        ImageServiceLoader.Load_Image(holder.Image, "ImagePlacholder.jpg", getImage_Cover);
                        holder.Image.Tag = "loaded";
                    }
                    else
                    {
                        IMethods.MultiMedia.DownloadMediaTo_DiskAsync(IMethods.IPath.FolderDiskEvent, item.cover);
                        ImageServiceLoader.Load_Image(holder.Image, "ImagePlacholder.jpg", item.cover);
                        holder.Image.Tag = "loaded";
                    }
                }

                if (holder.event_place_icon.Text != IonIcons_Fonts.IosLocation)
                {
                    IMethods.Set_TextViewIcon("1", holder.event_place_icon, IonIcons_Fonts.IosLocation);
                }
                if (holder.event_time_icon.Text != IonIcons_Fonts.IosClockOutline)
                {
                    IMethods.Set_TextViewIcon("1", holder.event_time_icon, IonIcons_Fonts.IosClockOutline);
                }
                if (holder.event_going_icon.Text != IonIcons_Fonts.PersonStalker)
                {
                    IMethods.Set_TextViewIcon("1", holder.event_going_icon, IonIcons_Fonts.PersonStalker);
                }
                if (holder.event_intersted_icon.Text != IonIcons_Fonts.Star)
                {
                    IMethods.Set_TextViewIcon("1", holder.event_intersted_icon, IonIcons_Fonts.Star);
                }

                if (holder.Txt_event_titile.Tag?.ToString() != "true")
                {
                    holder.Txt_event_titile.Tag  = "true";
                    holder.Txt_event_titile.Text = IMethods.Fun_String.DecodeString(IMethods.Fun_String.DecodeStringWithEnter(IMethods.Fun_String.SubStringCutOf(item.name, 30)));
                }

                if (holder.Txt_event_Place.Tag?.ToString() != "true")
                {
                    holder.Txt_event_Place.Tag  = "true";
                    holder.Txt_event_Place.Text = item.location;
                }

                if (holder.Txt_event_going.Tag?.ToString() != "true")
                {
                    holder.Txt_event_going.Tag  = "true";
                    holder.Txt_event_going.Text = IMethods.Fun_String.FormatPriceValue(int.Parse(item.going_count));
                }

                if (holder.Txt_event_intersted.Tag?.ToString() != "true")
                {
                    holder.Txt_event_intersted.Tag  = "true";
                    holder.Txt_event_intersted.Text = IMethods.Fun_String.FormatPriceValue(int.Parse(item.interested_count));
                }

                if (holder.Txt_event_time.Tag?.ToString() != "true")
                {
                    holder.Txt_event_time.Tag  = "true";
                    holder.Txt_event_time.Text = item.start_date;
                }

                if (!holder.Btn_event_share.HasOnClickListeners)
                {
                    holder.Btn_event_share.Click += async(sender, args) =>
                    {
                        try
                        {
                            //Share Plugin same as video
                            if (!CrossShare.IsSupported)
                            {
                                return;
                            }

                            await CrossShare.Current.Share(new ShareMessage
                            {
                                Title = item.name,
                                Text  = item.description,
                                Url   = item.url
                            });
                        }
                        catch (Exception e)
                        {
                            Crashes.TrackError(e);
                        }
                    }
                }
                ;
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }