public Notification Render(Context context, string channelId)
        {
            var builder = new NotificationCompat.Builder(context, channelId)
                          .SetContentTitle(Title)
                          .SetContentText(Body)
                          .SetVisibility((int)NotificationVisibility.Public)
                          .SetCategory(Notification.CategoryMessage)
                          .SetContentIntent(CreateLaunchIntent(context));

            builder.SetWhen(NotifyTime.ToUnixTime());

            if (Icon?.Name.HasValue() == true)
            {
                builder.SetSmallIcon(Icon.ConvertToId(context));
            }

            if (OS.IsAtLeast(BuildVersionCodes.Lollipop) && TransparentIcon?.Name.HasValue() == true)
            {
                builder.SetSmallIcon(TransparentIcon.ConvertToId(context));
                builder.SetColor(Color.Parse(TransparentIconColor.Or("transparent")).Render().ToArgb());
            }

            if (PlaySound)
            {
                builder.SetSound(LocalNotification.GetSoundUri());
            }

            return(builder.Build());
        }
Beispiel #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id;
         hashCode = (hashCode * 397) ^ ThemeId;
         hashCode = (hashCode * 397) ^ NotifyTime.GetHashCode();
         hashCode = (hashCode * 397) ^ (Text != null ? Text.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Link != null ? Link.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (LinkText != null ? LinkText.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)FeedbackType;
         return(hashCode);
     }
 }
Beispiel #3
0
 private void Start()
 {
     noTime = transform.parent.GetComponent <NotifyTime>();
 }