コード例 #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 MyEvent_AdapterViewHolder(itemView, OnClick, OnLongClick);
         return(vh);
     }
     catch (Exception exception)
     {
         Crashes.TrackError(exception);
         return(null);
     }
 }
コード例 #2
0
        public void Initialize(MyEvent_AdapterViewHolder holder, Get_MyEvent_object.My_Events item)
        {
            try
            {
                var CoverSplit     = item.cover.Split('/').Last();
                var getImage_Cover = IMethods.MultiMedia.GetMediaFrom_Disk(IMethods.IPath.FolderDiskEvent, CoverSplit);
                if (getImage_Cover != "File Dont Exists")
                {
                    if (holder.Image.Tag?.ToString() != "loaded")
                    {
                        ImageServiceLoader.Load_Image(holder.Image, "ImagePlacholder.jpg", getImage_Cover, 3);
                        holder.Image.Tag = "loaded";
                    }
                }
                else
                {
                    if (holder.Image.Tag?.ToString() != "loaded")
                    {
                        IMethods.MultiMedia.DownloadMediaTo_DiskAsync(IMethods.IPath.FolderDiskEvent, item.cover);
                        ImageServiceLoader.Load_Image(holder.Image, "ImagePlacholder.jpg", item.cover, 3);
                        holder.Image.Tag = "loaded";
                    }
                }

                IMethods.Set_TextViewIcon("1", holder.event_place_icon, IonIcons_Fonts.IosLocation);
                IMethods.Set_TextViewIcon("1", holder.event_time_icon, IonIcons_Fonts.IosClockOutline);
                IMethods.Set_TextViewIcon("1", holder.event_going_icon, IonIcons_Fonts.PersonStalker);
                IMethods.Set_TextViewIcon("1", holder.event_intersted_icon, IonIcons_Fonts.Star);

                holder.Txt_event_titile.Text = IMethods.Fun_String.DecodeString(IMethods.Fun_String.DecodeStringWithEnter(IMethods.Fun_String.SubStringCutOf(item.name, 30)));
                holder.Txt_event_Place.Text  = item.location;
                //holder.Txt_event_going.Text = IMethods.Fun_String.FormatPriceValue(int.Parse(item.going_count));
                //holder.Txt_event_intersted.Text = IMethods.Fun_String.FormatPriceValue(int.Parse(item.interested_count));
                holder.Txt_event_time.Text = item.start_date;

                if (!holder.Btn_event_share.HasOnClickListeners)
                {
                    holder.Btn_event_share.Click += async delegate
                    {
                        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);
            }
        }