Ejemplo n.º 1
0
 private void ShowOrHideBadgeView(int countMessages = 0, bool show = false)
 {
     try
     {
         if (show)
         {
             if (Image != null && Badge == null)
             {
                 var gravity = (int)(GravityFlags.Start | GravityFlags.Top);
                 Badge = new QBadgeView(Application.Context);
                 Badge.BindTarget(Image);
                 Badge.SetBadgeNumber(countMessages);
                 Badge.SetBadgeGravity(gravity);
                 Badge.SetBadgeBackgroundColor(Color.ParseColor(AppSettings.MainColor));
                 //Badge.SetBadgeTextSize(13, true);
             }
             else
             {
                 Badge?.SetBadgeNumber(countMessages);
             }
         }
         else
         {
             Badge?.BindTarget(Image).Hide(true);
             Badge = null;
         }
     }
     catch (Exception e)
     {
         Methods.DisplayReportResultTrack(e);
     }
 }
Ejemplo n.º 2
0
        public void ShowOrHideBadgeView(int countMessages = 0, bool show = false)
        {
            try
            {
                RunOnUiThread(() =>
                {
                    try
                    {
                        if (show)
                        {
                            if (NotificationsFragment?.IconFriend != null)
                            {
                                int gravity      = (int)(GravityFlags.End | GravityFlags.Bottom);
                                QBadgeView badge = new QBadgeView(this);
                                badge.BindTarget(NotificationsFragment.IconFriend);
                                badge.SetBadgeNumber(countMessages);
                                badge.SetBadgeGravity(gravity);
                                badge.SetBadgeBackgroundColor(Color.ParseColor(AppSettings.MainColor));
                                badge.SetGravityOffset(0, true);

                                NotificationsFragment.IconFriend.Visibility = ViewStates.Visible;
                            }
                        }
                        else
                        {
                            if (NotificationsFragment?.IconFriend != null)
                            {
                                new QBadgeView(this).BindTarget(NotificationsFragment.IconFriend).Hide(true);
                                NotificationsFragment.IconFriend.Visibility = ViewStates.Gone;
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                    }
                });
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 3
0
        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);
     }
 }