//Report Video private void ReportLayoutOnClick(object sender, EventArgs e) { try { LibrarySynchronizer.AddReportVideo(Controller.VideoData); Dismiss(); } 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 is WatchLaterVideoRowAdapterViewHolder holder) { var item = VideoList[position]; if (item != null) { if (item.Videos != null) { GlideImageLoader.LoadImage(ActivityContext, item.Videos?.VideoAdClass.Thumbnail, holder.VideoImage, ImageStyle.CenterCrop, ImagePlaceholders.Drawable); holder.TxtDuration.Text = Methods.FunString.SplitStringDuration(item.Videos?.VideoAdClass.Duration); holder.TxtTitle.Text = Methods.FunString.DecodeString(item.Videos?.VideoAdClass.Title); holder.TxtChannelName.Text = AppTools.GetNameFinal(item.Videos?.VideoAdClass.Owner); holder.TxtViewsCount.Text = Methods.FunString.FormatPriceValue(Convert.ToInt32(item.Videos?.VideoAdClass.Views)) + " " + ActivityContext.GetText(Resource.String.Lbl_Views); FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.MenueView, IonIconsFonts.AndroidMoreVertical); //Verified if (item.Videos?.VideoAdClass.Owner.Verified == "1") { holder.IconVerified.Visibility = ViewStates.Visible; FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.IconVerified, IonIconsFonts.CheckmarkCircled); } else { holder.IconVerified.Visibility = ViewStates.Gone; } if (!holder.MenueView.HasOnClickListeners) { holder.MenueView.Click += (sender, args) => { ContextThemeWrapper ctw = new ContextThemeWrapper(ActivityContext, Resource.Style.PopupMenuStyle); PopupMenu popup = new PopupMenu(ctw, holder.MenueView); if (Type == "MyChannel") { popup.MenuInflater.Inflate(Resource.Menu.MyVideoMore_Menu, popup.Menu); } else { 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.Videos?.VideoAdClass); break; case Resource.Id.menu_AddPlaylist: LibrarySynchronizer.AddToPlaylist(item.Videos?.VideoAdClass); break; case Resource.Id.menu_Remove: OnMenuRemove_Click(item); break; case Resource.Id.menu_Share: LibrarySynchronizer.ShareVideo(item.Videos?.VideoAdClass); break; case Resource.Id.menu_Report: LibrarySynchronizer.AddReportVideo(item.Videos?.VideoAdClass); break; } } catch (Exception exception) { Console.WriteLine(exception); } }; } } ; //Set Badge on videos AppTools.ShowGlobalBadgeSystem(holder.VideoType, item.Videos?.VideoAdClass); } } } } 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 { Position = position; var item = SubscriptionsList[Position]; if (item != null) { if (item.Type == ItemType.Channel) { if (viewHolder is SubscriptionsAdapterViewHolder holder) { if (ChannelAdapter == null) { ChannelAdapter = new ChannelAdapter(ActivityContext) { ChannelList = new ObservableCollection <UserDataObject>() }; 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 <UserDataObject>(ActivityContext, ChannelAdapter, sizeProvider, 10); holder.MRecycler.AddOnScrollListener(preLoader); holder.MRecycler.SetAdapter(ChannelAdapter); ChannelAdapter.ItemClick += ChannelAdapterOnOnItemClick; } if (item.ChannelList.Count > 0) { if (ChannelAdapter.ChannelList.Count == 0) { ChannelAdapter.ChannelList = new ObservableCollection <UserDataObject>(item.ChannelList); ChannelAdapter.NotifyDataSetChanged(); } else if (ChannelAdapter.ChannelList != null && ChannelAdapter.ChannelList.Count != item.ChannelList.Count) { ChannelAdapter.ChannelList = new ObservableCollection <UserDataObject>(item.ChannelList); ChannelAdapter.NotifyDataSetChanged(); } } holder.MainLinear.Visibility = ViewStates.Visible; holder.MoreText.Visibility = ChannelAdapter.ChannelList?.Count >= 5 ? ViewStates.Visible : ViewStates.Invisible; holder.TitleText.Text = ActivityContext.GetString(Resource.String.Lbl_All_Channal); } } 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); } }