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

Added ability to disable reminders

This commit is contained in:
Michael Gordeev
2020-01-06 16:47:17 +03:00
parent 5059bfc4ec
commit 48f7fab872
3 changed files with 14 additions and 20 deletions
@@ -35,7 +35,7 @@ namespace GUT.Schedule
course.SetList(this, "1234".ToCharArray());
reminder.SetList(this, new string[]
{
//"Нет",
"Нет",
"Во время начала",
"За 5 мин",
"За 10 мин"
@@ -65,13 +65,7 @@ namespace GUT.Schedule
Course = course.SelectedItemPosition + 1,
AddGroupToTitle = groupTitle.Checked,
Calendar = Calendar.Calendars[calendar.SelectedItemPosition].Id,
Reminder = reminder.SelectedItemPosition * 5 /*switch
{
1 => 0,
2 => 5,
3 => 10,
_ => null
}*/
Reminder = (reminder.SelectedItemPosition - 1) * 5
};
StartActivity(new Intent(this, typeof(ExportActivity)));
+9 -9
View File
@@ -62,7 +62,8 @@ namespace GUT.Schedule
eventValues.Put(CalendarContract.Events.InterfaceConsts.Availability, 0);
eventValues.Put(CalendarContract.Events.InterfaceConsts.HasAlarm, 1);
eventValues.Put(CalendarContract.Events.InterfaceConsts.HasAlarm, data.Reminder != -5);
// For some reason Google calendars ignore HasAlarm = false and set reminder for 30 minutes. Local calendars don't seem to have this issue
eventValues.Put(CalendarContract.Events.InterfaceConsts.Dtstart, item.StartTime.ToUnixTime());
eventValues.Put(CalendarContract.Events.InterfaceConsts.Dtend, Extensions.ToUnixTime(item.EndTime));
@@ -74,15 +75,14 @@ namespace GUT.Schedule
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.Minutes, data.Reminder);
if(data.Reminder != -5)
{
Android.Content.ContentValues reminderValues = new Android.Content.ContentValues();
reminderValues.Put(CalendarContract.Reminders.InterfaceConsts.EventId, long.Parse(response.LastPathSegment));
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!
Application.Context.ContentResolver.Insert(CalendarContract.Reminders.ContentUri, reminderValues);
}
}
}
}
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
@@ -138,7 +138,7 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="(i) На данный момент полное отключение уведомлений не поддерживается"/>
android:text="(i) При экспорте расписания в Google календарь (не локальный) с отключенными уведомлениями, Google автоматически поставит уведомление за 30 минут"/>
<CheckBox
android:id="@+id/groupTitle"
@@ -174,7 +174,7 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="©2019 Михаил Гордеев ИКСС, ИКТ-907"
android:text="©2020 Михаил Гордеев ИКСС, ИКТ-907"
android:layout_marginBottom="50dp"/>
</LinearLayout>
</ScrollView>