1
0
mirror of https://github.com/XFox111/GUTSchedule.git synced 2026-04-22 06:58:01 +03:00

Fixed calendar export, disable reminders option has been removed from menu

This commit is contained in:
Michael Gordeev
2019-12-24 16:06:52 +03:00
parent 1e8cf30374
commit 00e6ef49ba
4 changed files with 19 additions and 12 deletions
@@ -35,7 +35,7 @@ namespace GUT.Schedule
course.SetList(this, "1234".ToCharArray()); course.SetList(this, "1234".ToCharArray());
reminder.SetList(this, new string[] reminder.SetList(this, new string[]
{ {
"Нет", //"Нет",
"Во время начала", "Во время начала",
"За 5 мин", "За 5 мин",
"За 10 мин" "За 10 мин"
@@ -65,13 +65,13 @@ namespace GUT.Schedule
Course = course.SelectedItemPosition + 1, Course = course.SelectedItemPosition + 1,
AddGroupToTitle = groupTitle.Checked, AddGroupToTitle = groupTitle.Checked,
Calendar = Calendar.Calendars[calendar.SelectedItemPosition].Id, Calendar = Calendar.Calendars[calendar.SelectedItemPosition].Id,
Reminder = reminder.SelectedItemPosition switch Reminder = reminder.SelectedItemPosition * 5 /*switch
{ {
1 => 0, 1 => 0,
2 => 5, 2 => 5,
3 => 10, 3 => 10,
_ => null _ => null
} }*/
}; };
StartActivity(new Intent(this, typeof(ExportActivity))); StartActivity(new Intent(this, typeof(ExportActivity)));
+9 -7
View File
@@ -1,4 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks;
using Android.App; using Android.App;
using Android.Database; using Android.Database;
using Android.Net; using Android.Net;
@@ -66,26 +67,27 @@ namespace GUT.Schedule
eventValues.Put(CalendarContract.Events.InterfaceConsts.Availability, 0); eventValues.Put(CalendarContract.Events.InterfaceConsts.Availability, 0);
eventValues.Put(CalendarContract.Events.InterfaceConsts.HasAlarm, data.Reminder.HasValue); eventValues.Put(CalendarContract.Events.InterfaceConsts.HasAlarm, 1);
eventValues.Put(CalendarContract.Events.InterfaceConsts.Dtstart, item.StartTime.ToUnixTime()); eventValues.Put(CalendarContract.Events.InterfaceConsts.Dtstart, item.StartTime.ToUnixTime());
eventValues.Put(CalendarContract.Events.InterfaceConsts.Dtend, Extensions.ToUnixTime(item.EndTime)); eventValues.Put(CalendarContract.Events.InterfaceConsts.Dtend, Extensions.ToUnixTime(item.EndTime));
eventValues.Put(CalendarContract.Events.InterfaceConsts.EventTimezone, TimeZone.Default.ID); eventValues.Put(CalendarContract.Events.InterfaceConsts.EventTimezone, TimeZone.Default.ID);
eventValues.Put(CalendarContract.Events.InterfaceConsts.EventEndTimezone, TimeZone.Default.ID); eventValues.Put(CalendarContract.Events.InterfaceConsts.EventEndTimezone, TimeZone.Default.ID);
eventValues.Put(CalendarContract.Reminders.InterfaceConsts.CustomAppPackage, "bonch.schedule"); eventValues.Put(CalendarContract.Events.InterfaceConsts.CustomAppPackage, Application.Context.PackageName);
Uri response = Application.Context.ContentResolver.Insert(CalendarContract.Events.ContentUri, eventValues); Uri response = Application.Context.ContentResolver.Insert(CalendarContract.Events.ContentUri, eventValues);
// Settings reminder
Android.Content.ContentValues reminderValues = new Android.Content.ContentValues(); Android.Content.ContentValues reminderValues = new Android.Content.ContentValues();
reminderValues.Put(CalendarContract.Reminders.InterfaceConsts.EventId, long.Parse(response.LastPathSegment)); reminderValues.Put(CalendarContract.Reminders.InterfaceConsts.EventId, long.Parse(response.LastPathSegment));
reminderValues.Put(CalendarContract.Reminders.InterfaceConsts.CustomAppPackage, "bonch.schedule"); reminderValues.Put(CalendarContract.Reminders.InterfaceConsts.Minutes, data.Reminder);
// Fuck Android!
reminderValues.Put(CalendarContract.Reminders.InterfaceConsts.Minutes, data.Reminder?.ToString());
// P.S. I mean fuck Android!
Application.Context.ContentResolver.Insert(CalendarContract.Reminders.ContentUri, reminderValues); Application.Context.ContentResolver.Insert(CalendarContract.Reminders.ContentUri, reminderValues);
// TODO: Add ability to completely disable reminders
// Fuck Android!
// P.S. I mean fuck Android!
} }
} }
} }
+1 -1
View File
@@ -6,7 +6,7 @@
public string Faculty { get; set; } public string Faculty { get; set; }
public int Course { get; set; } public int Course { get; set; }
public string Group { get; set; } public string Group { get; set; }
public int? Reminder { get; set; } public int Reminder { get; set; }
public bool AddGroupToTitle { get; set; } public bool AddGroupToTitle { get; set; }
} }
} }
@@ -136,6 +136,11 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="(i) На данный момент полное отключение уведомлений не поддерживается"/>
<CheckBox <CheckBox
android:id="@+id/groupTitle" android:id="@+id/groupTitle"
android:layout_width="match_parent" android:layout_width="match_parent"