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 void Get_Data_Event() { try { if (EventData != null) { Glide.With(this).Load(EventData.Cover).Apply(new RequestOptions()).Into(ImageEventCover); Name = Methods.FunString.DecodeString(EventData.Name); TxtName.Text = Name; ToolbarLayout.Title = Name; SupportActionBar.Title = Name; if (string.IsNullOrEmpty(EventData.GoingCount)) { EventData.GoingCount = "0"; } if (string.IsNullOrEmpty(EventData.InterestedCount)) { EventData.InterestedCount = "0"; } TxtGoing.Text = EventData.GoingCount + " " + GetText(Resource.String.Lbl_GoingPeople); TxtInterested.Text = EventData.InterestedCount + " " + GetText(Resource.String.Lbl_InterestedPeople); TxtLocation.Text = EventData.Location; TxtStartDate.Text = EventData.StartDate; TxtEndDate.Text = EventData.EndDate; if (!string.IsNullOrEmpty(EventData.Description)) { var description = Methods.FunString.DecodeString(EventData.Description); var readMoreOption = new StReadMoreOption.Builder() .TextLength(250, 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(); readMoreOption.AddReadMoreTo(TxtDescriptionText, new String(description)); } else { TxtDescription.Visibility = ViewStates.Gone; TxtDescriptionText.Visibility = ViewStates.Gone; } if (EventData.IsGoing != null && EventData.IsGoing.Value) { BtnGo.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed); BtnGo.SetTextColor(Color.ParseColor("#ffffff")); BtnGo.Text = GetText(Resource.String.Lbl_Going); BtnGo.Tag = "true"; } else { BtnGo.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends); BtnGo.SetTextColor(Color.ParseColor(AppSettings.MainColor)); BtnGo.Text = GetText(Resource.String.Lbl_Go); BtnGo.Tag = "false"; } if (EventData.IsInterested != null && EventData.IsInterested.Value) { BtnInterested.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed); BtnInterested.SetTextColor(Color.ParseColor("#ffffff")); BtnInterested.Text = GetText(Resource.String.Lbl_Interested); BtnInterested.Tag = "true"; } else { BtnInterested.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends); BtnInterested.SetTextColor(Color.ParseColor(AppSettings.MainColor)); BtnInterested.Text = GetText(Resource.String.Lbl_Interested); BtnInterested.Tag = "false"; } //add post var checkSection = PostFeedAdapter.ListDiffer.FirstOrDefault(a => a.TypeView == PostModelType.AddPostBox); if (checkSection == null) { Combiner.AddPostDivider(); Combiner.AddPostBoxPostView("Event", -1, new PostDataObject() { Event = new EventUnion() { EventClass = EventData } }); PostFeedAdapter.NotifyItemInserted(PostFeedAdapter.ListDiffer.Count - 1); } StartApiService(); } } catch (Exception e) { Console.WriteLine(e); } }