// Create new views (invoked by the layout manager) public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { try { View itemView; if (viewType == 1) { itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.Style_MoreSection2_view, parent, false); var vh = new MoreSectionAdapterViewHolderTheme2(itemView, Click, LongClick); return(vh); } else { itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.Style_MoreSection_view, parent, false); var vh = new MoreSectionAdapterViewHolder(itemView, Click, LongClick); return(vh); } } catch (Exception exception) { Console.WriteLine(exception); return(null); } }
public void ShowOrHideBadgeViewIcon(MoreSectionAdapterViewHolderTheme2 viewHolderTheme2, int countMessages = 0, bool show = false) { try { ActivityContext?.RunOnUiThread(() => { try { switch (show) { case true: { if (viewHolderTheme2?.LinearLayoutImage != null) { int gravity = (int)(GravityFlags.End | GravityFlags.Bottom); QBadgeView badge = new QBadgeView(ActivityContext); badge.BindTarget(viewHolderTheme2.LinearLayoutImage); badge.SetBadgeNumber(countMessages); badge.SetBadgeGravity(gravity); badge.SetBadgeBackgroundColor(Color.ParseColor(AppSettings.MainColor)); badge.SetGravityOffset(10, true); } break; } default: new QBadgeView(ActivityContext).BindTarget(viewHolderTheme2?.LinearLayoutImage).Hide(true); break; } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public void ShowOrHideBadgeViewIcon(MoreSectionAdapterViewHolderTheme2 viewHolderTheme2, int countMessages = 0, bool show = false) { try { ActivityContext.RunOnUiThread(() => { try { if (show) { if (viewHolderTheme2?.LinearLayoutImage != null) { int gravity = (int)(GravityFlags.End | GravityFlags.Bottom); QBadgeView badge = new QBadgeView(ActivityContext); badge.BindTarget(viewHolderTheme2.LinearLayoutImage); badge.SetBadgeNumber(countMessages); badge.SetBadgeGravity(gravity); badge.SetBadgeBackgroundColor(Color.ParseColor(AppSettings.MainColor)); badge.SetGravityOffset(10, true); } } else { new QBadgeView(ActivityContext).BindTarget(viewHolderTheme2?.LinearLayoutImage).Hide(true); } } catch (Exception e) { Console.WriteLine(e); } }); } catch (Exception e) { Console.WriteLine(e); } }
// Create new views (invoked by the layout manager) public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { try { View itemView; switch (viewType) { case 1: { itemView = LayoutInflater.From(parent.Context)?.Inflate(Resource.Layout.Style_MoreSection2_view, parent, false); var vh = new MoreSectionAdapterViewHolderTheme2(itemView, Click, LongClick); return(vh); } case 2: { itemView = LayoutInflater.From(parent.Context)?.Inflate(Resource.Layout.Style_MoreSection_view, parent, false); var vh = new MoreSectionAdapterViewHolder(itemView, Click, LongClick); return(vh); } default: { itemView = LayoutInflater.From(parent.Context)?.Inflate(Resource.Layout.Style_MoreSection_view, parent, false); var vh = new MoreSectionAdapterViewHolder(itemView, Click, LongClick); return(vh); } } } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); return(null !); } }