Esempio 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_HPage_view
         var itemView = LayoutInflater.From(parent.Context)?.Inflate(Resource.Layout.Style_HPage_view, parent, false);
         var vh       = new SearchGroupAdapterViewHolder(itemView, JoinButtonClick, Click, LongClick);
         return(vh);
     }
     catch (Exception exception)
     {
         Methods.DisplayReportResultTrack(exception);
         return(null !);
     }
 }
 // Create new views (invoked by the layout manager)
 public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
 {
     try
     {
         //Setup your layout here >> Style_HPage_view
         var itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.Style_HPage_view, parent, false);
         var vh       = new SearchGroupAdapterViewHolder(itemView, Click, LongClick);
         return(vh);
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
         return(null);
     }
 }
Esempio n. 3
0
        private void Initialize(SearchGroupAdapterViewHolder holder, GroupClass item)
        {
            try
            {
                GlideImageLoader.LoadImage(ActivityContext, item.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                if (!string.IsNullOrEmpty(item.GroupTitle) || !string.IsNullOrWhiteSpace(item.GroupTitle))
                {
                    holder.Name.Text = Methods.FunString.SubStringCutOf(Methods.FunString.DecodeString(item.GroupTitle), 20);
                }
                else
                {
                    holder.Name.Text = Methods.FunString.SubStringCutOf(Methods.FunString.DecodeString(item.GroupName), 20);
                }

                CategoriesController cat = new CategoriesController();
                holder.About.Text = cat.Get_Translate_Categories_Communities(item.CategoryId, item.Category, "Group");

                //var drawable = TextDrawable.InvokeBuilder().BeginConfig().FontSize(30).EndConfig().BuildRound("", Color.ParseColor("#1A237E"));

                if (item.IsOwner != null && item.IsOwner.Value || item.UserId == UserDetails.UserId)
                {
                    holder.Button.Visibility = ViewStates.Gone;
                }
                else
                {
                    //Set style Btn Joined Group
                    if (WoWonderTools.IsJoinedGroup(item))
                    {
                        holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                        holder.Button.SetTextColor(Color.ParseColor("#ffffff"));
                        holder.Button.Text = ActivityContext.GetText(Resource.String.Btn_Joined);
                        holder.Button.Tag  = "true";
                    }
                    else
                    {
                        holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                        holder.Button.SetTextColor(Color.ParseColor(AppSettings.MainColor));
                        holder.Button.Text = ActivityContext.GetText(Resource.String.Btn_Join_Group);
                        holder.Button.Tag  = "false";
                    }
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
        private void Initialize(SearchGroupAdapterViewHolder holder, GroupClass item)
        {
            try
            {
                GlideImageLoader.LoadImage(ActivityContext, item.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                if (!string.IsNullOrEmpty(item.GroupTitle) || !string.IsNullOrWhiteSpace(item.GroupTitle))
                {
                    holder.Name.Text = Methods.FunString.SubStringCutOf(Methods.FunString.DecodeString(item.GroupTitle), 20);
                }
                else
                {
                    holder.Name.Text = Methods.FunString.SubStringCutOf(Methods.FunString.DecodeString(item.GroupName), 20);
                }

                CategoriesController cat = new CategoriesController();
                holder.About.Text = cat.Get_Translate_Categories_Communities(item.CategoryId, item.Category);

                //var drawable = TextDrawable.InvokeBuilder().BeginConfig().FontSize(30).EndConfig().BuildRound("", Color.ParseColor("#1A237E"));


                if (item.IsJoined != null)
                {
                    //Set style Btn Joined Group
                    if (item.IsJoined == "no" || item.IsJoined == "No" || item.IsJoined == "false")
                    {
                        holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                        holder.Button.SetTextColor(Color.ParseColor(AppSettings.MainColor));
                        holder.Button.Text = ActivityContext.GetText(Resource.String.Btn_Join_Group);
                        holder.Button.Tag  = "false";
                    }
                    else if (item.IsJoined == "yes" || item.IsJoined == "Yes" || item.IsJoined == "true")
                    {
                        holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                        holder.Button.SetTextColor(Color.ParseColor("#ffffff"));
                        holder.Button.Text = ActivityContext.GetText(Resource.String.Btn_Joined);
                        holder.Button.Tag  = "true";
                    }
                }
                else
                {
                    holder.Button.Visibility = ViewStates.Gone;
                }

                if (!holder.Button.HasOnClickListeners)
                {
                    holder.Button.Click += (sender, args) =>
                    {
                        try
                        {
                            if (!Methods.CheckConnectivity())
                            {
                                Toast.MakeText(ActivityContext, ActivityContext.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                                return;
                            }

                            if (holder.Button.Tag.ToString() == "false")
                            {
                                holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                                holder.Button.SetTextColor(Color.ParseColor("#ffffff"));
                                holder.Button.Text = ActivityContext.GetText(Resource.String.Btn_Joined);
                                holder.Button.Tag  = "true";
                            }
                            else
                            {
                                holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                                holder.Button.SetTextColor(Color.ParseColor(AppSettings.MainColor));
                                holder.Button.Text = ActivityContext.GetText(Resource.String.Btn_Join_Group);
                                holder.Button.Tag  = "false";
                            }

                            PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                                () => RequestsAsync.Group.Join_Group(item.GroupId)
                            });
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e);
                        }
                    }
                }
                ;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }