Beispiel #1
0
        private void Initialize(ContactsAdapterViewHolder holder, UserDataObject users)
        {
            try
            {
                GlideImageLoader.LoadImage(ActivityContext, users.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable, true);

                holder.Name.Text = Methods.FunString.SubStringCutOf(WoWonderTools.GetNameFinal(users), 20);

                if (users.Verified == "1")
                {
                    holder.Name.SetCompoundDrawablesWithIntrinsicBounds(0, 0, Resource.Drawable.icon_checkmark_small_vector, 0);
                }

                if (Type == TypeTextSecondary.None)
                {
                    holder.About.Visibility = ViewStates.Gone;
                }
                else
                {
                    holder.About.Text = Type == TypeTextSecondary.About ? Methods.FunString.SubStringCutOf(WoWonderTools.GetAboutFinal(users), 25) : ActivityContext.GetString(Resource.String.Lbl_Last_seen) + " " + Methods.Time.TimeAgo(int.Parse(users.LastseenUnixTime), true);
                }

                //Online Or offline
                var online = WoWonderTools.GetStatusOnline(int.Parse(users.LastseenUnixTime), users.LastseenStatus);
                holder.ImageLastSeen.SetImageResource(online ? Resource.Drawable.Green_Color : Resource.Drawable.Grey_Offline);

                if (ShowButton)
                {
                    switch (users.IsFollowing)
                    {
                    // My Friend
                    case "1":
                    {
                        holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                        holder.Button.SetTextColor(Color.ParseColor("#ffffff"));
                        if (AppSettings.ConnectivitySystem == 1)         // Following
                        {
                            holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_Following);
                        }
                        else         // Friend
                        {
                            holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_Friends);
                        }
                        holder.Button.Tag = "true";
                        break;
                    }

                    // Request
                    case "2":
                        holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                        holder.Button.SetTextColor(Color.ParseColor("#444444"));
                        holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_Request);
                        holder.Button.Tag  = "Request";
                        break;

                    //Not Friend
                    case "0":
                    {
                        holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                        holder.Button.SetTextColor(Color.ParseColor(AppSettings.MainColor));
                        if (AppSettings.ConnectivitySystem == 1)         // Following
                        {
                            holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_Follow);
                        }
                        else         // Friend
                        {
                            holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_AddFriends);
                        }
                        holder.Button.Tag = "false";

                        var dbDatabase = new SqLiteDatabase();
                        dbDatabase.Delete_UsersContact(users.UserId);
                        dbDatabase.Dispose();
                        break;
                    }

                    default:
                    {
                        holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                        holder.Button.SetTextColor(Color.ParseColor("#ffffff"));
                        if (AppSettings.ConnectivitySystem == 1)         // Following
                        {
                            holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_Following);
                        }
                        else         // Friend
                        {
                            holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_Friends);
                        }

                        users.IsFollowing = "1";
                        holder.Button.Tag = "true";
                        break;
                    }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                if (viewHolder is ProUsersAdapterViewHolder holder)
                {
                    var item = MProUsersList[position];
                    if (item != null)
                    {
                        GlideImageLoader.LoadImage(ActivityContext, item.Avatar, holder.UserImage, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                        if (item.Type == "Your")
                        {
                            //holder.ViewIcon.BackgroundTintList = ColorStateList.ValueOf(Color.ParseColor("#444444"));
                            holder.ViewIcon.SetBackgroundResource(Resource.Drawable.circlegradient5);
                            holder.ImageIcon.SetImageResource(Resource.Drawable.ic_add);
                            holder.Name.Text       = ActivityContext.GetText(Resource.String.Lbl_AddMe);
                            holder.Name.Visibility = ViewStates.Visible;
                        }
                        else
                        {
                            switch (item.ProType)
                            {
                            //  STAR
                            case "1":
                                holder.ViewIcon.SetBackgroundResource(Resource.Drawable.circlegradient6);
                                holder.ImageIcon.SetImageResource(Resource.Drawable.ic_plan_1);
                                break;

                            // HOT
                            case "2":
                                holder.ViewIcon.SetBackgroundResource(Resource.Drawable.circlegradient4);
                                holder.ImageIcon.SetImageResource(Resource.Drawable.ic_plan_2);
                                break;

                            // ULTIMA
                            case "3":
                                holder.ViewIcon.SetBackgroundResource(Resource.Drawable.circlegradient);
                                holder.ImageIcon.SetImageResource(Resource.Drawable.ic_plan_3);
                                break;

                            // VIP
                            case "4":
                                holder.ViewIcon.SetBackgroundResource(Resource.Drawable.circlegradient2);
                                holder.ImageIcon.SetImageResource(Resource.Drawable.ic_plan_4);
                                break;

                            default:
                                holder.ViewIcon.SetBackgroundResource(Resource.Drawable.circlegradient2);
                                holder.ImageIcon.SetImageResource(Resource.Drawable.ic_plan_4);
                                break;
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
        private void InitializeLast(LastActivitiesAdapterViewHolder holder, ActivityDataObject item)
        {
            try
            {
                GlideImageLoader.LoadImage(ActivityContext, item.Activator.Avatar, holder.ActivitiesImage, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                string replace = "";
                if (item.ActivityType.Contains("reaction"))
                {
                    if (item.ActivityType.Contains("Like"))
                    {
                        holder.Icon.SetImageResource(Resource.Drawable.emoji_like);
                    }
                    else if (item.ActivityType.Contains("Love"))
                    {
                        holder.Icon.SetImageResource(Resource.Drawable.emoji_love);
                    }
                    else if (item.ActivityType.Contains("HaHa"))
                    {
                        holder.Icon.SetImageResource(Resource.Drawable.emoji_haha);
                    }
                    else if (item.ActivityType.Contains("Wow"))
                    {
                        holder.Icon.SetImageResource(Resource.Drawable.emoji_wow);
                    }
                    else if (item.ActivityType.Contains("Sad"))
                    {
                        holder.Icon.SetImageResource(Resource.Drawable.emoji_sad);
                    }
                    else if (item.ActivityType.Contains("Angry"))
                    {
                        holder.Icon.SetImageResource(Resource.Drawable.emoji_angry);
                    }

                    if (UserDetails.LangName.Contains("fr"))
                    {
                        var split = item.ActivityText.Split("reacted to").Last().Replace("post", "");
                        replace = item.Activator.Name + " " + ActivityContext.GetString(Resource.String.Lbl_ReactedTo) + " " + ActivityContext.GetString(Resource.String.Lbl_Post) + " " + split;
                    }
                    else
                    {
                        replace = item.ActivityText.Replace("reacted to", ActivityContext.GetString(Resource.String.Lbl_ReactedTo)).Replace("post", ActivityContext.GetString(Resource.String.Lbl_Post));
                    }
                }
                else
                {
                    switch (item.ActivityType)
                    {
                    case "friend":
                    case "following":
                    {
                        holder.Icon.SetImageResource(Resource.Drawable.ic_add);
                        //holder.Icon.SetColorFilter(Color.ParseColor("#333333"), PorterDuff.Mode.Multiply);

                        if (item.ActivityText.Contains("started following"))
                        {
                            if (UserDetails.LangName.Contains("fr"))
                            {
                                var split = item.ActivityText.Split("started following").Last().Replace("post", "");
                                replace = item.Activator.Name + " " + ActivityContext.GetString(Resource.String.Lbl_StartedFollowing) + " " + split;
                            }
                            else
                            {
                                replace = item.ActivityText.Replace("started following", ActivityContext.GetString(Resource.String.Lbl_StartedFollowing));
                            }
                        }
                        else if (item.ActivityText.Contains("become friends with"))
                        {
                            if (UserDetails.LangName.Contains("fr"))
                            {
                                var split = item.ActivityText.Split("become friends with").Last().Replace("post", "");
                                replace = item.Activator.Name + " " + ActivityContext.GetString(Resource.String.Lbl_BecomeFriendsWith) + " " + ActivityContext.GetString(Resource.String.Lbl_Post) + " " + split;
                            }
                            else
                            {
                                replace = item.ActivityText.Replace("become friends with", ActivityContext.GetString(Resource.String.Lbl_BecomeFriendsWith));
                            }
                        }
                        else if (item.ActivityText.Contains("is following"))
                        {
                            if (UserDetails.LangName.Contains("fr"))
                            {
                                var split = item.ActivityText.Split("is following").Last().Replace("post", "");
                                replace = item.Activator.Name + " " + ActivityContext.GetString(Resource.String.Lbl_IsFollowing) + " " + split;
                            }
                            else
                            {
                                replace = item.ActivityText.Replace("is following", ActivityContext.GetString(Resource.String.Lbl_IsFollowing));
                            }
                        }

                        break;
                    }

                    case "liked_post":
                    {
                        holder.Icon.SetImageResource(Resource.Drawable.emoji_like);

                        if (UserDetails.LangName.Contains("fr"))
                        {
                            var split = item.ActivityText.Split("liked").Last().Replace("post", "");
                            replace = item.Activator.Name + " " + ActivityContext.GetString(Resource.String.Btn_Liked) + " " + ActivityContext.GetString(Resource.String.Lbl_Post) + " " + split;
                        }
                        else
                        {
                            replace = item.ActivityText.Replace("liked", ActivityContext.GetString(Resource.String.Btn_Liked)).Replace("post", ActivityContext.GetString(Resource.String.Lbl_Post));
                        }

                        break;
                    }

                    case "wondered_post":
                    {
                        holder.Icon.SetImageResource(Resource.Drawable.ic_action_wowonder);
                        //holder.Icon.SetColorFilter(Color.ParseColor("#b71c1c"), PorterDuff.Mode.Multiply);

                        if (item.ActivityText.Contains("wondered"))
                        {
                            if (UserDetails.LangName.Contains("fr"))
                            {
                                var split = item.ActivityText.Split("wondered").Last().Replace("post", "");
                                replace = item.Activator.Name + " " + ActivityContext.GetString(Resource.String.Lbl_wondered) + " " + ActivityContext.GetString(Resource.String.Lbl_Post) + " " + split;
                            }
                            else
                            {
                                replace = item.ActivityText.Replace("wondered", ActivityContext.GetString(Resource.String.Lbl_wondered)).Replace("post", ActivityContext.GetString(Resource.String.Lbl_Post));
                            }
                        }
                        else if (item.ActivityText.Contains("disliked"))
                        {
                            if (UserDetails.LangName.Contains("fr"))
                            {
                                var split = item.ActivityText.Split("disliked").Last().Replace("post", "");
                                replace = item.Activator.Name + " " + ActivityContext.GetString(Resource.String.Lbl_disliked) + " " + ActivityContext.GetString(Resource.String.Lbl_Post) + " " + split;
                            }
                            else
                            {
                                replace = item.ActivityText.Replace("disliked", ActivityContext.GetString(Resource.String.Lbl_disliked)).Replace("post", ActivityContext.GetString(Resource.String.Lbl_Post));
                            }
                        }

                        break;
                    }

                    case "shared_post":
                    {
                        holder.Icon.SetImageResource(Resource.Drawable.ic_action_share);
                        // holder.Icon.SetColorFilter(Color.ParseColor("#333333"), PorterDuff.Mode.Multiply);

                        if (UserDetails.LangName.Contains("fr"))
                        {
                            var split = item.ActivityText.Split("shared").Last().Replace("post", "");
                            replace = item.Activator.Name + " " + ActivityContext.GetString(Resource.String.Lbl_shared) + " " + ActivityContext.GetString(Resource.String.Lbl_Post) + " " + split;
                        }
                        else
                        {
                            replace = item.ActivityText.Replace("shared", ActivityContext.GetString(Resource.String.Lbl_shared)).Replace("post", ActivityContext.GetString(Resource.String.Lbl_Post));
                        }

                        break;
                    }

                    case "commented_post":
                    {
                        holder.Icon.SetImageResource(Resource.Drawable.ic_action_comment);
                        holder.Icon.SetImageResource(Resource.Drawable.ic_action_comments);
                        // holder.Icon.SetColorFilter(Color.ParseColor("#333333"), PorterDuff.Mode.Multiply);

                        if (UserDetails.LangName.Contains("fr"))
                        {
                            var split = item.ActivityText.Split("commented on").Last().Replace("post", "");
                            replace = item.Activator.Name + " " + ActivityContext.GetString(Resource.String.Lbl_CommentedOn) + " " + ActivityContext.GetString(Resource.String.Lbl_Post) + " " + split;
                        }
                        else
                        {
                            replace = item.ActivityText.Replace("commented on", ActivityContext.GetString(Resource.String.Lbl_CommentedOn)).Replace("post", ActivityContext.GetString(Resource.String.Lbl_Post));
                        }

                        break;
                    }
                    }
                }

                holder.ActivitiesEvent.Text = !string.IsNullOrEmpty(replace) ? replace : item.ActivityText;

                holder.Time.Text = Methods.Time.TimeAgo(Convert.ToInt32(item.Time), false);
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Beispiel #4
0
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                Position = position;

                var item = TrendingList[Position];
                if (item != null)
                {
                    if (item.Type == ItemType.Channel)
                    {
                        if (viewHolder is TrendingAdapterViewHolder holder)
                        {
                            if (PopularChannelAdapter == null)
                            {
                                PopularChannelAdapter = new PopularChannelAdapter(ActivityContext)
                                {
                                    ChannelList = new ObservableCollection <GetPopularChannelsObject.Channel>()
                                };

                                LinearLayoutManager layoutManager = new LinearLayoutManager(ActivityContext, LinearLayoutManager.Horizontal, false);
                                holder.MRecycler.SetLayoutManager(layoutManager);
                                holder.MRecycler.GetLayoutManager().ItemPrefetchEnabled = true;

                                var sizeProvider = new FixedPreloadSizeProvider(10, 10);
                                var preLoader    = new RecyclerViewPreloader <GetPopularChannelsObject.Channel>(ActivityContext, PopularChannelAdapter, sizeProvider, 10);
                                holder.MRecycler.AddOnScrollListener(preLoader);
                                holder.MRecycler.SetAdapter(PopularChannelAdapter);
                                PopularChannelAdapter.OnItemClick += PopularChannelAdapterOnOnItemClick;
                            }

                            if (item.ChannelList.Count > 0)
                            {
                                if (PopularChannelAdapter.ChannelList.Count == 0)
                                {
                                    PopularChannelAdapter.ChannelList = new ObservableCollection <GetPopularChannelsObject.Channel>(item.ChannelList);
                                    PopularChannelAdapter.NotifyDataSetChanged();
                                }
                                else if (PopularChannelAdapter.ChannelList != null && PopularChannelAdapter.ChannelList.Count != item.ChannelList.Count)
                                {
                                    PopularChannelAdapter.ChannelList = new ObservableCollection <GetPopularChannelsObject.Channel>(item.ChannelList);
                                    PopularChannelAdapter.NotifyDataSetChanged();
                                }
                            }

                            holder.MainLinear.Visibility = ViewStates.Visible;
                            holder.MoreText.Visibility   = PopularChannelAdapter.ChannelList?.Count >= 5 ? ViewStates.Visible : ViewStates.Invisible;
                            holder.TitleText.Text        = ActivityContext.GetText(Resource.String.Lbl_PopularChannels);
                        }
                    }
                    else if (item.Type == ItemType.Video)
                    {
                        if (viewHolder is VideoRowAdapterViewHolder videoRow)
                        {
                            GlideImageLoader.LoadImage(ActivityContext, item.VideoData.Thumbnail, videoRow.VideoImage, ImageStyle.CenterCrop, ImagePlaceholders.Drawable);

                            videoRow.TxtDuration.Text = Methods.FunString.SplitStringDuration(item.VideoData.Duration);
                            videoRow.TxtTitle.Text    = Methods.FunString.DecodeString(item.VideoData.Title);

                            videoRow.TxtChannelName.Text = AppTools.GetNameFinal(item.VideoData.Owner);

                            videoRow.TxtViewsCount.Text = Methods.FunString.FormatPriceValue(Convert.ToInt32(item.VideoData.Views)) + " " + ActivityContext.GetText(Resource.String.Lbl_Views);

                            FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, videoRow.MenueView, IonIconsFonts.AndroidMoreVertical);

                            //Verified
                            if (item.VideoData.Owner.Verified == "1")
                            {
                                videoRow.IconVerified.Visibility = ViewStates.Visible;
                                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, videoRow.IconVerified, IonIconsFonts.CheckmarkCircled);
                            }
                            else
                            {
                                videoRow.IconVerified.Visibility = ViewStates.Gone;
                            }

                            if (!videoRow.MenueView.HasOnClickListeners)
                            {
                                videoRow.MenueView.Click += (sender, args) =>
                                {
                                    ContextThemeWrapper ctw   = new ContextThemeWrapper(ActivityContext, Resource.Style.PopupMenuStyle);
                                    PopupMenu           popup = new PopupMenu(ctw, videoRow.MenueView);
                                    popup.MenuInflater.Inflate(Resource.Menu.Video_More_Menue, popup.Menu);

                                    popup.Show();
                                    popup.MenuItemClick += (o, eventArgs) =>
                                    {
                                        try
                                        {
                                            var id = eventArgs.Item.ItemId;
                                            switch (id)
                                            {
                                            case Resource.Id.menu_AddWatchLater:
                                                LibrarySynchronizer.AddToWatchLater(item.VideoData);
                                                break;

                                            case Resource.Id.menu_AddPlaylist:
                                                LibrarySynchronizer.AddToPlaylist(item.VideoData);
                                                break;

                                            case Resource.Id.menu_Remove:
                                                OnMenuRemove_Click(item.VideoData);
                                                break;

                                            case Resource.Id.menu_Share:
                                                LibrarySynchronizer.ShareVideo(item.VideoData);
                                                break;

                                            case Resource.Id.menu_Report:
                                                LibrarySynchronizer.AddReportVideo(item.VideoData);
                                                break;
                                            }
                                        }
                                        catch (Exception exception)
                                        {
                                            Console.WriteLine(exception);
                                        }
                                    };
                                }
                            }
                            ;

                            //Set Badge on videos
                            AppTools.ShowGlobalBadgeSystem(videoRow.VideoType, item.VideoData);
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        //Result
        public override async void OnActivityResult(int requestCode, int resultCode, Intent data)
        {
            try
            {
                base.OnActivityResult(requestCode, resultCode, data);
                if (requestCode == 108 || requestCode == CropImage.CropImageActivityRequestCode)
                {
                    if (Methods.CheckConnectivity())
                    {
                        var result = CropImage.GetActivityResult(data);

                        if (result.IsSuccessful)
                        {
                            var resultPathImage = result.Uri.Path;

                            if (!string.IsNullOrEmpty(resultPathImage))
                            {
                                Java.IO.File file2    = new Java.IO.File(resultPathImage);
                                var          photoUri = FileProvider.GetUriForFile(Activity, Activity.PackageName + ".fileprovider", file2);

                                var check = AppTools.CheckMimeTypesWithServer(resultPathImage);
                                if (!check)
                                {
                                    //this file not supported on the server , please select another file
                                    Toast.MakeText(Activity, Activity.GetString(Resource.String.Lbl_ErrorFileNotSupported), ToastLength.Short).Show();
                                    return;
                                }

                                GlideImageLoader.LoadImage(Activity, photoUri.Path, ImageUser, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                                var dataUser = ListUtils.MyProfileList.FirstOrDefault();
                                if (dataUser != null)
                                {
                                    dataUser.Avatar    = resultPathImage;
                                    UserDetails.Avatar = resultPathImage;

                                    SqLiteDatabase dbDatabase = new SqLiteDatabase();
                                    dbDatabase.InsertOrUpdateToMyProfileTable(dataUser);
                                    dbDatabase.Dispose();
                                }

                                var dataStory = GlobalContext.NewsFeedFragment.StoryAdapter?.StoryList?.FirstOrDefault(a => a.Type == "Your");
                                if (dataStory != null)
                                {
                                    dataStory.Avatar = resultPathImage;
                                    GlobalContext.NewsFeedFragment.StoryAdapter.NotifyItemChanged(0);
                                }

                                await Task.Run(async() =>
                                {
                                    (int apiStatus, var respond) = await RequestsAsync.User.SaveImageUser(resultPathImage).ConfigureAwait(false);
                                });
                            }
                            else
                            {
                                Toast.MakeText(Activity, Activity.GetText(Resource.String.Lbl_something_went_wrong), ToastLength.Long).Show();
                            }
                        }
                        else
                        {
                            Toast.MakeText(Activity, Activity.GetText(Resource.String.Lbl_something_went_wrong), ToastLength.Long).Show();
                        }
                    }
                    else
                    {
                        Toast.MakeText(Activity, Activity.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Long).Show();
                    }
                }
                else if (requestCode == 3000)
                {
                    LoadProfile();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                if (viewHolder.ItemViewType == 666)
                {
                    if (!(viewHolder is MainHolders.EmptyStateAdapterViewHolder emptyHolder))
                    {
                        return;
                    }

                    emptyHolder.EmptyText.Text = "No Replies to be displayed";
                    return;
                }

                if (!(viewHolder is ReplyCommentAdapterViewHolder holder))
                {
                    return;
                }

                var item = ReplyCommentList[position];
                if (item == null)
                {
                    return;
                }

                if (AppSettings.FlowDirectionRightToLeft)
                {
                    holder.BubbleLayout.LayoutDirection = LayoutDirection.Rtl;
                }

                if (!string.IsNullOrEmpty(item.Text) || !string.IsNullOrWhiteSpace(item.Text))
                {
                    var changer = new TextSanitizer(holder.CommentText, ActivityContext);
                    changer.Load(Methods.FunString.DecodeString(item.Text));
                }
                else
                {
                    holder.CommentText.Visibility = ViewStates.Gone;
                }

                if (holder.TimeTextView.Tag?.ToString() == "true")
                {
                    return;
                }

                holder.TimeTextView.Text = Methods.Time.TimeAgo(int.Parse(item.Time));
                holder.UserName.Text     = item.Publisher.Name;
                GlideImageLoader.LoadImage(ActivityContext, item.Publisher.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Color);

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

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

                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.CheckmarkCircled);
                }

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

                decorator.Build();

                if (holder.ItemViewType == 1)
                {
                    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
                    {
                        GlideImageLoader.LoadImage(ActivityContext, Client.WebsiteUrl + "/" + item.CFile, holder.CommentImage, ImageStyle.CenterCrop, ImagePlaceholders.Color);
                    }
                }

                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);
                    if (AppSettings.SetTabDarkTheme)
                    {
                        holder.LikeTextView.SetTextColor(Color.ParseColor("#ffffff"));
                    }
                    else
                    {
                        holder.LikeTextView.SetTextColor(Color.ParseColor("#000000"));
                    }
                    holder.LikeTextView.Tag = "Like";
                }

                holder.TimeTextView.Tag = "true";

                if (holder.Image.HasOnClickListeners)
                {
                    return;
                }

                var postEventListener = new CommentClickListener(ActivityContext, "Reply");

                //Create an Event
                holder.MainView.LongClick += (sender, e) => postEventListener.MoreCommentReplyPostClick(new CommentReplyClickEventArgs {
                    CommentObject = item, Position = position, View = holder.MainView
                });

                holder.Image.Click += (sender, args) => postEventListener.ProfilePostClick(new ProfileClickEventArgs {
                    Holder = holder, CommentClass = item, Position = position, View = holder.MainView
                });

                holder.ReplyTextView.Click += (sender, args) =>
                {
                    try
                    {
                        ActivityContext.TxtComment.Text = "";
                        ActivityContext.TxtComment.Text = "@" + item.Publisher.Username + " ";
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                    }
                };

                holder.LikeTextView.Click += delegate
                {
                    try
                    {
                        if (holder.LikeTextView.Tag.ToString() == "Liked")
                        {
                            item.IsCommentLiked = false;

                            holder.LikeTextView.Text = ActivityContext.GetText(Resource.String.Btn_Like);
                            if (AppSettings.SetTabDarkTheme)
                            {
                                holder.LikeTextView.SetTextColor(Color.ParseColor("#ffffff"));
                            }
                            else
                            {
                                holder.LikeTextView.SetTextColor(Color.ParseColor("#000000"));
                            }
                            holder.LikeTextView.Tag = "Like";

                            //sent api Dislike comment
                            PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                                () => RequestsAsync.Comment.LikeUnLikeCommentAsync(item.Id, false)
                            });
                        }
                        else
                        {
                            item.IsCommentLiked = true;

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

                            //sent api like comment
                            PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                                () => RequestsAsync.Comment.LikeUnLikeCommentAsync(item.Id, true)
                            });
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                    }
                };

                holder.CommentImage.Click += (sender, args) => postEventListener.OpenImageLightBox(item);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
Beispiel #7
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 NotificationsAdapterViewHolder holder)
                {
                    var item = NotificationsList[position];
                    if (item != null)
                    {
                        holder.UserNameNoitfy.Text = DeepSoundTools.GetNameFinal(item.UserData);

                        GlideImageLoader.LoadImage(ActivityContext, item.UserData.Avatar, holder.ImageUser, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                        if (item.NType == "follow_user")
                        {
                            if (holder.IconNotify.Text != IonIconsFonts.PersonAdd)
                            {
                                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotify, IonIconsFonts.PersonAdd);
                            }

                            holder.Description.Text = ActivityContext.GetText(Resource.String.Lbl_FollowUser);
                        }
                        else if (item.NType == "liked_track")
                        {
                            if (holder.IconNotify.Text != IonIconsFonts.Thumbsup)
                            {
                                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotify, IonIconsFonts.Thumbsup);
                            }
                            holder.Description.Text = ActivityContext.GetText(Resource.String.Lbl_LikedTrack);
                        }
                        else if (item.NType == "liked_comment")
                        {
                            if (holder.IconNotify.Text != IonIconsFonts.Pricetag)
                            {
                                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotify, IonIconsFonts.Pricetag);
                            }

                            holder.Description.Text = ActivityContext.GetText(Resource.String.Lbl_LikedComment);
                        }
                        else if (item.NType == "purchased")
                        {
                            if (holder.IconNotify.Text != IonIconsFonts.Cash)
                            {
                                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotify, IonIconsFonts.Cash);
                            }

                            holder.Description.Text = ActivityContext.GetText(Resource.String.Lbl_PurchasedYourSong);
                        }
                        else if (item.NType == "approved_artist")
                        {
                            if (holder.IconNotify.Text != IonIconsFonts.CheckmarkCircled)
                            {
                                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotify, IonIconsFonts.CheckmarkCircled);
                            }

                            holder.Description.Text = ActivityContext.GetText(Resource.String.Lbl_ApprovedArtist);
                        }
                        else if (item.NType == "decline_artist")
                        {
                            if (holder.IconNotify.Text != IonIconsFonts.SadOutline)
                            {
                                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotify, IonIconsFonts.SadOutline);
                            }

                            holder.Description.Text = ActivityContext.GetText(Resource.String.Lbl_DeclineArtist);
                        }
                        else if (item.NType == "new_track")
                        {
                            if (holder.IconNotify.Text != IonIconsFonts.AndroidAdd)
                            {
                                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotify, IonIconsFonts.AndroidAdd);
                            }

                            holder.Description.Text = ActivityContext.GetText(Resource.String.Lbl_UploadNewTrack);
                        }
                        else
                        {
                            FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotify, IonIconsFonts.AndroidNotifications);
                            holder.Description.Text = item.NText;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Beispiel #8
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 JobsAdapterViewHolder holder)
                {
                    var item = JobList[position];
                    if (item != null)
                    {
                        if (item.Image.Contains("http"))
                        {
                            var image = item.Image.Replace(Client.WebsiteUrl + "/", "");
                            if (!image.Contains("http"))
                            {
                                item.Image = Client.WebsiteUrl + "/" + image;
                            }
                            else
                            {
                                item.Image = image;
                            }

                            GlideImageLoader.LoadImage(ActivityContext, item.Image, holder.Image, ImageStyle.FitCenter, ImagePlaceholders.Drawable);
                        }
                        else
                        {
                            File file2    = new File(item.Image);
                            var  photoUri = FileProvider.GetUriForFile(ActivityContext, ActivityContext.PackageName + ".fileprovider", file2);
                            Glide.With(ActivityContext).Load(photoUri).Apply(new RequestOptions()).Into(holder.Image);
                        }

                        holder.Title.Text = Methods.FunString.DecodeString(item.Title);

                        var(currency, currencyIcon) = WoWonderTools.GetCurrency(item.Currency);
                        var categoryName = CategoriesController.ListCategoriesJob.FirstOrDefault(categories => categories.CategoriesId == item.Category)?.CategoriesName;
                        Console.WriteLine(currency);
                        if (string.IsNullOrEmpty(categoryName))
                        {
                            categoryName = Application.Context.GetText(Resource.String.Lbl_Unknown);
                        }

                        holder.Salary.Text = currencyIcon + " " + item.Minimum + " - " + currencyIcon + " " + item.Maximum + " . " + categoryName;

                        holder.Description.Text = Methods.FunString.SubStringCutOf(Methods.FunString.DecodeString(item.Description), 100);

                        if (item.IsOwner != null && item.IsOwner.Value)
                        {
                            holder.IconMore.Visibility = ViewStates.Visible;
                            holder.Button.Text         = ActivityContext.GetString(Resource.String.Lbl_show_applies) + " (" + item.ApplyCount + ")";
                            holder.Button.Tag          = "ShowApply";
                        }
                        else
                        {
                            holder.IconMore.Visibility = ViewStates.Gone;
                        }

                        //Set Button if its applied
                        if (item.Apply == "true")
                        {
                            holder.Button.Text    = ActivityContext.GetString(Resource.String.Lbl_already_applied);
                            holder.Button.Enabled = false;
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
        private void LoadCommentMovies()
        {
            try
            {
                if (MoviesObject == null)
                {
                    return;
                }

                if (AppSettings.FlowDirectionRightToLeft)
                {
                    BubbleLayout.LayoutDirection = LayoutDirection.Rtl;
                }

                var changer = new TextSanitizer(CommentText, Activity);
                changer.Load(Methods.FunString.DecodeString(MoviesObject.Text));

                TimeTextView.Text = Methods.Time.TimeAgo(Convert.ToInt32(MoviesObject.Posted), false);
                UserName.Text     = MoviesObject.UserData.Name;

                GlideImageLoader.LoadImage(Activity, MoviesObject.UserData.Avatar, Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                var textHighLighter = MoviesObject.UserData.Name;
                var textIsPro       = string.Empty;

                if (MoviesObject.UserData.Verified == "1")
                {
                    textHighLighter += " " + IonIconsFonts.CheckmarkCircle;
                }

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

                var decorator = TextDecorator.Decorate(UserName, textHighLighter).SetTextStyle((int)TypefaceStyle.Bold, 0, MoviesObject.UserData.Name.Length);

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

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

                decorator.Build();

                if (MoviesObject.Replies?.Count > 0)
                {
                    ReplyTextView.Text = Activity.GetText(Resource.String.Lbl_Reply) + " " + "(" + MoviesObject.Replies + ")";
                }

                if (MoviesObject.IsCommentLiked)
                {
                    LikeTextView.Text = Activity.GetText(Resource.String.Btn_Liked);
                    LikeTextView.SetTextColor(Color.ParseColor(AppSettings.MainColor));
                    LikeTextView.Tag = "Liked";
                }
                else
                {
                    LikeTextView.Text = Activity.GetText(Resource.String.Btn_Like);
                    LikeTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#ffffff") : Color.ParseColor("#000000"));
                    LikeTextView.Tag = "Like";
                }

                TimeTextView.Tag = "true";

                if (Image.HasOnClickListeners)
                {
                    return;
                }

                //Create an Event
                Image.Click += (sender, args) =>
                {
                    try
                    {
                        WoWonderTools.OpenProfile(Activity, MoviesObject.UserData.UserId, MoviesObject.UserData);
                    }
                    catch (Exception e)
                    {
                        Methods.DisplayReportResultTrack(e);
                    }
                };

                LikeTextView.Click += delegate
                {
                    try
                    {
                        if (!Methods.CheckConnectivity())
                        {
                            Toast.MakeText(Activity, Activity.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show();
                            return;
                        }

                        if (LikeTextView?.Tag?.ToString() == "Liked")
                        {
                            LikeTextView.Text = Activity.GetText(Resource.String.Btn_Like);
                            LikeTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#ffffff") : Color.ParseColor("#000000"));
                            LikeTextView.Tag = "Like";

                            MoviesObject.IsCommentLiked = false;
                            //sent api Dislike comment
                            PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                                () => RequestsAsync.Movies.LikeUnLikeCommentAsync(MoviesObject.MovieId, MoviesObject.Id, false)
                            });
                        }
                        else
                        {
                            LikeTextView.Text = Activity.GetText(Resource.String.Btn_Liked);
                            LikeTextView.SetTextColor(Color.ParseColor(AppSettings.MainColor));
                            LikeTextView.Tag = "Liked";

                            MoviesObject.IsCommentLiked = true;
                            //sent api Dislike comment
                            PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                                () => RequestsAsync.Movies.LikeUnLikeCommentAsync(MoviesObject.MovieId, MoviesObject.Id, false)
                            });
                        }
                    }
                    catch (Exception e)
                    {
                        Methods.DisplayReportResultTrack(e);
                    }
                };
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                if (viewHolder is SuggestionsAdapterViewHolder holder)
                {
                    var item = UserList[position];
                    if (item != null)
                    {
                        holder.Username.Text = Methods.FunString.SubStringCutOf("@" + item.Username, 15);
                        holder.Name.Text     = Methods.FunString.SubStringCutOf(WoWonderTools.GetNameFinal(item), 15);

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

                        switch (item.IsFollowing)
                        {
                        // My Friend
                        case "1":
                        {
                            holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                            holder.Button.SetTextColor(Color.ParseColor("#ffffff"));
                            if (AppSettings.ConnectivitySystem == 1)         // Following
                            {
                                holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_Following);
                            }
                            else         // Friend
                            {
                                holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_Friends);
                            }
                            holder.Button.Tag = "true";
                            break;
                        }

                        // Request
                        case "2":
                            holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                            holder.Button.SetTextColor(Color.ParseColor("#444444"));
                            holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_Request);
                            holder.Button.Tag  = "Request";
                            break;

                        //Not Friend
                        case "0":
                        {
                            holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                            holder.Button.SetTextColor(Color.ParseColor(AppSettings.MainColor));
                            if (AppSettings.ConnectivitySystem == 1)         // Following
                            {
                                holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_Follow);
                            }
                            else         // Friend
                            {
                                holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_AddFriends);
                            }
                            holder.Button.Tag = "false";

                            var dbDatabase = new SqLiteDatabase();
                            dbDatabase.Delete_UsersContact(item.UserId);
                            dbDatabase.Dispose();
                            break;
                        }

                        default:
                        {
                            holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                            holder.Button.SetTextColor(Color.ParseColor("#ffffff"));
                            if (AppSettings.ConnectivitySystem == 1)         // Following
                            {
                                holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_Following);
                            }
                            else         // Friend
                            {
                                holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_Friends);
                            }

                            item.IsFollowing  = "1";
                            holder.Button.Tag = "true";
                            break;
                        }
                        }

                        if (!holder.Button.HasOnClickListeners)
                        {
                            holder.Button.Click += (sender, e) => FollowButtonClick(new FollowSuggestionsClickEventArgs {
                                View = viewHolder.ItemView, UserClass = item, Position = position, ButtonFollow = holder.Button
                            });
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                if (viewHolder.ItemViewType == 666)
                {
                    if (!(viewHolder is AdapterHolders.EmptyStateAdapterViewHolder emptyHolder))
                    {
                        return;
                    }

                    emptyHolder.EmptyText.Text = "No Replies to be displayed";
                    return;
                }

                if (!(viewHolder is CommentAdapterViewHolder holder))
                {
                    return;
                }

                var item = ReplyCommentList[position];
                if (item == null)
                {
                    return;
                }

                if (AppSettings.FlowDirectionRightToLeft)
                {
                    holder.BubbleLayout.LayoutDirection = LayoutDirection.Rtl;
                }

                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;
                }

                if (holder.TimeTextView.Tag?.ToString() == "true")
                {
                    return;
                }

                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.Color);

                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();

                if (holder.ItemViewType == 1)
                {
                    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
                    {
                        GlideImageLoader.LoadImage(ActivityContext, Client.WebsiteUrl + "/" + item.CFile, holder.CommentImage, ImageStyle.CenterCrop, ImagePlaceholders.Color);
                    }
                }

                if (AppSettings.PostButton == PostButtonSystem.ReactionDefault || AppSettings.PostButton == PostButtonSystem.ReactionSubShine)
                {
                    item.Reaction ??= new WoWonderClient.Classes.Posts.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 exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
Beispiel #12
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 CommentAdapterViewHolder holder)
                {
                    var item = CommentList[position];
                    if (item != null)
                    {
                        GlideImageLoader.LoadImage(ActivityContext, item.CommentUserData.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                        TextSanitizer chnager = new TextSanitizer(holder.CommentText, ActivityContext);
                        chnager.Load(Methods.FunString.DecodeString(item.Text));
                        holder.TimeTextView.Text = item.TextTime;

                        holder.UsernameTextView.Text = AppTools.GetNameFinal(item.CommentUserData);

                        holder.LikeNumber.Text   = Methods.FunString.FormatPriceValue(Convert.ToInt32(item.Likes));
                        holder.UnLikeNumber.Text = Methods.FunString.FormatPriceValue(Convert.ToInt32(item.Likes));
                        holder.RepliesCount.Text = item.RepliesCount.ToString();

                        if (item.IsLikedComment == 1)
                        {
                            holder.LikeiconView.SetColorFilter(Color.ParseColor(AppSettings.MainColor));
                            holder.LikeButton.Tag = "1";
                        }
                        else
                        {
                            holder.LikeButton.Tag = "0";
                        }

                        if (item.IsDislikedComment == 1)
                        {
                            holder.UnLikeiconView.SetColorFilter(Color.ParseColor(AppSettings.MainColor));
                            holder.UnLikeButton.Tag = "1";
                        }
                        else
                        {
                            holder.UnLikeButton.Tag = "0";
                        }

                        if (!holder.Image.HasOnClickListeners)
                        {
                            holder.Image.Click += (sender, e) => OnAvatarClick(new AvatarCommentAdapterClickEventArgs {
                                Class = item, Position = position, View = holder.MainView
                            });
                        }

                        if (!holder.ReplyButton.HasOnClickListeners)
                        {
                            holder.ReplyButton.Click += (sender, e) => OnReplyClick(new CommentAdapterClickEventArgs {
                                Class = item, Position = position, View = holder.MainView
                            });
                        }

                        if (!holder.LikeButton.HasOnClickListeners)
                        {
                            holder.LikeButton.Click += (sender, e) => OnLikeButtonClick(holder, new CommentAdapterClickEventArgs {
                                Class = item, Position = position, View = holder.MainView
                            });
                        }

                        if (!holder.UnLikeButton.HasOnClickListeners)
                        {
                            holder.UnLikeButton.Click += (sender, e) => OnUnLikeButtonClick(holder, new CommentAdapterClickEventArgs {
                                Class = item, Position = position, View = holder.MainView
                            });
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
Beispiel #13
0
        private void InitComponent()
        {
            try
            {
                ImageUser   = FindViewById <ImageView>(Resource.Id.imageUser);
                NameUser    = FindViewById <TextView>(Resource.Id.nameUser);
                TxtSubTitle = FindViewById <TextView>(Resource.Id.subTitle);

                CircleCommentsPoint = FindViewById <TextView>(Resource.Id.circleCommentsPoint);
                IconCommentsPoint   = FindViewById <TextView>(Resource.Id.IconCommentsPoint);
                TextCommentsPoint   = FindViewById <TextView>(Resource.Id.TextCommentsPoint);

                CircleCreatePostPoint = FindViewById <TextView>(Resource.Id.circleCreatePostPoint);
                IconCreatePostPoint   = FindViewById <TextView>(Resource.Id.IconCreatePostPoint);
                TextCreatePostPoint   = FindViewById <TextView>(Resource.Id.TextCreatePostPoint);

                ReactingPointLayouts = FindViewById <RelativeLayout>(Resource.Id.ReactingPointLayouts);
                CircleReactingPoint  = FindViewById <TextView>(Resource.Id.circleReactingPoint);
                IconReactingPoint    = FindViewById <TextView>(Resource.Id.IconReactingPoint);
                TextReactingPoint    = FindViewById <TextView>(Resource.Id.TextReactingPoint);

                CircleCreateBlogPoint = FindViewById <TextView>(Resource.Id.circleCreateBlogPoint);
                IconCreateBlogPoint   = FindViewById <TextView>(Resource.Id.IconCreateBlogPoint);
                TextCreateBlogPoint   = FindViewById <TextView>(Resource.Id.TextCreateBlogPoint);

                AddWalletLayouts = FindViewById <RelativeLayout>(Resource.Id.AddWalletLayouts);
                TextAddWallet    = FindViewById <TextView>(Resource.Id.TextAddWallet);

                FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeSolid, CircleCommentsPoint, FontAwesomeIcon.Circle);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeSolid, CircleCreatePostPoint, FontAwesomeIcon.Circle);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeSolid, CircleReactingPoint, FontAwesomeIcon.Circle);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeSolid, CircleCreateBlogPoint, FontAwesomeIcon.Circle);

                FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeSolid, IconCommentsPoint, FontAwesomeIcon.CommentAlt);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeRegular, IconCreatePostPoint, FontAwesomeIcon.Newspaper);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeRegular, IconCreateBlogPoint, FontAwesomeIcon.Blog);

                CircleCommentsPoint.SetTextColor(Color.ParseColor("#4caf50"));
                CircleCreatePostPoint.SetTextColor(Color.ParseColor("#2196F3"));
                CircleCreateBlogPoint.SetTextColor(Color.ParseColor("#7a7a7a"));

                MAdView = FindViewById <AdView>(Resource.Id.adView);
                AdsGoogle.InitAdView(MAdView, null);

                var myProfile = ListUtils.MyProfileList?.FirstOrDefault();
                if (myProfile != null)
                {
                    GlideImageLoader.LoadImage(this, myProfile.Avatar, ImageUser, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                    NameUser.Text = WoWonderTools.GetNameFinal(myProfile);

                    TxtSubTitle.Text = GetString(Resource.String.Btn_Points) + " : " + myProfile.Points;
                }

                var setting = ListUtils.SettingsSiteList;
                if (setting != null)
                {
                    TextCommentsPoint.Text   = GetString(Resource.String.Lbl_Earn) + " " + setting.CommentsPoint + " " + GetString(Resource.String.Lbl_ByCommentingAnyPost);
                    TextCreatePostPoint.Text = GetString(Resource.String.Lbl_Earn) + " " + setting.CreatepostPoint + " " + GetString(Resource.String.Lbl_ByCreatingNewPost);
                    TextCreateBlogPoint.Text = GetString(Resource.String.Lbl_Earn) + " " + setting.CreateblogPoint + " " + GetString(Resource.String.Lbl_ByCreatingNewBlog);

                    switch (AppSettings.PostButton)
                    {
                    case PostButtonSystem.ReactionDefault:
                    case PostButtonSystem.ReactionSubShine:
                        FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeRegular, IconReactingPoint, FontAwesomeIcon.Smile);
                        CircleReactingPoint.SetTextColor(Color.ParseColor("#FF9800"));
                        TextReactingPoint.Text = GetString(Resource.String.Lbl_Earn) + " " + setting.ReactionPoint + " " + GetString(Resource.String.Lbl_ByReactingAnyPost);
                        break;

                    case PostButtonSystem.Wonder:
                        FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeSolid, IconReactingPoint, FontAwesomeIcon.Exclamation);
                        CircleReactingPoint.SetTextColor(Color.ParseColor("#b71c1c"));

                        TextReactingPoint.Text = GetString(Resource.String.Lbl_Earn) + " " + setting.WondersPoint + " " + GetString(Resource.String.Lbl_ByWonderingAnyPost);
                        break;

                    case PostButtonSystem.DisLike:
                        FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeSolid, IconReactingPoint, FontAwesomeIcon.ThumbsDown);
                        CircleReactingPoint.SetTextColor(Color.ParseColor("#0D47A1"));

                        TextReactingPoint.Text = GetString(Resource.String.Lbl_Earn) + " " + setting.DislikesPoint + " " + GetString(Resource.String.Lbl_ByDislikingAnyPost);
                        break;

                    case PostButtonSystem.Like:
                        ReactingPointLayouts.Visibility = ViewStates.Gone;
                        break;
                    }
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
        //Get General Data Using Api >> Friend Requests
        private async Task LoadGeneralData()
        {
            try
            {
                if (Methods.CheckConnectivity())
                {
                    (int apiStatus, var respond) = await RequestsAsync.Global.Get_General_Data(true, OnlineUsers, UserDetails.DeviceId, "0", "friend_requests,group_chat_requests,count_new_messages").ConfigureAwait(false);

                    if (apiStatus == 200)
                    {
                        if (respond is GetGeneralDataObject result)
                        {
                            Activity.RunOnUiThread(() =>
                            {
                                try
                                {
                                    // Friend Requests
                                    if (result.FriendRequests.Count > 0)
                                    {
                                        ListUtils.FriendRequestsList = new ObservableCollection <UserDataObject>(result.FriendRequests);

                                        LayoutFriendRequest.Visibility = ViewStates.Visible;
                                        try
                                        {
                                            for (var i = 0; i < 4; i++)
                                            {
                                                switch (i)
                                                {
                                                case 0:
                                                    GlideImageLoader.LoadImage(Activity, ListUtils.FriendRequestsList[i].Avatar, FriendRequestImage3, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                                                    break;

                                                case 1:
                                                    GlideImageLoader.LoadImage(Activity, ListUtils.FriendRequestsList[i].Avatar, FriendRequestImage2, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                                                    break;

                                                case 2:
                                                    GlideImageLoader.LoadImage(Activity, ListUtils.FriendRequestsList[i].Avatar, FriendRequestImage1, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                                                    break;
                                                }
                                            }
                                        }
                                        catch (Exception e)
                                        {
                                            Console.WriteLine(e);
                                        }
                                    }
                                    else
                                    {
                                        LayoutFriendRequest.Visibility = ViewStates.Gone;
                                    }

                                    // Group Requests
                                    if (result.GroupChatRequests.Count > 0)
                                    {
                                        ListUtils.GroupRequestsList = new ObservableCollection <GroupChatRequest>(result.GroupChatRequests);

                                        if (GlobalContext.LastGroupChatsTab != null)
                                        {
                                            GlobalContext.LastGroupChatsTab.LayoutGroupRequest.Visibility = ViewStates.Visible;
                                            try
                                            {
                                                for (var i = 0; i < 4; i++)
                                                {
                                                    var item  = result.GroupChatRequests[i];
                                                    var image = item.GroupTab.Avatar.Replace(Client.WebsiteUrl, "");
                                                    if (!image.Contains("http"))
                                                    {
                                                        item.GroupTab.Avatar = Client.WebsiteUrl + "/" + image;
                                                    }

                                                    switch (i)
                                                    {
                                                    case 0:
                                                        GlideImageLoader.LoadImage(Activity, item.GroupTab.Avatar, GlobalContext.LastGroupChatsTab.GroupRequestImage3, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                                                        break;

                                                    case 1:
                                                        GlideImageLoader.LoadImage(Activity, item.GroupTab.Avatar, GlobalContext.LastGroupChatsTab.GroupRequestImage2, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                                                        break;

                                                    case 2:
                                                        GlideImageLoader.LoadImage(Activity, item.GroupTab.Avatar, GlobalContext.LastGroupChatsTab.GroupRequestImage1, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                                                        break;
                                                    }
                                                }
                                            }
                                            catch (Exception e)
                                            {
                                                Console.WriteLine(e);
                                            }
                                        }
                                    }
                                    else
                                    {
                                        if (GlobalContext.LastGroupChatsTab != null)
                                        {
                                            GlobalContext.LastGroupChatsTab.LayoutGroupRequest.Visibility = ViewStates.Gone;
                                        }
                                    }
                                }
                                catch (Exception e)
                                {
                                    Console.WriteLine(e);
                                }
                            });
                        }
                    }
                    else
                    {
                        Methods.DisplayReportResult(Activity, respond);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        private void GetDataPost()
        {
            try
            {
                switch (TypePost)
                {
                case "Group":
                {
                    GroupData = JsonConvert.DeserializeObject <GroupClass>(Intent?.GetStringExtra("ShareToGroup") ?? "");
                    if (GroupData != null)
                    {
                        GlideImageLoader.LoadImage(this, GroupData.Avatar, PostSectionImage, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                        TxtUserName.Text = GroupData.GroupName;
                    }

                    break;
                }

                case "Page":
                {
                    PageData = JsonConvert.DeserializeObject <PageClass>(Intent?.GetStringExtra("ShareToPage") ?? "");
                    if (PageData != null)
                    {
                        GlideImageLoader.LoadImage(this, PageData.Avatar, PostSectionImage, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                        TxtUserName.Text = PageData.PageName;
                    }

                    break;
                }

                case "MyTimeline":
                    GlideImageLoader.LoadImage(this, UserDetails.Avatar, PostSectionImage, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                    TxtUserName.Text = UserDetails.FullName;
                    break;
                }

                PostData = JsonConvert.DeserializeObject <PostDataObject>(Intent?.GetStringExtra("PostObject") ?? "");
                if (PostData != null)
                {
                    switch (TypePost)
                    {
                    case "Group" when PostData.GroupRecipient == null:
                    {
                        if (GroupData != null)
                        {
                            PostData.GroupId        = GroupData.GroupId;
                            PostData.GroupRecipient = GroupData;
                        }
                        break;
                    }

                    case "Page" when PostData.Publisher == null:
                    {
                        if (PageData != null)
                        {
                            PostData.PageId    = PageData.PageId;
                            PostData.Publisher = new PublisherPost
                            {
                                Avatar          = PageData.Avatar,
                                About           = PageData.About,
                                Active          = PageData.Active,
                                Address         = PageData.Address,
                                BackgroundImage = PageData.BackgroundImage,
                                Boosted         = Convert.ToInt32(PageData.Boosted),
                                CallActionType  = Convert.ToInt32(PageData.CallActionType),
                                Category        = PageData.Category,
                                Company         = PageData.Company,
                                Cover           = PageData.Cover,
                                Google          = PageData.Google,
                                Instgram        = PageData.Instgram,
                                IsPageOnwer     = PageData.IsPageOnwer,
                                Linkedin        = PageData.Linkedin,
                                Name            = PageData.Name,
                                PageCategory    = Convert.ToInt32(PageData.PageCategory),
                                PageDescription = PageData.PageDescription,
                                PageId          = Convert.ToInt32(PageData.PageId),
                                PageName        = PageData.PageName,
                                PageTitle       = PageData.PageTitle,
                                Phone           = PageData.Phone,
                                Rating          = Convert.ToInt32(PageData.Rating),
                                Registered      = PageData.Registered,
                                Twitter         = PageData.Twitter,
                                Url             = PageData.Url,
                            };
                        }
                        break;
                    }
                    }

                    var combine = new FeedCombiner(PostData, PostFeedAdapter.ListDiffer, this);
                    combine.CombineDefaultPostSections();

                    PostFeedAdapter.NotifyDataSetChanged();
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Beispiel #16
0
        private void LoadPost()
        {
            try
            {
                PostObject = JsonConvert.DeserializeObject <PostDataObject>(Intent.GetStringExtra("PostObject"));
                if (PostObject != null)
                {
                    var readMoreOption = new StReadMoreOption.Builder()
                                         .TextLength(200, StReadMoreOption.TypeCharacter)
                                         .MoreLabel(GetText(Resource.String.Lbl_ReadMore))
                                         .LessLabel(GetText(Resource.String.Lbl_ReadLess))
                                         .MoreLabelColor(Color.ParseColor(AppSettings.MainColor))
                                         .LessLabelColor(Color.ParseColor(AppSettings.MainColor))
                                         .LabelUnderLine(true)
                                         .Build();

                    if (SecondReactionButton != null)
                    {
                        switch (AppSettings.PostButton)
                        {
                        case PostButtonSystem.ReactionDefault:
                        case PostButtonSystem.ReactionSubShine:
                        case PostButtonSystem.Like:
                            MainSectionButton.WeightSum     = 3;
                            SecondReactionButton.Visibility = ViewStates.Gone;
                            break;

                        case PostButtonSystem.Wonder:
                            MainSectionButton.WeightSum     = 4;
                            SecondReactionButton.Visibility = ViewStates.Visible;

                            SecondReactionButton.SetCompoundDrawablesWithIntrinsicBounds(Resource.Drawable.ic_action_wowonder, 0, 0, 0);
                            SecondReactionButton.Text = Application.Context.GetText(Resource.String.Btn_Wonder);
                            break;

                        case PostButtonSystem.DisLike:
                            MainSectionButton.WeightSum     = 4;
                            SecondReactionButton.Visibility = ViewStates.Visible;

                            SecondReactionButton.SetCompoundDrawablesWithIntrinsicBounds(Resource.Drawable.ic_action_dislike, 0, 0, 0);
                            SecondReactionButton.Text = Application.Context.GetText(Resource.String.Btn_Dislike);
                            break;

                        default:
                            MainSectionButton.WeightSum     = 3;
                            SecondReactionButton.Visibility = ViewStates.Gone;
                            break;
                        }
                    }

                    var publisher = PostObject.Publisher ?? PostObject.UserData;
                    if (publisher != null)
                    {
                        if (PostObject.PostPrivacy == "4")
                        {
                            Username.Text = GetText(Resource.String.Lbl_Anonymous);
                            GlideImageLoader.LoadImage(this, "user_anonymous", UserAvatar, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                        }
                        else
                        {
                            GlideImageLoader.LoadImage(this, publisher.Avatar, UserAvatar, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                            var postDataDecoratedContent = new WoTextDecorator().SetupStrings(PostObject, this);
                            Username.SetText(postDataDecoratedContent, TextView.BufferType.Spannable);
                        }

                        if (PostExtrasLayout != null)
                        {
                            PostExtrasLayout.Visibility = PostObject.IsPostBoosted == "0" ? ViewStates.Gone : ViewStates.Visible;
                        }

                        if (string.IsNullOrEmpty(PostObject.Orginaltext))
                        {
                            if (Description.Visibility != ViewStates.Gone)
                            {
                                Description.Visibility = ViewStates.Gone;
                            }
                        }
                        else
                        {
                            if (Description.Visibility != ViewStates.Visible)
                            {
                                Description.Visibility = ViewStates.Visible;
                            }

                            if (!Description.Text.Contains(GetText(Resource.String.Lbl_ReadMore)) && !Description.Text.Contains(GetText(Resource.String.Lbl_ReadLess)))
                            {
                                if (PostObject.RegexFilterList != null & PostObject.RegexFilterList?.Count > 0)
                                {
                                    Description.SetAutoLinkOnClickListener(this, PostObject.RegexFilterList);
                                }
                                else
                                {
                                    Description.SetAutoLinkOnClickListener(this, new Dictionary <string, string>());
                                }

                                readMoreOption.AddReadMoreTo(Description, new String(PostObject.Orginaltext));
                            }
                            else if (Description.Text.Contains(GetText(Resource.String.Lbl_ReadLess)))
                            {
                                readMoreOption.AddReadLess(Description, new String(PostObject.Orginaltext));
                            }
                            else
                            {
                                Description.Text = PostObject.Orginaltext;
                            }
                        }

                        bool success = int.TryParse(PostObject.Time, out var number);
                        TimeText.Text = success ? Methods.Time.TimeAgo(number) : PostObject.Time;

                        if (PrivacyPostIcon != null && !string.IsNullOrEmpty(PostObject.PostPrivacy) && publisher.UserId == UserDetails.UserId)
                        {
                            if (PostObject.PostPrivacy == "0") //Everyone
                            {
                                FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeLight, PrivacyPostIcon, FontAwesomeIcon.Globe);
                            }
                            else if (PostObject.PostPrivacy.Contains("ifollow") || PostObject.PostPrivacy == "2") //People_i_Follow
                            {
                                FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeLight, PrivacyPostIcon, FontAwesomeIcon.User);
                            }
                            else if (PostObject.PostPrivacy.Contains("me") || PostObject.PostPrivacy == "1") //People_Follow_Me
                            {
                                FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeLight, PrivacyPostIcon, FontAwesomeIcon.UserFriends);
                            }
                            else if (PostObject.PostPrivacy == "4") //Anonymous
                            {
                                FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeSolid, PrivacyPostIcon, FontAwesomeIcon.UserSecret);
                            }
                            else //No_body)
                            {
                                FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeLight, PrivacyPostIcon, FontAwesomeIcon.Lock);
                            }

                            PrivacyPostIcon.Visibility = ViewStates.Visible;
                        }

                        if (CommentCount != null)
                        {
                            CommentCount.Text = PostObject.PostComments;
                        }
                    }

                    if (AppSettings.PostButton == PostButtonSystem.ReactionDefault || AppSettings.PostButton == PostButtonSystem.ReactionSubShine)
                    {
                        PostObject.Reaction ??= new WoWonderClient.Classes.Posts.Reaction();

                        if (LikeCount != null)
                        {
                            LikeCount.Text = PostObject?.Reaction?.Count + " " + GetString(Resource.String.Btn_Likes);
                        }

                        if ((bool)(PostObject.Reaction != null & PostObject.Reaction?.IsReacted))
                        {
                            if (!string.IsNullOrEmpty(PostObject.Reaction.Type))
                            {
                                switch (PostObject.Reaction.Type)
                                {
                                case "1":
                                case "Like":
                                    LikeButton.SetReactionPack(ReactConstants.Like);
                                    break;

                                case "2":
                                case "Love":
                                    LikeButton.SetReactionPack(ReactConstants.Love);
                                    break;

                                case "3":
                                case "HaHa":
                                    LikeButton.SetReactionPack(ReactConstants.HaHa);
                                    break;

                                case "4":
                                case "Wow":
                                    LikeButton.SetReactionPack(ReactConstants.Wow);
                                    break;

                                case "5":
                                case "Sad":
                                    LikeButton.SetReactionPack(ReactConstants.Sad);
                                    break;

                                case "6":
                                case "Angry":
                                    LikeButton.SetReactionPack(ReactConstants.Angry);
                                    break;

                                default:
                                    LikeButton.SetReactionPack(ReactConstants.Default);
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        if (PostObject.IsLiked != null && PostObject.IsLiked.Value)
                        {
                            LikeButton.SetReactionPack(ReactConstants.Like);
                        }

                        if (LikeCount != null)
                        {
                            LikeCount.Text = Methods.FunString.FormatPriceValue(int.Parse(PostObject.PostLikes)) + " " + GetString(Resource.String.Btn_Likes);
                        }

                        if (SecondReactionButton != null)
                        {
                            switch (AppSettings.PostButton)
                            {
                            case PostButtonSystem.Wonder when PostObject.IsWondered != null && PostObject.IsWondered.Value:
                            {
                                Drawable unwrappedDrawable = AppCompatResources.GetDrawable(this, Resource.Drawable.ic_action_wowonder);
                                Drawable wrappedDrawable   = DrawableCompat.Wrap(unwrappedDrawable);
                                if (Build.VERSION.SdkInt <= BuildVersionCodes.Lollipop)
                                {
                                    DrawableCompat.SetTint(wrappedDrawable, Color.ParseColor("#f89823"));
                                }
                                else
                                {
                                    wrappedDrawable = wrappedDrawable.Mutate();
                                    wrappedDrawable.SetColorFilter(new PorterDuffColorFilter(Color.ParseColor("#f89823"), PorterDuff.Mode.SrcAtop));
                                }

                                SecondReactionButton.SetCompoundDrawablesWithIntrinsicBounds(wrappedDrawable, null, null, null);

                                SecondReactionButton.Text = GetString(Resource.String.Lbl_wondered);
                                SecondReactionButton.SetTextColor(Color.ParseColor(AppSettings.MainColor));
                                break;
                            }

                            case PostButtonSystem.Wonder:
                            {
                                Drawable unwrappedDrawable = AppCompatResources.GetDrawable(this, Resource.Drawable.ic_action_wowonder);
                                Drawable wrappedDrawable   = DrawableCompat.Wrap(unwrappedDrawable);
                                if (Build.VERSION.SdkInt <= BuildVersionCodes.Lollipop)
                                {
                                    DrawableCompat.SetTint(wrappedDrawable, Color.ParseColor("#666666"));
                                }
                                else
                                {
                                    wrappedDrawable = wrappedDrawable.Mutate();
                                    wrappedDrawable.SetColorFilter(new PorterDuffColorFilter(Color.ParseColor("#666666"), PorterDuff.Mode.SrcAtop));
                                }
                                SecondReactionButton.SetCompoundDrawablesWithIntrinsicBounds(wrappedDrawable, null, null, null);

                                SecondReactionButton.Text = GetString(Resource.String.Btn_Wonder);
                                SecondReactionButton.SetTextColor(Color.ParseColor("#444444"));
                                break;
                            }

                            case PostButtonSystem.DisLike when PostObject.IsWondered != null && PostObject.IsWondered.Value:
                            {
                                Drawable unwrappedDrawable = AppCompatResources.GetDrawable(this, Resource.Drawable.ic_action_dislike);
                                Drawable wrappedDrawable   = DrawableCompat.Wrap(unwrappedDrawable);

                                if (Build.VERSION.SdkInt <= BuildVersionCodes.Lollipop)
                                {
                                    DrawableCompat.SetTint(wrappedDrawable, Color.ParseColor("#f89823"));
                                }
                                else
                                {
                                    wrappedDrawable = wrappedDrawable.Mutate();
                                    wrappedDrawable.SetColorFilter(new PorterDuffColorFilter(Color.ParseColor("#f89823"), PorterDuff.Mode.SrcAtop));
                                }

                                SecondReactionButton.SetCompoundDrawablesWithIntrinsicBounds(wrappedDrawable, null, null, null);

                                SecondReactionButton.Text = GetString(Resource.String.Lbl_disliked);
                                SecondReactionButton.SetTextColor(Color.ParseColor("#f89823"));
                                break;
                            }

                            case PostButtonSystem.DisLike:
                            {
                                Drawable unwrappedDrawable = AppCompatResources.GetDrawable(this, Resource.Drawable.ic_action_dislike);
                                Drawable wrappedDrawable   = DrawableCompat.Wrap(unwrappedDrawable);
                                if (Build.VERSION.SdkInt <= BuildVersionCodes.Lollipop)
                                {
                                    DrawableCompat.SetTint(wrappedDrawable, Color.ParseColor("#666666"));
                                }
                                else
                                {
                                    wrappedDrawable = wrappedDrawable.Mutate();
                                    wrappedDrawable.SetColorFilter(new PorterDuffColorFilter(Color.ParseColor("#666666"), PorterDuff.Mode.SrcAtop));
                                }

                                SecondReactionButton.SetCompoundDrawablesWithIntrinsicBounds(wrappedDrawable, null, null, null);

                                SecondReactionButton.Text = GetString(Resource.String.Btn_Dislike);
                                SecondReactionButton.SetTextColor(Color.ParseColor("#444444"));
                                break;
                            }
                            }
                        }
                    }

                    if (PostObject?.GetPostComments?.Count > 0)
                    {
                        var db = Mapper.Map <List <CommentObjectExtra> >(PostObject.GetPostComments);
                        MAdapter.CommentList = new ObservableCollection <CommentObjectExtra>(db);
                    }
                    else
                    {
                        MAdapter.CommentList = new ObservableCollection <CommentObjectExtra>();
                    }

                    MAdapter.NotifyDataSetChanged();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        private static void LoadCommentData(CommentsMoviesObject item, RecyclerView.ViewHolder viewHolder, int position = 0)
        {
            try
            {
                if (!(viewHolder is MoviesCommentAdapterViewHolder holder))
                {
                    return;
                }

                if (AppSettings.FlowDirectionRightToLeft)
                {
                    holder.BubbleLayout.LayoutDirection = LayoutDirection.Rtl;
                }

                var changer = new TextSanitizer(holder.CommentText, ActivityContext);
                changer.Load(Methods.FunString.DecodeString(item.Text));

                holder.TimeTextView.Text = Methods.Time.TimeAgo(int.Parse(item.Posted));
                holder.UserName.Text     = item.UserData.Name;

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

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

                if (item.UserData.Verified == "1")
                {
                    textHighLighter += " " + IonIconsFonts.CheckmarkCircled;
                }

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

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

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

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

                decorator.Build();

                if (item.Replies?.Count > 0)
                {
                    holder.ReplyTextView.Text = ActivityContext.GetText(Resource.String.Lbl_Reply) + " " + "(" + item.Replies.Count + ")";
                }

                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.ParseColor("#ffffff") : Color.ParseColor("#000000"));
                    holder.LikeTextView.Tag = "Like";
                }

                holder.TimeTextView.Tag = "true";

                if (holder.Image.HasOnClickListeners)
                {
                    return;
                }

                var postEventListener = new MoviesCommentClickListener(ActivityContext, Type);

                //Create an Event
                holder.MainView.LongClick += (sender, e) => postEventListener.MoreCommentReplyPostClick(new CommentReplyMoviesClickEventArgs {
                    CommentObject = item, Position = position, View = holder.MainView
                });

                holder.Image.Click += (sender, args) => postEventListener.ProfileClick(new CommentReplyMoviesClickEventArgs {
                    Holder = holder, CommentObject = item, Position = position, View = holder.MainView
                });

                switch (Type)
                {
                case "Comment":
                    holder.ReplyTextView.Click += (sender, args) => VideoViewerActivity.GetInstance()?.CommentReplyClick(item);
                    break;

                case "Reply":
                    holder.ReplyTextView.Click += (sender, args) => VideoViewerActivity.GetInstance()?.ReplyOnReplyClick(item);
                    break;
                }

                holder.LikeTextView.Click += delegate
                {
                    try
                    {
                        if (!Methods.CheckConnectivity())
                        {
                            Toast.MakeText(ActivityContext, ActivityContext.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                            return;
                        }

                        if (holder.LikeTextView.Tag.ToString() == "Liked")
                        {
                            item.IsCommentLiked = false;

                            holder.LikeTextView.Text = ActivityContext.GetText(Resource.String.Btn_Like);
                            holder.LikeTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#ffffff") : Color.ParseColor("#000000"));
                            holder.LikeTextView.Tag = "Like";

                            //sent api Dislike comment reply_like
                            switch (Type)
                            {
                            case "Comment":
                                PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                                    () => RequestsAsync.Movies.LikeUnLikeCommentAsync(item.MovieId, item.Id, false)
                                });
                                break;

                            case "Reply":
                                PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                                    () => RequestsAsync.Movies.LikeUnLikeCommentAsync(item.MovieId, item.Id, false, "reply_like")
                                });
                                break;
                            }
                        }
                        else
                        {
                            item.IsCommentLiked = true;

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

                            //sent api like comment
                            switch (Type)
                            {
                            case "Comment":
                                PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                                    () => RequestsAsync.Movies.LikeUnLikeCommentAsync(item.MovieId, item.Id, true)
                                });
                                break;

                            case "Reply":
                                PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                                    () => RequestsAsync.Movies.LikeUnLikeCommentAsync(item.MovieId, item.Id, true, "reply_like")
                                });
                                break;
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                    }
                };
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        private void Initialize(LastActivitiesAdapterViewHolder holder, ActivitiesObject.Activity item)
        {
            try
            {
                GlideImageLoader.LoadImage(ActivityContext, item.UserData.Avatar, holder.ActivitiesImage, ImageStyle.RoundedCrop, ImagePlaceholders.Drawable);

                string replace = "";
                if (item.Type == "followed_user")
                {
                    holder.Icon.SetImageResource(Resource.Drawable.ic_add);
                    holder.Icon.SetColorFilter(Color.ParseColor("#333333"), PorterDuff.Mode.Multiply);

                    if (item.Text.Contains("started following"))
                    {
                        if (UserDetails.LangName.Contains("fr"))
                        {
                            var split = item.Text.Split("started following").Last().Replace("post", "");
                            replace = item.UserData.Name + " " + ActivityContext.GetString(Resource.String.Lbl_StartedFollowing) + " " + split;
                        }
                        else
                        {
                            replace = item.Text.Replace("started following", ActivityContext.GetString(Resource.String.Lbl_StartedFollowing));
                        }
                    }
                    else if (item.Text.Contains("is following"))
                    {
                        if (UserDetails.LangName.Contains("fr"))
                        {
                            var split = item.Text.Split("is following").Last().Replace("post", "");
                            replace = item.UserData.Name + " " + ActivityContext.GetString(Resource.String.Lbl_IsFollowing) + " " + split;
                        }
                        else
                        {
                            replace = item.Text.Replace("is following", ActivityContext.GetString(Resource.String.Lbl_IsFollowing));
                        }
                    }
                }
                else if (item.Type == "liked__post")
                {
                    holder.Icon.SetImageResource(Resource.Drawable.ic_action_like_2);

                    if (UserDetails.LangName.Contains("fr"))
                    {
                        var split = item.Text.Split("liked").Last().Replace("post", "");
                        replace = item.UserData.Name + " " + ActivityContext.GetString(Resource.String.Lbl_Liked) + " " + ActivityContext.GetString(Resource.String.Lbl_Post) + " " + split;
                    }
                    else
                    {
                        replace = item.Text.Replace("liked", ActivityContext.GetString(Resource.String.Lbl_Liked)).Replace("post", ActivityContext.GetString(Resource.String.Lbl_Post));
                    }
                }
                else if (item.Type == "commented_on_post")
                {
                    holder.Icon.SetImageResource(Resource.Drawable.ic_action_comment);
                    holder.Icon.SetColorFilter(Color.ParseColor("#333333"), PorterDuff.Mode.Multiply);

                    if (UserDetails.LangName.Contains("fr"))
                    {
                        var split = item.Text.Split("commented on").Last().Replace("post", "");
                        replace = item.UserData.Name + " " + ActivityContext.GetString(Resource.String.Lbl_CommentedOn) + " " + ActivityContext.GetString(Resource.String.Lbl_Post) + " " + split;
                    }
                    else
                    {
                        replace = item.Text.Replace("commented on", ActivityContext.GetString(Resource.String.Lbl_CommentedOn)).Replace("post", ActivityContext.GetString(Resource.String.Lbl_Post));
                    }
                }

                holder.ActivitiesEvent.Text = !string.IsNullOrEmpty(replace) ? replace : item.Text;

                // holder.Username.Text = item.UserData.Name;
                holder.Username.Visibility = ViewStates.Gone;

                holder.Time.Text = Methods.Time.TimeAgo(int.Parse(item.Time));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Beispiel #19
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)
                    {
                        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 Button if its applied
                    if (DataInfoObject.Apply == "true")
                    {
                        JobButton.Text    = GetString(Resource.String.Lbl_already_applied);
                        JobButton.Enabled = false;
                    }

                    //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.AndroidPin + " " + DataInfoObject.Location + "  " + " ";
                    jobInfo += IonIconsFonts.AndroidTime + " " + Methods.Time.TimeAgo(int.Parse(DataInfoObject.Time)) + " " + " ";

                    //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.AndroidPin, "#ff5722");
                    woTextDecorator.SetTextColor(IonIconsFonts.AndroidTime, "#4caf50");
                    woTextDecorator.SetTextColor(IonIconsFonts.IosBriefcase, "#2196f3");
                    woTextDecorator.SetTextColor(IonIconsFonts.Pricetag, "#795548");
                    woTextDecorator.Build(JobInfo, woTextDecorator.DecoratedContent);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Beispiel #20
0
        private void Initialize(Holders.LastMessagesViewHolder holder, GetUsersListObject.User item)
        {
            try
            {
                var image = !string.IsNullOrEmpty(item.OldAvatar) ? item.OldAvatar : item.Avatar ?? "";
                if (!string.IsNullOrEmpty(image))
                {
                    var avatarSplit    = image.Split('/').Last();
                    var getImageAvatar = Methods.MultiMedia.GetMediaFrom_Disk(Methods.Path.FolderDiskImage, avatarSplit);
                    if (getImageAvatar != "File Dont Exists")
                    {
                        var file = Uri.FromFile(new File(getImageAvatar));
                        Glide.With(ActivityContext).Load(file.Path).Apply(Options).Into(holder.ImageAvatar);
                    }
                    else
                    {
                        Methods.MultiMedia.DownloadMediaTo_DiskAsync(Methods.Path.FolderDiskImage, image);
                        GlideImageLoader.LoadImage(ActivityContext, image, holder.ImageAvatar, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                    }
                }

                holder.TxtUsername.Text = WoWonderTools.GetNameFinal(item);

                holder.TxtUsername.SetCompoundDrawablesWithIntrinsicBounds(0, 0, item.Verified == "1" ? Resource.Drawable.icon_checkmark_small_vector : 0, 0);

                if (item.LastMessage.Stickers != null)
                {
                    item.LastMessage.Stickers = item.LastMessage.Stickers.Replace(".mp4", ".gif");
                }

                //If message contains Media files
                if (!string.IsNullOrEmpty(item.LastMessage.Media) && item.LastMessage.Media.Contains("image"))
                {
                    holder.LastMessagesIcon.Visibility = ViewStates.Visible;
                    Glide.With(ActivityContext).Load(Resource.Drawable.ic_image_vector).Into(holder.LastMessagesIcon);
                    holder.TxtLastMessages.Text = ActivityContext.GetText(Resource.String.Lbl_SendImageFile);
                }
                else if (!string.IsNullOrEmpty(item.LastMessage.Media) && item.LastMessage.Media.Contains("video"))
                {
                    holder.LastMessagesIcon.Visibility = ViewStates.Visible;
                    Glide.With(ActivityContext).Load(Resource.Drawable.ic_video_player_vector).Into(holder.LastMessagesIcon);
                    holder.TxtLastMessages.Text = ActivityContext.GetText(Resource.String.Lbl_SendVideoFile);
                }
                else if (!string.IsNullOrEmpty(item.LastMessage.Media) && item.LastMessage.Media.Contains("sticker"))
                {
                    holder.LastMessagesIcon.Visibility = ViewStates.Visible;
                    Glide.With(ActivityContext).Load(Resource.Drawable.ic_sticker_vector).Into(holder.LastMessagesIcon);
                    holder.TxtLastMessages.Text = ActivityContext.GetText(Resource.String.Lbl_SendStickerFile);
                }
                else if (!string.IsNullOrEmpty(item.LastMessage.Media) && item.LastMessage.Media.Contains("sounds"))
                {
                    holder.LastMessagesIcon.Visibility = ViewStates.Visible;
                    Glide.With(ActivityContext).Load(Resource.Drawable.ic_radios_vector).Into(holder.LastMessagesIcon);
                    holder.TxtLastMessages.Text = ActivityContext.GetText(Resource.String.Lbl_SendAudioFile);
                }
                else if (!string.IsNullOrEmpty(item.LastMessage.Media) && item.LastMessage.Media.Contains("file"))
                {
                    holder.LastMessagesIcon.Visibility = ViewStates.Visible;
                    Glide.With(ActivityContext).Load(Resource.Drawable.ic_document_vector).Into(holder.LastMessagesIcon);
                    holder.TxtLastMessages.Text = ActivityContext.GetText(Resource.String.Lbl_SendFile);
                }
                else if (!string.IsNullOrEmpty(item.LastMessage.Stickers) && item.LastMessage.Stickers.Contains(".gif"))
                {
                    holder.LastMessagesIcon.Visibility = ViewStates.Visible;
                    Glide.With(ActivityContext).Load(Resource.Drawable.ic_gif_vector).Into(holder.LastMessagesIcon);
                    holder.TxtLastMessages.Text = ActivityContext.GetText(Resource.String.Lbl_SendGifFile);
                }
                else if (!string.IsNullOrEmpty(item.LastMessage.ProductId) && item.LastMessage.ProductId != "0")
                {
                    holder.TxtLastMessages.Text = ActivityContext.GetText(Resource.String.Lbl_SendProductFile);
                }
                else if (!string.IsNullOrEmpty(item.LastMessage.Lat) && !string.IsNullOrEmpty(item.LastMessage.Lng) && item.LastMessage.Lat != "0" && item.LastMessage.Lng != "0")
                {
                    holder.LastMessagesIcon.Visibility = ViewStates.Visible;
                    Glide.With(ActivityContext).Load(Resource.Drawable.icon_search_location_vector).Into(holder.LastMessagesIcon);
                    holder.TxtLastMessages.Text = ActivityContext.GetText(Resource.String.Lbl_SendLocationFile);
                }
                else
                {
                    holder.LastMessagesIcon.Visibility = ViewStates.Gone;
                    //if (!string.IsNullOrEmpty(LastMessage.Text) && LastMessage.Text.Contains("http"))
                    //{
                    //    holder.TxtLastMessages.Text = Methods.FunString.SubStringCutOf(LastMessage.Text, 30);
                    //}
                    //else
                    if (!string.IsNullOrEmpty(item.LastMessage.Text) && (item.LastMessage.Text.Contains("{&quot;Key&quot;") || item.LastMessage.Text.Contains("{key:^qu") || item.LastMessage.Text.Contains("{^key:^qu") || item.LastMessage.Text.Contains("{key:")))
                    {
                        holder.TxtLastMessages.Text = ActivityContext.GetText(Resource.String.Lbl_SendContactnumber);
                    }
                    else if (!string.IsNullOrEmpty(item.LastMessage.Text))
                    {
                        holder.TxtLastMessages.Text = Methods.FunString.DecodeString(Methods.FunString.SubStringCutOf(item.LastMessage.Text, 30));
                    }
                }

                //last seen time
                holder.TxtTimestamp.Text = Methods.Time.TimeAgo(int.Parse(item.LastseenUnixTime), true);

                //Online Or offline
                if (item.Lastseen == "on" && OnlineUsers.Equals(true))
                {
                    holder.TxtTimestamp.Text = ActivityContext.GetText(Resource.String.Lbl_Online);
                    holder.ImageLastseen.SetImageResource(Resource.Drawable.Green_Color);


                    if (AppSettings.ShowOnlineOfflineMessage)
                    {
                        var data = ListOnline.Contains(item.Name);
                        if (data == false)
                        {
                            ListOnline.Add(item.Name);

                            Toast toast = Toast.MakeText(ActivityContext, item.Name + " " + ActivityContext.GetText(Resource.String.Lbl_Online), ToastLength.Short);
                            toast.SetGravity(GravityFlags.Center, 0, 0);
                            toast.Show();
                        }
                    }
                }
                else
                {
                    holder.ImageLastseen.SetImageResource(Resource.Drawable.Grey_Offline);
                }

                //Check read message
                if (item.LastMessage.FromId != null && (item.LastMessage.ToId != null && (item.LastMessage.ToId != UserDetails.UserId && item.LastMessage.FromId == UserDetails.UserId)))
                {
                    if (item.LastMessage.Seen == "0")
                    {
                        holder.IconCheckCountMessages.Visibility = ViewStates.Invisible;
                        holder.TxtUsername.SetTypeface(Typeface.Default, TypefaceStyle.Normal);
                        holder.TxtLastMessages.SetTypeface(Typeface.Default, TypefaceStyle.Normal);
                    }
                    else
                    {
                        holder.IconCheckCountMessages.Visibility = ViewStates.Visible;
                        holder.TxtUsername.SetTypeface(Typeface.Default, TypefaceStyle.Normal);
                        holder.TxtLastMessages.SetTypeface(Typeface.Default, TypefaceStyle.Normal);
                        Glide.With(ActivityContext).Load(Resource.Drawable.ic_tick_vector).Into(holder.IconCheckCountMessages);
                    }
                }
                else if (item.LastMessage.FromId != null && (item.LastMessage.ToId != null && (item.LastMessage.ToId == UserDetails.UserId && item.LastMessage.FromId != UserDetails.UserId)))
                {
                    if (item.LastMessage.Seen == "0")
                    {
                        holder.TxtUsername.SetTypeface(Typeface.Default, TypefaceStyle.Bold);
                        holder.TxtLastMessages.SetTypeface(Typeface.Default, TypefaceStyle.Bold);

                        //var drawable = new TextDrawable.Builder().BeginConfig().FontSize(25).EndConfig().BuildRound("N", Color.ParseColor(AppSettings.MainColor));
                        //holder.IconCheckCountMessages.SetImageDrawable(drawable);
                        holder.IconCheckCountMessages.Visibility = ViewStates.Invisible;
                    }
                    else
                    {
                        holder.IconCheckCountMessages.Visibility = ViewStates.Invisible;
                        holder.TxtUsername.SetTypeface(Typeface.Default, TypefaceStyle.Normal);
                        holder.TxtLastMessages.SetTypeface(Typeface.Default, TypefaceStyle.Normal);
                    }
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Beispiel #21
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 PlayListsAdapterViewHolder holder)
                {
                    if (AppSettings.FlowDirectionRightToLeft)
                    {
                        holder.RelativeLayoutMain.LayoutDirection = LayoutDirection.Rtl;
                        holder.TxtPlayListName.TextDirection      = TextDirection.Rtl;
                    }

                    var item = PlayListsList[position];
                    if (item != null)
                    {
                        GlideImageLoader.LoadImage(ActivityContext, item.Thumbnail, holder.VideoImage, ImageStyle.CenterCrop, ImagePlaceholders.Drawable);

                        holder.TxtIcon.Visibility = ViewStates.Visible;
                        FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.TxtIcon, IonIconsFonts.IosFilm);

                        holder.TxtNumber.Text              = item.Count.ToString();
                        holder.TxtPlayListName.Text        = Methods.FunString.DecodeString(item.Name);
                        holder.TxtPlayListDescription.Text = Methods.FunString.DecodeString(item.Description);
                        holder.TxtViewsCount.Text          = item.Count + " " + ActivityContext.GetText(Resource.String.Lbl_Videos);

                        if (!holder.MenueView.HasOnClickListeners)
                        {
                            holder.MenueView.Click += (sender, args) =>
                            {
                                ContextThemeWrapper ctw   = new ContextThemeWrapper(ActivityContext, Resource.Style.PopupMenuStyle);
                                PopupMenu           popup = new PopupMenu(ctw, holder.MenueView);
                                popup.MenuInflater.Inflate(Resource.Menu.Playlist_menu, popup.Menu);
                                popup.Show();
                                popup.MenuItemClick += (o, eventArgs) =>
                                {
                                    try
                                    {
                                        var id = eventArgs.Item.ItemId;
                                        switch (id)
                                        {
                                        case Resource.Id.menu_EditPlaylist:
                                            LibrarySynchronizer.EditPlaylist(item);
                                            break;

                                        case Resource.Id.menu_Remove:
                                            OnMenuRemove_Click(item);
                                            break;
                                        }
                                    }
                                    catch (Exception exception)
                                    {
                                        Console.WriteLine(exception);
                                        ;
                                    }
                                };
                            }
                        }
                        ;
                    }
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        private void GetDataArticles()
        {
            try
            {
                ArticleData = JsonConvert.DeserializeObject <ArticleDataObject>(Intent?.GetStringExtra("ArticleObject") ?? "");
                if (ArticleData != null)
                {
                    GlideImageLoader.LoadImage(this, ArticleData.Author.Avatar, ImageUser, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                    GlideImageLoader.LoadImage(this, ArticleData.Thumbnail, ImageBlog, ImageStyle.CenterCrop, ImagePlaceholders.Drawable);

                    TxtUsername.Text = WoWonderTools.GetNameFinal(ArticleData.Author);

                    TxtTitle.Text = Methods.FunString.DecodeString(ArticleData.Title);
                    TxtViews.Text = ArticleData.View + " " + GetText(Resource.String.Lbl_Views);

                    string style = AppSettings.SetTabDarkTheme ? "<style type='text/css'>body{color: #fff; background-color: #282828;}</style>" : "<style type='text/css'>body{color: #444; background-color: #FFFEFE;}</style>";
                    string imageFullWidthStyle = "<style>img{display: inline;height: auto;max-width: 100%;}</style>";

                    // This method is deprecated but need to use for old os devices
#pragma warning disable CS0618 // Type or member is obsolete
                    string content = Build.VERSION.SdkInt >= BuildVersionCodes.N ? Html.FromHtml(ArticleData.Content, FromHtmlOptions.ModeCompact)?.ToString() : Html.FromHtml(ArticleData.Content)?.ToString();
#pragma warning restore CS0618 // Type or member is obsolete

                    DataWebHtml  = "<!DOCTYPE html>";
                    DataWebHtml += "<head><title></title>" + style + imageFullWidthStyle + "</head>";
                    DataWebHtml += "<body>" + content + "</body>";
                    DataWebHtml += "</html>";
                    // <meta name='viewport' content='width=device-width, user-scalable=no' />
                    TxtHtml.SetWebViewClient(new MyWebViewClient(this));
                    TxtHtml.Settings.LoadsImagesAutomatically = true;
                    TxtHtml.Settings.JavaScriptEnabled        = true;
                    TxtHtml.Settings.JavaScriptCanOpenWindowsAutomatically = true;
                    TxtHtml.Settings.SetLayoutAlgorithm(WebSettings.LayoutAlgorithm.TextAutosizing);
                    TxtHtml.Settings.DomStorageEnabled       = true;
                    TxtHtml.Settings.AllowFileAccess         = true;
                    TxtHtml.Settings.DefaultTextEncodingName = "utf-8";

                    TxtHtml.Settings.UseWideViewPort      = true;
                    TxtHtml.Settings.LoadWithOverviewMode = true;

                    TxtHtml.Settings.SetSupportZoom(false);
                    TxtHtml.Settings.BuiltInZoomControls = false;
                    TxtHtml.Settings.DisplayZoomControls = false;

                    //int fontSize = (int)TypedValue.ApplyDimension(ComplexUnitType.Sp, 18, Resources?.DisplayMetrics);
                    //TxtHtml.Settings.DefaultFontSize = fontSize;

                    TxtHtml.LoadDataWithBaseURL(null, DataWebHtml, "text/html", "UTF-8", null);

                    bool success = int.TryParse(ArticleData.Posted, out var number);
                    TxtTime.Text = success switch
                    {
                        true => Methods.Time.TimeAgo(number, false),
                        _ => ArticleData.Posted
                    };

                    if (Methods.CheckConnectivity())
                    {
                        PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                            () => RequestsAsync.Article.GetBlogByIdAsync(ArticlesId)
                        });
                    }

                    StartApiService();
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
        //Get General Data Using Api >> notifications , pro_users , promoted_pages , trending_hashTag
        public async Task <(string, string, string, string)> LoadGeneralData(bool seenNotifications, string offset = "")
        {
            try
            {
                if (MainScrollEvent.IsLoading)
                {
                    return("", "", "", "");
                }

                if (Methods.CheckConnectivity())
                {
                    MainScrollEvent.IsLoading = true;

                    var countNotificationsList = MAdapter.NotificationsList?.Count ?? 0;
                    var countPromotedPagesList = GlobalContext.ProPagesAdapter?.MProPagesList.Count ?? 0;

                    (int apiStatus, var respond) = await RequestsAsync.Global.Get_General_Data(seenNotifications, TabbedMainActivity.OnlineUsers, UserDetails.DeviceId, offset);

                    if (apiStatus == 200)
                    {
                        if (respond is GetGeneralDataObject result)
                        {
                            Activity.RunOnUiThread(() =>
                            {
                                try
                                {
                                    // Notifications
                                    var respondList = result.Notifications.Count;
                                    if (respondList > 0)
                                    {
                                        if (countNotificationsList > 0)
                                        {
                                            var listNew = result.Notifications?.Where(c => !MAdapter.NotificationsList.Select(fc => fc.Id).Contains(c.Id)).ToList();
                                            if (listNew.Count > 0)
                                            {
                                                foreach (var notification in listNew)
                                                {
                                                    MAdapter.NotificationsList.Insert(0, notification);
                                                }

                                                MAdapter.NotifyItemRangeInserted(countNotificationsList - 1, MAdapter.NotificationsList.Count - countNotificationsList);
                                            }
                                        }
                                        else
                                        {
                                            MAdapter.NotificationsList = new ObservableCollection <NotificationObject>(result.Notifications);
                                            MAdapter.NotifyDataSetChanged();
                                        }
                                    }
                                    else
                                    {
                                        if (MAdapter.NotificationsList.Count > 10 && !MRecycler.CanScrollVertically(1))
                                        {
                                            Toast.MakeText(Context, Context.GetText(Resource.String.Lbl_NoMoreNotifications), ToastLength.Short)?.Show();
                                        }
                                    }

                                    if (AppSettings.ShowTrendingPage && GlobalContext.TrendingTab != null)
                                    {
                                        // Friend Requests
                                        if (result.FriendRequests.Count > 0)
                                        {
                                            GlobalContext.FriendRequestsList = new ObservableCollection <UserDataObject>(result.FriendRequests);

                                            GlobalContext.TrendingTab.LayoutFriendRequest.Visibility = ViewStates.Visible;
                                            try
                                            {
                                                for (var i = 0; i < 4; i++)
                                                {
                                                    switch (i)
                                                    {
                                                    case 0:
                                                        if (GlobalContext.FriendRequestsList.Count > 0)
                                                        {
                                                            GlideImageLoader.LoadImage(Activity, GlobalContext.FriendRequestsList[i]?.Avatar, GlobalContext.TrendingTab.FriendRequestImage3, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                                                        }
                                                        break;

                                                    case 1:
                                                        if (GlobalContext.FriendRequestsList.Count > 1)
                                                        {
                                                            GlideImageLoader.LoadImage(Activity, GlobalContext.FriendRequestsList[i]?.Avatar, GlobalContext.TrendingTab.FriendRequestImage2, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                                                        }
                                                        break;

                                                    case 2:
                                                        if (GlobalContext.FriendRequestsList.Count > 2)
                                                        {
                                                            GlideImageLoader.LoadImage(Activity, GlobalContext.FriendRequestsList[i]?.Avatar, GlobalContext.TrendingTab.FriendRequestImage1, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                                                        }
                                                        break;
                                                    }
                                                }

                                                if (!string.IsNullOrEmpty(result.NewFriendRequestsCount) && result.NewFriendRequestsCount != "0")
                                                {
                                                    var drawable = TextDrawable.InvokeBuilder().BeginConfig().FontSize(25).EndConfig().BuildRound(result.NewFriendRequestsCount, Color.ParseColor(AppSettings.MainColor));
                                                    GlobalContext.TrendingTab.FriendRequestCount.SetImageDrawable(drawable);
                                                    GlobalContext.TrendingTab.FriendRequestCount.Visibility = ViewStates.Visible;
                                                }
                                                else
                                                {
                                                    GlobalContext.TrendingTab.FriendRequestCount.Visibility = ViewStates.Gone;
                                                }
                                            }
                                            catch (Exception e)
                                            {
                                                Methods.DisplayReportResultTrack(e);
                                            }
                                        }
                                        else if (GlobalContext.TrendingTab != null)
                                        {
                                            GlobalContext.TrendingTab.LayoutFriendRequest.Visibility = ViewStates.Gone;
                                        }

                                        if (GlobalContext.TrendingTab != null && AppSettings.ShowProUsersMembers)
                                        {
                                            var isPro = ListUtils.MyProfileList?.FirstOrDefault()?.IsPro ?? "0";
                                            if (isPro == "0" && ListUtils.SettingsSiteList?.Pro == "1" && AppSettings.ShowGoPro)
                                            {
                                                var dataOwner = GlobalContext.ProUsersAdapter.MProUsersList.FirstOrDefault(a => a.Type == "Your");
                                                if (dataOwner == null)
                                                {
                                                    GlobalContext.ProUsersAdapter.MProUsersList.Insert(0, new UserDataObject
                                                    {
                                                        Avatar   = UserDetails.Avatar,
                                                        Type     = "Your",
                                                        Username = Context.GetText(Resource.String.Lbl_AddMe),
                                                    });

                                                    GlobalContext.ProUsersAdapter.NotifyDataSetChanged();

                                                    if (GlobalContext.TrendingTab.LayoutSuggestionProUsers.Visibility != ViewStates.Visible)
                                                    {
                                                        GlobalContext.TrendingTab.LayoutSuggestionProUsers.Visibility = ViewStates.Visible;
                                                    }
                                                }
                                            }

                                            // Pro Users
                                            var countProUsersList   = GlobalContext.ProUsersAdapter.MProUsersList.Count;
                                            var respondListProUsers = result.ProUsers.Count;
                                            if (respondListProUsers > 0)
                                            {
                                                foreach (var item in from item in result.ProUsers let check = GlobalContext.ProUsersAdapter.MProUsersList.FirstOrDefault(a => a.UserId == item.UserId) where check == null select item)
                                                {
                                                    GlobalContext.ProUsersAdapter.MProUsersList.Add(item);
                                                }

                                                if (countProUsersList > 0)
                                                {
                                                    GlobalContext.ProUsersAdapter.NotifyItemRangeInserted(countProUsersList - 1, GlobalContext.ProUsersAdapter.MProUsersList.Count - countProUsersList);
                                                }
                                                else
                                                {
                                                    GlobalContext.ProUsersAdapter.NotifyDataSetChanged();
                                                }

                                                //Scroll Down >>
                                                GlobalContext.TrendingTab.ProUserRecyclerView.ScrollToPosition(0);

                                                if (GlobalContext.ProUsersAdapter.MProUsersList.Count > 0 && GlobalContext.TrendingTab.LayoutSuggestionProUsers.Visibility != ViewStates.Visible)
                                                {
                                                    GlobalContext.TrendingTab.LayoutSuggestionProUsers.Visibility = ViewStates.Visible;
                                                }
                                            }
                                            else
                                            {
                                                if (GlobalContext.ProUsersAdapter.MProUsersList.Count == 0 && GlobalContext.TrendingTab.LayoutSuggestionProUsers.Visibility != ViewStates.Gone)
                                                {
                                                    GlobalContext.TrendingTab.LayoutSuggestionProUsers.Visibility = ViewStates.Gone;
                                                }
                                            }
                                        }
                                        else
                                        {
                                            if (GlobalContext.TrendingTab != null && GlobalContext.ProUsersAdapter.MProUsersList.Count == 0 && GlobalContext.TrendingTab.LayoutSuggestionProUsers.Visibility != ViewStates.Gone)
                                            {
                                                GlobalContext.TrendingTab.LayoutSuggestionProUsers.Visibility = ViewStates.Gone;
                                            }
                                        }

                                        if (GlobalContext.TrendingTab != null && AppSettings.ShowPromotedPages)
                                        {
                                            // Pro Pages
                                            var respondListPromotedPages = result.PromotedPages.Count;
                                            if (respondListPromotedPages > 0)
                                            {
                                                if (countPromotedPagesList > 0)
                                                {
                                                    foreach (var item in from item in result.PromotedPages let check = GlobalContext.ProPagesAdapter.MProPagesList.FirstOrDefault(a => a.PageId == item.PageId) where check == null select item)
                                                    {
                                                        GlobalContext.ProPagesAdapter.MProPagesList.Add(item);
                                                    }

                                                    GlobalContext.ProPagesAdapter.NotifyItemRangeInserted(countPromotedPagesList - 1, GlobalContext.ProPagesAdapter.MProPagesList.Count - countPromotedPagesList);
                                                }
                                                else
                                                {
                                                    GlobalContext.ProPagesAdapter.MProPagesList = new ObservableCollection <PageClass>(result.PromotedPages);
                                                    GlobalContext.ProPagesAdapter.NotifyDataSetChanged();
                                                }

                                                GlobalContext.TrendingTab.LayoutSuggestionPromotedPage.Visibility = ViewStates.Visible;
                                            }
                                            else
                                            {
                                                GlobalContext.TrendingTab.LayoutSuggestionPromotedPage.Visibility = ViewStates.Gone;
                                            }
                                        }
                                        else
                                        {
                                            GlobalContext.TrendingTab.LayoutSuggestionPromotedPage.Visibility = ViewStates.Gone;
                                        }
                                    }

                                    if (AppSettings.ShowTrendingHashTags)
                                    {
                                        if (result.TrendingHashtag.Count > 0)
                                        {
                                            GlobalContext.HashTagUserAdapter.MHashtagList = new ObservableCollection <TrendingHashtag>(result.TrendingHashtag);
                                        }
                                    }

                                    MainScrollEvent.IsLoading = false;
                                    ShowEmptyPage();
                                }
                                catch (Exception e)
                                {
                                    Methods.DisplayReportResultTrack(e);
                                }
                            });
                            return(result.NewNotificationsCount, result.NewFriendRequestsCount, result.CountNewMessages, result.Announcement?.AnnouncementClass?.TextDecode);
                        }
                    }
                    else
                    {
                        Methods.DisplayReportResult(Activity, respond);
                    }

                    Activity.RunOnUiThread(ShowEmptyPage);
                    MainScrollEvent.IsLoading = false;

                    return("", "", "", "");
                }
                else
                {
                    Inflated = EmptyStateLayout.Inflate();
                    EmptyStateInflater x = new EmptyStateInflater();
                    x.InflateLayout(Inflated, EmptyStateInflater.Type.NoConnection);
                    if (!x.EmptyStateButton.HasOnClickListeners)
                    {
                        x.EmptyStateButton.Click += null !;
                        x.EmptyStateButton.Click += EmptyStateButtonOnClick;
                    }

                    Toast.MakeText(Context, Context.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show();
                }
            }
            catch (Exception e)
            {
                MainScrollEvent.IsLoading = false;
                Methods.DisplayReportResultTrack(e);
            }
            MainScrollEvent.IsLoading = false;
            return("", "", "", "");
        }
        private void LoadPassedData(GroupClass result)
        {
            try
            {
                GlideImageLoader.LoadImage(this, result.Avatar, UserProfileImage, ImageStyle.CenterCrop, ImagePlaceholders.Color);
                Glide.With(this).Load(result.Cover.Replace(" ", "")).Apply(new RequestOptions().Placeholder(Resource.Drawable.Cover_image).Error(Resource.Drawable.Cover_image)).Into(CoverImage);

                TxtGroupUsername.Text = "@" + result.Username;
                TxtGroupName.Text     = Methods.FunString.DecodeString(result.Name);
                CategoryText.Text     = Methods.FunString.DecodeString(result.Category);

                if (result.UserId == UserDetails.UserId)
                {
                    result.IsOwner = true;
                }

                if (result.IsOwner)
                {
                    BtnJoin.BackgroundTintList = ColorStateList.ValueOf(Color.ParseColor(AppSettings.MainColor));
                    BtnJoin.Text = GetText(Resource.String.Lbl_Edit);
                    BtnJoin.SetTextColor(Color.White);
                    BtnJoin.Tag = "MyGroup";
                    BtnMore.BackgroundTintList = ColorStateList.ValueOf(Color.ParseColor(AppSettings.MainColor));
                    BtnMore.ImageTintList      = ColorStateList.ValueOf(Color.White);
                }
                else
                {
                    BtnJoin.BackgroundTintList = result.IsJoined == "yes" || result.IsJoined == "true" ? ColorStateList.ValueOf(Color.ParseColor("#efefef")) : ColorStateList.ValueOf(Color.ParseColor(AppSettings.MainColor));
                    BtnJoin.Text = GetText(result.IsJoined == "yes" || result.IsJoined == "true" ? Resource.String.Btn_Joined : Resource.String.Btn_Join_Group);
                    BtnJoin.SetTextColor(result.IsJoined == "yes" || result.IsJoined == "true" ? Color.Black : Color.White);
                    BtnMore.BackgroundTintList = result.IsJoined == "yes" || result.IsJoined == "true" ? ColorStateList.ValueOf(Color.ParseColor("#efefef")) : ColorStateList.ValueOf(Color.ParseColor(AppSettings.MainColor));
                    BtnMore.ImageTintList      = result.IsJoined == "yes" || result.IsJoined == "true" ? ColorStateList.ValueOf(Color.Black) : ColorStateList.ValueOf(Color.White);
                    BtnJoin.Tag = "UserGroup";
                }

                if (result.IsOwner || result.IsJoined == "yes" || result.IsJoined == "true")
                {
                    var checkSection = PostFeedAdapter.ListDiffer.FirstOrDefault(a => a.TypeView == PostModelType.AddPostBox);
                    if (checkSection == null)
                    {
                        Combiner.AddPostDivider();

                        Combiner.AddPostBoxPostView("Group", -1, new PostDataObject()
                        {
                            GroupRecipient = result
                        });

                        if (AppSettings.ShowSearchForPosts)
                        {
                            Combiner.SearchForPostsView("Group", new PostDataObject()
                            {
                                GroupRecipient = result
                            });
                        }

                        PostFeedAdapter.NotifyItemInserted(PostFeedAdapter.ListDiffer.Count - 1);
                    }
                }

                PrivacyText.Text = GetText(result.Privacy == "1" ? Resource.String.Radio_Public : Resource.String.Radio_Private);

                if (result.Privacy != "1")
                {
                    IconPrivacy.SetImageResource(Resource.Drawable.ic_private);
                }

                if (result.IsOwner)
                {
                    EditAvatarImageGroup.Visibility = ViewStates.Visible;
                    TxtEditGroupInfo.Visibility     = ViewStates.Visible;
                }
                else
                {
                    EditAvatarImageGroup.Visibility = ViewStates.Gone;
                    TxtEditGroupInfo.Visibility     = ViewStates.Gone;
                }

                if (result.Privacy == "1" || result.IsOwner)
                {
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        () => MainRecyclerView.FetchNewsFeedApiPosts()
                    });
                }
                else
                {
                    if (PostFeedAdapter.ListDiffer.FirstOrDefault(a => a.IsDefaultFeedPost) != null)
                    {
                        var emptyStateChecker = PostFeedAdapter.ListDiffer.FirstOrDefault(a => a.TypeView == PostModelType.EmptyState);
                        if (emptyStateChecker != null && PostFeedAdapter.ListDiffer.Count > 1)
                        {
                            PostFeedAdapter.ListDiffer.Remove(emptyStateChecker);
                        }
                    }
                    else
                    {
                        var emptyStateChecker = PostFeedAdapter.ListDiffer.FirstOrDefault(a => a.TypeView == PostModelType.EmptyState);
                        if (emptyStateChecker == null)
                        {
                            PostFeedAdapter.ListDiffer.Add(new AdapterModelsClass {
                                TypeView = PostModelType.EmptyState, Id = 744747447
                            });
                        }
                    }
                    PostFeedAdapter.NotifyDataSetChanged();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        private async void LoadProfile()
        {
            try
            {
                if (ListUtils.MyProfileList.Count == 0)
                {
                    await ApiRequest.GetProfile_Api(Activity);
                }

                var data = ListUtils.MyProfileList.FirstOrDefault();
                if (data != null)
                {
                    GlideImageLoader.LoadImage(Activity, data.Avatar, ImageUser, ImageStyle.CircleCrop, ImagePlaceholders.Color);

                    //TxtFullName.Text = AppTools.GetNameFinal(data);
                    CollapsingToolbar.Title = AppTools.GetNameFinal(data);
                    TxtUserName.Text        = "@" + data.Username;

                    TxtPostCount.Text = Methods.FunString.FormatPriceValue(Int32.Parse(data.Favourites));

                    if (data.Followers != null && int.TryParse(data.Followers, out var numberFollowers))
                    {
                        TxtFollowersCount.Text = Methods.FunString.FormatPriceValue(numberFollowers);
                    }

                    if (data.Following != null && int.TryParse(data.Following, out var numberFollowing))
                    {
                        TxtFollowingCount.Text = Methods.FunString.FormatPriceValue(numberFollowing);
                    }

                    var font = Typeface.CreateFromAsset(Application.Context.Resources.Assets, "ionicons.ttf");
                    TxtFullName.SetTypeface(font, TypefaceStyle.Normal);

                    var textHighLighter = AppTools.GetNameFinal(data);
                    var textIsPro       = string.Empty;

                    if (data.Verified == "1")
                    {
                        textHighLighter += " " + IonIconsFonts.CheckmarkCircled;
                    }

                    if (data.BusinessAccount == "1")
                    {
                        textIsPro        = " " + IonIconsFonts.SocialUsd;
                        textHighLighter += textIsPro;
                    }

                    var decorator = TextDecorator.Decorate(TxtFullName, textHighLighter);

                    if (data.Verified == "1")
                    {
                        decorator.SetTextColor(Resource.Color.Post_IsVerified, IonIconsFonts.CheckmarkCircled);
                    }

                    if (data.BusinessAccount == "1")
                    {
                        decorator.SetTextColor(Resource.Color.Post_IsBusiness, IonIconsFonts.SocialUsd);
                    }

                    decorator.Build();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Beispiel #26
0
        //Result
        protected override async void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            try
            {
                base.OnActivityResult(requestCode, resultCode, data);

                if (AppSettings.ShowInAppBilling)
                {
                    BillingPayment?.Handler?.HandleActivityResult(requestCode, resultCode, data);
                }

                if (requestCode == 108 || requestCode == CropImage.CropImageActivityRequestCode)
                {
                    if (Methods.CheckConnectivity())
                    {
                        var result = CropImage.GetActivityResult(data);
                        if (result.IsSuccessful)
                        {
                            var resultPathImage = result.Uri.Path;
                            if (!string.IsNullOrEmpty(resultPathImage))
                            {
                                if (TypeAvatar == "Avatar")
                                {
                                    GlideImageLoader.LoadImage(this, resultPathImage, ProfileFragment?.ProfileImage, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                                        () => ApiRequest.UpdateAvatarApi(this, resultPathImage)
                                    });
                                }
                                else
                                {
                                    //sent api
                                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                                        () => RequestsAsync.Users.UploadMediaFileUserAsync(resultPathImage)
                                    });
                                }
                                Toast.MakeText(this, GetText(Resource.String.Lbl_Done), ToastLength.Long).Show();
                            }
                        }
                        else
                        {
                            Toast.MakeText(this, GetText(Resource.String.Lbl_something_went_wrong), ToastLength.Long).Show();
                        }
                    }
                    else
                    {
                        Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Long).Show();
                    }
                }
                else if (requestCode == 1050) //1050
                {
                    //Get Location And Get Data Api
                    TrendingFragment?.CheckAndGetLocation();
                }
                else if (requestCode == InitPayPalPayment?.PayPalDataRequestCode)
                {
                    switch (resultCode)
                    {
                    case Result.Ok:
                        var confirmObj = data.GetParcelableExtra(PaymentActivity.ExtraResultConfirmation);
                        PaymentConfirmation configuration = Android.Runtime.Extensions.JavaCast <PaymentConfirmation>(confirmObj);
                        if (configuration != null)
                        {
                            //string createTime = configuration.ProofOfPayment.CreateTime;
                            //string intent = configuration.ProofOfPayment.Intent;
                            //string paymentId = configuration.ProofOfPayment.PaymentId;
                            //string state = configuration.ProofOfPayment.State;
                            //string transactionId = configuration.ProofOfPayment.TransactionId;

                            if (InitPayPalPayment?.PayType != "membership")
                            {
                                if (Methods.CheckConnectivity())
                                {
                                    (int apiStatus, var respond) = await RequestsAsync.Auth.SetCreditAsync(InitPayPalPayment?.Credits, InitPayPalPayment?.Price, "PayPal").ConfigureAwait(false);

                                    if (apiStatus == 200)
                                    {
                                        if (respond is SetCreditObject result)
                                        {
                                            RunOnUiThread(() =>
                                            {
                                                try
                                                {
                                                    var dataUser = ListUtils.MyUserInfo.FirstOrDefault(a => a.Id == UserDetails.UserId);
                                                    if (dataUser != null)
                                                    {
                                                        dataUser.Balance = result.Balance;

                                                        var sqlEntity = new SqLiteDatabase();
                                                        sqlEntity.InsertOrUpdate_DataMyInfo(dataUser);
                                                        sqlEntity.Dispose();
                                                    }

                                                    if (ProfileFragment.WalletNumber != null)
                                                    {
                                                        ProfileFragment.WalletNumber.Text = result.Balance;
                                                    }

                                                    Toast.MakeText(this, GetText(Resource.String.Lbl_Done), ToastLength.Long).Show();
                                                }
                                                catch (Exception e)
                                                {
                                                    Console.WriteLine(e);
                                                }
                                            });
                                        }
                                    }
                                    else
                                    {
                                        Methods.DisplayReportResult(this, respond);
                                    }
                                }
                                else
                                {
                                    Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Long).Show();
                                }
                            }
                            else
                            {
                                if (Methods.CheckConnectivity())
                                {
                                    (int apiStatus, var respond) = await RequestsAsync.Auth.SetProAsync(InitPayPalPayment?.Id, InitPayPalPayment?.Price, "PayPal").ConfigureAwait(false);

                                    if (apiStatus == 200)
                                    {
                                        RunOnUiThread(() =>
                                        {
                                            try
                                            {
                                                var dataUser = ListUtils.MyUserInfo.FirstOrDefault();
                                                if (dataUser != null)
                                                {
                                                    dataUser.VerifiedFinal = true;
                                                    dataUser.IsPro         = "1";

                                                    var sqlEntity = new SqLiteDatabase();
                                                    sqlEntity.InsertOrUpdate_DataMyInfo(dataUser);
                                                    sqlEntity.Dispose();
                                                }

                                                Toast.MakeText(this, GetText(Resource.String.Lbl_Done),
                                                               ToastLength.Long).Show();
                                            }
                                            catch (Exception e)
                                            {
                                                Console.WriteLine(e);
                                            }
                                        });
                                    }
                                    else
                                    {
                                        Methods.DisplayReportResult(this, respond);
                                    }
                                }
                                else
                                {
                                    Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Long).Show();
                                }
                            }
                        }

                        break;

                    case Result.Canceled:
                        Toast.MakeText(this, GetText(Resource.String.Lbl_Canceled), ToastLength.Long).Show();
                        break;
                    }
                }
                else if (requestCode == PaymentActivity.ResultExtrasInvalid)
                {
                    Toast.MakeText(this, GetText(Resource.String.Lbl_Invalid), ToastLength.Long).Show();
                }
                else if (requestCode == 1001 && resultCode == Result.Ok && AppSettings.ShowInAppBilling)
                {
                    if (BillingPayment?.PayType != "membership")
                    {
                        if (Methods.CheckConnectivity())
                        {
                            (int apiStatus, var respond) = await RequestsAsync.Auth.SetCreditAsync(BillingPayment?.Credits, BillingPayment?.Price, "Google InApp").ConfigureAwait(false);

                            if (apiStatus == 200)
                            {
                                if (respond is SetCreditObject result)
                                {
                                    RunOnUiThread(() =>
                                    {
                                        try
                                        {
                                            var dataUser = ListUtils.MyUserInfo.FirstOrDefault();
                                            if (dataUser != null)
                                            {
                                                dataUser.Balance = result.Balance;

                                                var sqlEntity = new SqLiteDatabase();
                                                sqlEntity.InsertOrUpdate_DataMyInfo(dataUser);
                                                sqlEntity.Dispose();
                                            }

                                            if (ProfileFragment.WalletNumber != null)
                                            {
                                                ProfileFragment.WalletNumber.Text = result.Balance.Replace(".00", "");
                                            }

                                            Toast.MakeText(this, GetText(Resource.String.Lbl_Done), ToastLength.Long).Show();
                                        }
                                        catch (Exception e)
                                        {
                                            Console.WriteLine(e);
                                        }
                                    });
                                }
                            }
                            else
                            {
                                Methods.DisplayReportResult(this, respond);
                            }
                        }
                        else
                        {
                            Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Long).Show();
                        }
                    }
                    else
                    {
                        if (Methods.CheckConnectivity())
                        {
                            (int apiStatus, var respond) = await RequestsAsync.Auth.SetProAsync(BillingPayment?.Id, BillingPayment?.Price, "Google InApp").ConfigureAwait(false);

                            if (apiStatus == 200)
                            {
                                RunOnUiThread(() =>
                                {
                                    try
                                    {
                                        var dataUser = ListUtils.MyUserInfo.FirstOrDefault();
                                        if (dataUser != null)
                                        {
                                            dataUser.VerifiedFinal = true;
                                            dataUser.IsPro         = "1";

                                            var sqlEntity = new SqLiteDatabase();
                                            sqlEntity.InsertOrUpdate_DataMyInfo(dataUser);
                                            sqlEntity.Dispose();
                                        }

                                        Toast.MakeText(this, GetText(Resource.String.Lbl_Done), ToastLength.Long).Show();
                                    }
                                    catch (Exception e)
                                    {
                                        Console.WriteLine(e);
                                    }
                                });
                            }
                            else
                            {
                                Methods.DisplayReportResult(this, respond);
                            }
                        }
                        else
                        {
                            Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Long).Show();
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
 public RequestBuilder GetPreloadRequestBuilder(Java.Lang.Object p0)
 {
     return(GlideImageLoader.GetPreLoadRequestBuilder(ActivityContext, p0.ToString(), ImageStyle.CircleCrop));
 }
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                if (viewHolder is NotificationsAdapterViewHolder holder)
                {
                    var item = NotificationsList[position];
                    if (item != null)
                    {
                        holder.UserNameNoitfy.Text = item.Username;

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

                        if (item.Type == "followed_u")
                        {
                            if (holder.IconNotify.Text != IonIconsFonts.PersonAdd)
                            {
                                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotify, IonIconsFonts.PersonAdd);
                            }

                            holder.Description.Text = ActivityContext.GetText(Resource.String.Lbl_followed_u);
                        }
                        else if (item.Type == "liked_ur_post")
                        {
                            if (holder.IconNotify.Text != IonIconsFonts.Thumbsup)
                            {
                                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotify, IonIconsFonts.Thumbsup);
                            }

                            holder.Description.Text = ActivityContext.GetText(Resource.String.Lbl_liked_ur_post);
                        }
                        else if (item.Type == "commented_ur_post")
                        {
                            if (holder.IconNotify.Text != IonIconsFonts.IosChatbubble)
                            {
                                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotify, IonIconsFonts.IosChatbubble);
                            }

                            holder.Description.Text = ActivityContext.GetText(Resource.String.Lbl_commented_ur_post);
                        }
                        else if (item.Type == "mentioned_u_in_comment")
                        {
                            if (holder.IconNotify.Text != IonIconsFonts.Pricetag)
                            {
                                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotify, IonIconsFonts.Pricetag);
                            }

                            holder.Description.Text = ActivityContext.GetText(Resource.String.Lbl_mentioned_u_in_comment);
                        }
                        else if (item.Type == "mentioned_u_in_post")
                        {
                            if (holder.IconNotify.Text != IonIconsFonts.At)
                            {
                                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotify, IonIconsFonts.At);
                            }

                            holder.Description.Text = ActivityContext.GetText(Resource.String.Lbl_mentioned_u_in_post);
                        }
                        else if (item.Type == "liked_ur_comment")
                        {
                            if (holder.IconNotify.Text != IonIconsFonts.Thumbsup)
                            {
                                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotify, IonIconsFonts.Thumbsup);
                            }

                            holder.Description.Text = ActivityContext.GetText(Resource.String.Lbl_liked_ur_comment);
                        }
                        else
                        {
                            if (holder.IconNotify.Text != IonIconsFonts.AndroidNotifications)
                            {
                                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconNotify, IonIconsFonts.AndroidNotifications);
                            }

                            holder.Description.Text = Methods.FunString.DecodeString(item.Text);
                        }

                        if (!holder.ImageUser.HasOnClickListeners)
                        {
                            holder.ImageUser.Click += (sender, e) => OnImageClick(new AvatarNotificationsAdapterClickEventArgs {
                                Class = item, Position = position, View = holder.MainView
                            });
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
Beispiel #29
0
 public RequestBuilder GetPreloadRequestBuilder(Object p0)
 {
     return(GlideImageLoader.GetPreLoadRequestBuilder(ActivityContext, p0.ToString(), ImageStyle.RoundedCrop));
 }
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                if (viewHolder is Holders.LastMessagesViewHolder holder)
                {
                    var item = ChatList[position];
                    if (item != null)
                    {
                        var image = item.Avatar;
                        if (!string.IsNullOrEmpty(image))
                        {
                            var avatarSplit    = image.Split('/').Last();
                            var getImageAvatar = Methods.MultiMedia.GetMediaFrom_Disk(Methods.Path.FolderDiskImage, avatarSplit);
                            if (getImageAvatar != "File Dont Exists")
                            {
                                var file = Uri.FromFile(new File(getImageAvatar));
                                Glide.With(ActivityContext).Load(file.Path).Apply(Options).Into(holder.ImageAvatar);
                            }
                            else
                            {
                                Methods.MultiMedia.DownloadMediaTo_DiskAsync(Methods.Path.FolderDiskImage, image);
                                GlideImageLoader.LoadImage(ActivityContext, image, holder.ImageAvatar, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                            }
                        }

                        item.LastMessage.LastMessageClass.Stickers = item.LastMessage.LastMessageClass.Stickers?.Replace(".mp4", ".gif") ?? "";

                        //If message contains Media files
                        if (item.LastMessage.LastMessageClass.Media.Contains("image"))
                        {
                            holder.LastMessagesIcon.Visibility = ViewStates.Visible;
                            Glide.With(ActivityContext).Load(Resource.Drawable.ic_image_vector).Into(holder.LastMessagesIcon);
                            holder.TxtLastMessages.Text = ActivityContext.GetText(Resource.String.Lbl_SendImageFile);
                        }
                        else if (item.LastMessage.LastMessageClass.Media.Contains("video"))
                        {
                            holder.LastMessagesIcon.Visibility = ViewStates.Visible;
                            Glide.With(ActivityContext).Load(Resource.Drawable.ic_video_player_vector).Into(holder.LastMessagesIcon);
                            holder.TxtLastMessages.Text = ActivityContext.GetText(Resource.String.Lbl_SendVideoFile);
                        }
                        else if (item.LastMessage.LastMessageClass.Media.Contains("sticker"))
                        {
                            holder.LastMessagesIcon.Visibility = ViewStates.Visible;
                            Glide.With(ActivityContext).Load(Resource.Drawable.ic_sticker_vector).Into(holder.LastMessagesIcon);
                            holder.TxtLastMessages.Text = ActivityContext.GetText(Resource.String.Lbl_SendStickerFile);
                        }
                        else if (item.LastMessage.LastMessageClass.Media.Contains("sounds"))
                        {
                            holder.LastMessagesIcon.Visibility = ViewStates.Visible;
                            Glide.With(ActivityContext).Load(Resource.Drawable.ic_radios_vector).Into(holder.LastMessagesIcon);
                            holder.TxtLastMessages.Text = ActivityContext.GetText(Resource.String.Lbl_SendAudioFile);
                        }
                        else if (item.LastMessage.LastMessageClass.Media.Contains("file"))
                        {
                            holder.LastMessagesIcon.Visibility = ViewStates.Visible;
                            Glide.With(ActivityContext).Load(Resource.Drawable.ic_document_vector).Into(holder.LastMessagesIcon);
                            holder.TxtLastMessages.Text = ActivityContext.GetText(Resource.String.Lbl_SendFile);
                        }
                        else if (item.LastMessage.LastMessageClass?.Stickers != null && item.LastMessage.LastMessageClass.Stickers.Contains(".gif"))
                        {
                            holder.LastMessagesIcon.Visibility = ViewStates.Visible;
                            Glide.With(ActivityContext).Load(Resource.Drawable.ic_gif_vector).Into(holder.LastMessagesIcon);
                            holder.TxtLastMessages.Text = ActivityContext.GetText(Resource.String.Lbl_SendGifFile);
                        }
                        else if (!string.IsNullOrEmpty(item.LastMessage.LastMessageClass.ProductId) && item.LastMessage.LastMessageClass.ProductId != "0")
                        {
                            holder.TxtLastMessages.Text = ActivityContext.GetText(Resource.String.Lbl_SendProductFile);
                        }
                        else
                        {
                            // holder.LastMessagesIcon.Visibility = ViewStates.Gone;

                            if (item.LastMessage.LastMessageClass.Text.Contains("http"))
                            {
                                holder.TxtLastMessages.Text = Methods.FunString.SubStringCutOf(item.LastMessage.LastMessageClass.Text, 30);
                            }
                            else if (item.LastMessage.LastMessageClass.Text.Contains("{&quot;Key&quot;") || item.LastMessage.LastMessageClass.Text.Contains("{key:^qu") || item.LastMessage.LastMessageClass.Text.Contains("{^key:^qu") || item.LastMessage.LastMessageClass.Text.Contains("{key:"))
                            {
                                holder.TxtLastMessages.Text = ActivityContext.GetText(Resource.String.Lbl_SendContactnumber);
                            }
                            else
                            {
                                holder.TxtLastMessages.Text = Methods.FunString.DecodeString(Methods.FunString.SubStringCutOf(item.LastMessage.LastMessageClass.Text, 30));
                            }
                        }

                        //last seen time
                        holder.TxtTimestamp.Text = Methods.Time.TimeAgo(int.Parse(item.ChatTime), true);

                        //Check read message
                        if (item.LastMessage.LastMessageClass.FromId != null && (item.LastMessage.LastMessageClass.ToId != null && (item.LastMessage.LastMessageClass.ToId != UserDetails.UserId && item.LastMessage.LastMessageClass.FromId == UserDetails.UserId)))
                        {
                            if (item.LastMessage.LastMessageClass.Seen == "0")
                            {
                                holder.IconCheckCountMessages.Visibility = ViewStates.Invisible;
                                holder.TxtUsername.SetTypeface(Typeface.Default, TypefaceStyle.Normal);
                                holder.TxtLastMessages.SetTypeface(Typeface.Default, TypefaceStyle.Normal);
                            }
                            else
                            {
                                holder.IconCheckCountMessages.Visibility = ViewStates.Visible;
                                holder.TxtUsername.SetTypeface(Typeface.Default, TypefaceStyle.Normal);
                                holder.TxtLastMessages.SetTypeface(Typeface.Default, TypefaceStyle.Normal);
                                Glide.With(ActivityContext).Load(Resource.Drawable.ic_tick_vector).Into(holder.IconCheckCountMessages);
                            }
                        }
                        else if (item.LastMessage.LastMessageClass.FromId != null && (item.LastMessage.LastMessageClass.ToId != null && (item.LastMessage.LastMessageClass.ToId == UserDetails.UserId && item.LastMessage.LastMessageClass.FromId != UserDetails.UserId)))
                        {
                            if (item.LastMessage.LastMessageClass.Seen == "0")
                            {
                                holder.TxtUsername.SetTypeface(Typeface.Default, TypefaceStyle.Bold);
                                holder.TxtLastMessages.SetTypeface(Typeface.Default, TypefaceStyle.Bold);

                                holder.IconCheckCountMessages.Visibility = ViewStates.Visible;
                                if (item.ChatType == "user")
                                {
                                    if (!string.IsNullOrEmpty(item.MessageCount))
                                    {
                                        var drawable = new TextDrawable.Builder().BeginConfig().FontSize(25).EndConfig().BuildRound(item.MessageCount, Color.ParseColor(AppSettings.MainColor));
                                        holder.IconCheckCountMessages.SetImageDrawable(drawable);
                                        holder.IconCheckCountMessages.Visibility = ViewStates.Visible;
                                    }
                                    else
                                    {
                                        var drawable = new TextDrawable.Builder().BeginConfig().FontSize(25).EndConfig().BuildRound("N", Color.ParseColor(AppSettings.MainColor));
                                        holder.IconCheckCountMessages.SetImageDrawable(drawable);
                                        holder.IconCheckCountMessages.Visibility = ViewStates.Visible;
                                    }
                                }
                            }
                            else
                            {
                                holder.IconCheckCountMessages.Visibility = ViewStates.Invisible;
                                holder.TxtUsername.SetTypeface(Typeface.Default, TypefaceStyle.Normal);
                                holder.TxtLastMessages.SetTypeface(Typeface.Default, TypefaceStyle.Normal);
                            }
                        }

                        switch (item.ChatType)
                        {
                        case "user":
                            InitializeUser(holder, item);
                            break;

                        case "page":
                            InitializePage(holder, item);
                            break;

                        case "group":
                            InitializeGroup(holder, item);
                            break;
                        }

                        holder.RelativeLayoutMain.Visibility = item.Swiped ? ViewStates.Gone : ViewStates.Visible;
                        holder.MainSwipe.Visibility          = item.Swiped ? ViewStates.Visible : ViewStates.Gone;
                    }
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }