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());
reminder.SetList(this, new string[]
{
"Нет",
//"Нет",
"Во время начала",
"За 5 мин",
"За 10 мин"
@@ -65,13 +65,13 @@ namespace GUT.Schedule
Course = course.SelectedItemPosition + 1,
AddGroupToTitle = groupTitle.Checked,
Calendar = Calendar.Calendars[calendar.SelectedItemPosition].Id,
Reminder = reminder.SelectedItemPosition switch
Reminder = reminder.SelectedItemPosition * 5 /*switch
{
1 => 0,
2 => 5,
3 => 10,
_ => null
}
}*/
};
StartActivity(new Intent(this, typeof(ExportActivity)));
+10 -8
View File
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Android.App;
using Android.Database;
using Android.Net;
@@ -45,7 +46,7 @@ namespace GUT.Schedule
}
public static void Export(IEnumerable<Subject> schedule)
public static void Export(IEnumerable<Subject> schedule)
{
DataSet data = Data.DataSet;
@@ -66,26 +67,27 @@ namespace GUT.Schedule
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.Dtend, Extensions.ToUnixTime(item.EndTime));
eventValues.Put(CalendarContract.Events.InterfaceConsts.EventTimezone, 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);
// Settings reminder
Android.Content.ContentValues reminderValues = new Android.Content.ContentValues();
reminderValues.Put(CalendarContract.Reminders.InterfaceConsts.EventId, long.Parse(response.LastPathSegment));
reminderValues.Put(CalendarContract.Reminders.InterfaceConsts.CustomAppPackage, "bonch.schedule");
// Fuck Android!
reminderValues.Put(CalendarContract.Reminders.InterfaceConsts.Minutes, data.Reminder?.ToString());
// P.S. I mean fuck Android!
reminderValues.Put(CalendarContract.Reminders.InterfaceConsts.Minutes, data.Reminder);
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 int Course { get; set; }
public string Group { get; set; }
public int? Reminder { get; set; }
public int Reminder { get; set; }
public bool AddGroupToTitle { get; set; }
}
}
@@ -136,6 +136,11 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="(i) На данный момент полное отключение уведомлений не поддерживается"/>
<CheckBox
android:id="@+id/groupTitle"
android:layout_width="match_parent"