private static DateTime getDayOfReminderTime(BaseViewItemHomeworkExam h, AccountDataItem account, ref bool hasClassTime) { ViewItemClass c = h.GetClassOrNull(); if (c == null) { return(DateTime.MinValue); } return(h.GetDayOfReminderTime(out hasClassTime)); }
public static Brush GetBackgroundBrush(BaseViewItemHomeworkExam item) { if (item.IsComplete()) { return(new SolidColorBrush(Color.FromArgb(255, 180, 180, 180))); } else { return(new ColorArrayToBrushConverter().Convert(item.GetClassOrNull()?.Color, null, null, null) as Brush); } }
internal static CGColor GetBackgroundCGColor(BaseViewItemHomeworkExam item) { if (item.IsComplete()) { return(new CGColor(180 / 255f, 1)); } else { return(BareUIHelper.ToCGColor(item.GetClassOrNull()?.Color)); } }
private static string GetClassName(BaseViewItemHomeworkExam item) { if (item == null) { return(""); } var c = item.GetClassOrNull(); if (c != null) { return(StringTools.TrimLengthWithEllipses(c.Name, 30)); } return(""); }
private static string getClassName(BaseViewItemHomeworkExam item) { if (item == null) { return(""); } var c = item.GetClassOrNull(); if (c != null) { return(c.Name); } return(""); }
public static Android.Content.Res.ColorStateList GetBackgroundColorStateList(BaseViewItemHomeworkExam item) { return(new Android.Content.Res.ColorStateList(new int[][] { new int[] { } }, new int[] { item.IsComplete() ? new Color(180, 180, 180).ToArgb() : ColorTools.GetColor(item.GetClassOrNull().Color).ToArgb() })); }
private static void UpdateDayOfNotification(Guid localAccountId, BaseViewItemHomeworkExam item, DateTime dayOfReminderTime, Context context, NotificationManager notificationManager, List <StatusBarNotification> existingNotifs, bool fromForeground) { ViewItemClass c = item.GetClassOrNull(); if (c == null) { return; } string tag = localAccountId.ToString() + ";" + item.Identifier.ToString(); var existing = existingNotifs.FirstOrDefault(i => i.Tag == tag); // If the reminder has already been sent and the notification doesn't exist, // that means the user dismissed it, so don't show it again if (item.HasSentReminder && existing == null) { return; } // If there's no existing notification, and the updated time is greater than the desired reminder time, // then it was edited after the notification should have been sent, so don't notify, since user was already // aware of this item (by the fact that they were editing it) if (existing == null && item.Updated.ToLocalTime() > dayOfReminderTime) { return; } if (existing == null && fromForeground) { return; } const string EXTRA_UNIQUE_ID = "UniqueId"; string extraUniqueId = (item.Name + ";" + c.Name).GetHashCode().ToString(); // If there's an existing, and it hasn't changed, do nothing if (existing != null && existing.Notification.Extras.GetString(EXTRA_UNIQUE_ID).Equals(extraUniqueId)) { return; } BaseArguments launchArgs; if (item is ViewItemHomework) { launchArgs = new ViewHomeworkArguments() { LocalAccountId = localAccountId, ItemId = item.Identifier, LaunchSurface = LaunchSurface.Toast }; } else { launchArgs = new ViewExamArguments() { LocalAccountId = localAccountId, ItemId = item.Identifier, LaunchSurface = LaunchSurface.Toast }; } var builder = CreateReminderBuilder(context, localAccountId, launchArgs); Bundle b = new Bundle(); b.PutString(EXTRA_UNIQUE_ID, extraUniqueId); builder.SetExtras(b); builder.SetContentTitle(item.Name); builder.SetChannelId(GetChannelIdForDayOf(localAccountId)); string subtitle = item.GetSubtitleOrNull(); if (subtitle != null) { builder.SetContentText(subtitle); } notificationManager.Notify(tag, NotificationIds.DAY_OF_NOTIFICATIONS, BuildReminder(builder)); }