示例#1
0
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                if (viewHolder is ShowApplyJobsAdapterViewHolder holder)
                {
                    var item = JobList[position];
                    if (item != null)
                    {
                        GlideImageLoader.LoadImage(ActivityContext, item.UserData.Avatar, holder.Image, ImageStyle.CenterCrop, ImagePlaceholders.Drawable);

                        holder.Username.Text      = WoWonderTools.GetNameFinal(item.UserData);
                        holder.AddressText.Text   = item.Position;
                        holder.TimeText.Text      = item.Location;
                        holder.PhoneText.Text     = item.PhoneNumber;
                        holder.EmailText.Text     = item.Email;
                        holder.PositionText.Text  = item.Position;
                        holder.StartDateText.Text = item.ExperienceStartDate;
                        holder.EndDateText.Text   = item.ExperienceEndDate;

                        holder.Description.Text = Methods.FunString.DecodeString(item.ExperienceDescription);
                        ReadMoreOption.AddReadMoreTo(holder.Description, new String(holder.Description.Text));
                    }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
        private void BindOfferPost()
        {
            try
            {
                if (DataInfoObject != null)
                {
                    DataInfoObject.IsOwner = DataInfoObject.UserId == UserDetails.UserId;

                    GlideImageLoader.LoadImage(this, DataInfoObject.Page.Avatar, OfferAvatar, ImageStyle.RoundedCrop, ImagePlaceholders.Drawable);
                    GlideImageLoader.LoadImage(this, DataInfoObject.Image, OfferCoverImage, ImageStyle.FitCenter, ImagePlaceholders.Drawable);

                    if (DataInfoObject.IsOwner)
                    {
                        TxtMore.Visibility = ViewStates.Visible;
                    }

                    if (DataInfoObject.Page != null)
                    {
                        PageName.Text = "@" + Methods.FunString.DecodeString(DataInfoObject.Page.PageName);
                    }

                    //Set Description
                    var description = Methods.FunString.DecodeString(DataInfoObject.Description);
                    Description.Text = description;
                    ReadMoreOption.AddReadMoreTo(Description, new String(description));

                    DiscountNumber.Text = Methods.FunString.DecodeString(DataInfoObject.OfferText) + " " + Methods.FunString.DecodeString(DataInfoObject.DiscountedItems);
                    DateNumber.Text     = DataInfoObject.ExpireDate;
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
示例#3
0
        public void LoadCommentData(CommentObjectExtra item, CommentAdapterViewHolder holder)
        {
            try
            {
                if (!string.IsNullOrEmpty(item.Orginaltext) || !string.IsNullOrWhiteSpace(item.Orginaltext))
                {
                    var text = Methods.FunString.DecodeString(item.Orginaltext);
                    ReadMoreOption.AddReadMoreTo(holder.CommentText, new Java.Lang.String(text));
                }
                else
                {
                    holder.CommentText.Visibility = ViewStates.Gone;
                }

                holder.TimeTextView.Text = Methods.Time.TimeAgo(Convert.ToInt32(item.Time), false);
                holder.UserName.Text     = item.Publisher.Name;

                GlideImageLoader.LoadImage(ActivityContext, item.Publisher.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                var textHighLighter = item.Publisher.Name;
                var textIsPro       = string.Empty;

                if (item.Publisher.Verified == "1")
                {
                    textHighLighter += " " + IonIconsFonts.CheckmarkCircle;
                }

                if (item.Publisher.IsPro == "1")
                {
                    textIsPro        = " " + IonIconsFonts.Flash;
                    textHighLighter += textIsPro;
                }

                var decorator = TextDecorator.Decorate(holder.UserName, textHighLighter).SetTextStyle((int)TypefaceStyle.Bold, 0, item.Publisher.Name.Length);

                if (item.Publisher.Verified == "1")
                {
                    decorator.SetTextColor(Resource.Color.Post_IsVerified, IonIconsFonts.CheckmarkCircle);
                }

                if (item.Publisher.IsPro == "1")
                {
                    decorator.SetTextColor(Resource.Color.text_color_in_between, textIsPro);
                }

                decorator.Build();

                //Image
                if (holder.ItemViewType == 1 || holder.CommentImage != null)
                {
                    if (!string.IsNullOrEmpty(item.CFile) && (item.CFile.Contains("file://") || item.CFile.Contains("content://") || item.CFile.Contains("storage") || item.CFile.Contains("/data/user/0/")))
                    {
                        File file2    = new File(item.CFile);
                        var  photoUri = FileProvider.GetUriForFile(ActivityContext, ActivityContext.PackageName + ".fileprovider", file2);
                        Glide.With(ActivityContext).Load(photoUri).Apply(new RequestOptions()).Into(holder.CommentImage);

                        //GlideImageLoader.LoadImage(ActivityContext,item.CFile, holder.CommentImage, ImageStyle.CenterCrop, ImagePlaceholders.Color);
                    }
                    else
                    {
                        if (!item.CFile.Contains(Client.WebsiteUrl))
                        {
                            item.CFile = WoWonderTools.GetTheFinalLink(item.CFile);
                        }

                        GlideImageLoader.LoadImage(ActivityContext, item.CFile, holder.CommentImage, ImageStyle.CenterCrop, ImagePlaceholders.Color);
                        item.CFile = WoWonderTools.GetFile("", Methods.Path.FolderDiskImage, item.CFile.Split('/').Last(), item.CFile);
                    }
                }

                //Voice
                if (holder.VoiceLayout != null && !string.IsNullOrEmpty(item.Record))
                {
                    LoadAudioItem(holder, item);
                }

                var repliesCount = !string.IsNullOrEmpty(item.RepliesCount) ? item.RepliesCount : item.Replies ?? "";
                if (repliesCount != "0" && !string.IsNullOrEmpty(repliesCount))
                {
                    holder.ReplyTextView.Text = ActivityContext.GetText(Resource.String.Lbl_Reply) + " " + "(" + repliesCount + ")";
                }

                if (AppSettings.PostButton == PostButtonSystem.ReactionDefault || AppSettings.PostButton == PostButtonSystem.ReactionSubShine)
                {
                    item.Reaction ??= new Reaction();

                    holder.CountRating.Text = item.Reaction.Count + " " + ActivityContext.GetString(Resource.String.Lbl_Reactions);
                    holder.RatingBar.Rating = (float)Convert.ToDouble(item.Reaction.Type);
                    if (holder.RatingBar.Rating > 0)
                    {
                        holder.RatingText.Text = item.Reaction.Type;
                    }
                    else
                    {
                        holder.RatingText.Text = "0.0";
                    }

                    //if (item.Reaction.Count > 0)
                    //{
                    //    holder.CountLikeSection.Visibility = ViewStates.Visible;
                    //    holder.CountLike.Text = Methods.FunString.FormatPriceValue(item.Reaction.Count);
                    //}
                    //else
                    //{
                    //    holder.CountLikeSection.Visibility = ViewStates.Gone;
                    //}

                    if (item.Reaction.IsReacted != null && item.Reaction.IsReacted.Value)
                    {
                        if (!string.IsNullOrEmpty(item.Reaction.Type))
                        {
                            var react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Id == item.Reaction.Type).Value?.Id ?? "";
                            switch (react)
                            {
                            case "1":
                                ReactionComment.SetReactionPack(holder, ReactConstants.Like);
                                holder.LikeTextView.Tag = "Liked";
                                holder.ImageCountLike.SetImageResource(Resource.Drawable.emoji_like);
                                break;

                            case "2":
                                ReactionComment.SetReactionPack(holder, ReactConstants.Love);
                                holder.LikeTextView.Tag = "Liked";
                                holder.ImageCountLike.SetImageResource(Resource.Drawable.emoji_love);
                                break;

                            case "3":
                                ReactionComment.SetReactionPack(holder, ReactConstants.HaHa);
                                holder.LikeTextView.Tag = "Liked";
                                holder.ImageCountLike.SetImageResource(Resource.Drawable.emoji_haha);
                                break;

                            case "4":
                                ReactionComment.SetReactionPack(holder, ReactConstants.Wow);
                                holder.LikeTextView.Tag = "Liked";
                                holder.ImageCountLike.SetImageResource(Resource.Drawable.emoji_wow);
                                break;

                            case "5":
                                ReactionComment.SetReactionPack(holder, ReactConstants.Sad);
                                holder.LikeTextView.Tag = "Liked";
                                holder.ImageCountLike.SetImageResource(Resource.Drawable.emoji_sad);
                                break;

                            case "6":
                                ReactionComment.SetReactionPack(holder, ReactConstants.Angry);
                                holder.LikeTextView.Tag = "Liked";
                                holder.ImageCountLike.SetImageResource(Resource.Drawable.emoji_angry);
                                break;

                            default:
                                holder.LikeTextView.Text = ActivityContext.GetText(Resource.String.Btn_Like);
                                holder.LikeTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black);
                                holder.LikeTextView.Tag = "Like";

                                if (item.Reaction.Count > 0)
                                {
                                    holder.ImageCountLike.SetImageResource(Resource.Drawable.emoji_like);
                                }

                                break;
                            }
                        }
                    }
                    else
                    {
                        holder.LikeTextView.Text = ActivityContext.GetText(Resource.String.Btn_Like);
                        holder.LikeTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black);
                        holder.LikeTextView.Tag = "Like";
                        if (item.Reaction.Count > 0)
                        {
                            holder.ImageCountLike.SetImageResource(Resource.Drawable.emoji_like);
                        }
                    }
                }
                else if (AppSettings.PostButton == PostButtonSystem.Wonder || AppSettings.PostButton == PostButtonSystem.DisLike)
                {
                    if (item.Reaction?.IsReacted != null && !item.Reaction.IsReacted.Value)
                    {
                        ReactionComment.SetReactionPack(holder, ReactConstants.Default);
                    }

                    if (item.IsCommentLiked)
                    {
                        holder.LikeTextView.Text = ActivityContext.GetText(Resource.String.Btn_Liked);
                        holder.LikeTextView.SetTextColor(Color.ParseColor(AppSettings.MainColor));
                        holder.LikeTextView.Tag = "Liked";
                    }

                    switch (AppSettings.PostButton)
                    {
                    case PostButtonSystem.Wonder when item.IsCommentWondered:
                    {
                        holder.DislikeTextView.Text = ActivityContext.GetString(Resource.String.Lbl_wondered);
                        holder.DislikeTextView.SetTextColor(Color.ParseColor(AppSettings.MainColor));
                        holder.DislikeTextView.Tag = "Disliked";
                        break;
                    }

                    case PostButtonSystem.Wonder:
                    {
                        holder.DislikeTextView.Text = ActivityContext.GetString(Resource.String.Btn_Wonder);
                        holder.DislikeTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black);
                        holder.DislikeTextView.Tag = "Dislike";
                        break;
                    }

                    case PostButtonSystem.DisLike when item.IsCommentWondered:
                    {
                        holder.DislikeTextView.Text = ActivityContext.GetString(Resource.String.Lbl_disliked);
                        holder.DislikeTextView.SetTextColor(Color.ParseColor("#f89823"));
                        holder.DislikeTextView.Tag = "Disliked";
                        break;
                    }

                    case PostButtonSystem.DisLike:
                    {
                        holder.DislikeTextView.Text = ActivityContext.GetString(Resource.String.Btn_Dislike);
                        holder.DislikeTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black);
                        holder.DislikeTextView.Tag = "Dislike";
                        break;
                    }
                    }
                }
                else
                {
                    if (item.IsCommentLiked)
                    {
                        holder.LikeTextView.Text = ActivityContext.GetText(Resource.String.Btn_Liked);
                        holder.LikeTextView.SetTextColor(Color.ParseColor(AppSettings.MainColor));
                        holder.LikeTextView.Tag = "Liked";
                    }
                    else
                    {
                        holder.LikeTextView.Text = ActivityContext.GetText(Resource.String.Btn_Like);
                        holder.LikeTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black);
                        holder.LikeTextView.Tag = "Like";
                    }
                }

                holder.TimeTextView.Tag = "true";
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
示例#4
0
        private void BindJobPost()
        {
            try
            {
                if (DataInfoObject != null)
                {
                    DataInfoObject = WoWonderTools.ListFilterJobs(DataInfoObject);

                    GlideImageLoader.LoadImage(this, DataInfoObject.Page.Avatar, JobAvatar, ImageStyle.RoundedCrop, ImagePlaceholders.Drawable);

                    var image = DataInfoObject.Image.Replace(Client.WebsiteUrl + "/", "");
                    if (!image.Contains("http"))
                    {
                        DataInfoObject.Image = Client.WebsiteUrl + "/" + image;
                    }
                    else
                    {
                        DataInfoObject.Image = image;
                    }

                    GlideImageLoader.LoadImage(this, DataInfoObject.Image, JobCoverImage, ImageStyle.FitCenter, ImagePlaceholders.Drawable);

                    if (DataInfoObject.IsOwner != null && DataInfoObject.IsOwner.Value)
                    {
                        TxtMore.Visibility = ViewStates.Visible;
                        JobButton.Text     = GetString(Resource.String.Lbl_show_applies) + " (" + DataInfoObject.ApplyCount + ")";
                        JobButton.Tag      = "ShowApply";
                    }

                    //Set Button if its applied
                    if (DataInfoObject.Apply == "true")
                    {
                        JobButton.Text    = GetString(Resource.String.Lbl_already_applied);
                        JobButton.Enabled = false;
                    }

                    JobTitle.Text = Methods.FunString.DecodeString(DataInfoObject.Title);

                    if (DataInfoObject.Page != null)
                    {
                        PageName.Text = "@" + Methods.FunString.DecodeString(DataInfoObject.Page.PageName.Replace("@", ""));
                        if (DataInfoObject.Page.IsPageOnwer != null && DataInfoObject.Page.IsPageOnwer.Value)
                        {
                            JobButton.Text = GetString(Resource.String.Lbl_show_applies) + " (" + DataInfoObject.ApplyCount + ")";
                        }
                    }

                    //Set Description
                    var description = Methods.FunString.DecodeString(DataInfoObject.Description);
                    Description.Text = description;
                    ReadMoreOption.AddReadMoreTo(Description, new String(description));

                    //Set Salary Date
                    string salaryDate = DataInfoObject.SalaryDate switch
                    {
                        "per_hour" => GetString(Resource.String.Lbl_per_hour),
                        "per_day" => GetString(Resource.String.Lbl_per_day),
                        "per_week" => GetString(Resource.String.Lbl_per_week),
                        "per_month" => GetString(Resource.String.Lbl_per_month),
                        "per_year" => GetString(Resource.String.Lbl_per_year),
                        _ => GetString(Resource.String.Lbl_Unknown)
                    };

                    MinimumNumber.Text = DataInfoObject.Minimum + " " + salaryDate;
                    MaximumNumber.Text = DataInfoObject.Maximum + " " + salaryDate;

                    //Set job Time
                    var jobInfo = IonIconsFonts.Pin + " " + DataInfoObject.Location + "  " + " ";
                    jobInfo += IonIconsFonts.Time + " " + Methods.Time.TimeAgo(Convert.ToInt32(DataInfoObject.Time), false) + " " + " ";

                    //Set job type
                    if (DataInfoObject.JobType == "full_time")
                    {
                        jobInfo += IonIconsFonts.IosBriefcase + " " + GetString(Resource.String.Lbl_full_time);
                    }
                    else if (DataInfoObject.JobType == "part_time")
                    {
                        jobInfo += IonIconsFonts.IosBriefcase + " " + GetString(Resource.String.Lbl_part_time);
                    }
                    else if (DataInfoObject.JobType == "internship")
                    {
                        jobInfo += IonIconsFonts.IosBriefcase + " " + GetString(Resource.String.Lbl_internship);
                    }
                    else if (DataInfoObject.JobType == "volunteer")
                    {
                        jobInfo += IonIconsFonts.IosBriefcase + " " + GetString(Resource.String.Lbl_volunteer);
                    }
                    else if (DataInfoObject.JobType == "contract")
                    {
                        jobInfo += IonIconsFonts.IosBriefcase + " " + GetString(Resource.String.Lbl_contract);
                    }
                    else
                    {
                        jobInfo += IonIconsFonts.IosBriefcase + " " + GetString(Resource.String.Lbl_Unknown);
                    }

                    var categoryName = CategoriesController.ListCategoriesJob.FirstOrDefault(categories => categories.CategoriesId == DataInfoObject.Category)?.CategoriesName;
                    jobInfo += " " + " " + IonIconsFonts.Pricetag + " " + categoryName;

                    var woTextDecorator = new WoTextDecorator
                    {
                        DecoratedContent = new SpannableString(jobInfo),
                        Content          = jobInfo
                    };
                    woTextDecorator.SetTextColor(IonIconsFonts.Pin, "#ff5722");
                    woTextDecorator.SetTextColor(IonIconsFonts.Time, "#4caf50");
                    woTextDecorator.SetTextColor(IonIconsFonts.IosBriefcase, "#2196f3");
                    woTextDecorator.SetTextColor(IonIconsFonts.Pricetag, "#795548");
                    woTextDecorator.Build(JobInfo, woTextDecorator.DecoratedContent);
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }