From 66bf57c7d08c41e1554f83069596eead994ab43e Mon Sep 17 00:00:00 2001 From: Michael Gordeev Date: Sun, 22 Dec 2019 17:41:15 +0300 Subject: [PATCH] Implemented date range filter, code cleanup --- .../{ => Activities}/ExportActivity.cs | 25 ++--- .../{ => Activities}/MainActivity.cs | 75 ++++++++------- .../{ => Activities}/StartActivity.cs | 15 ++- .../GUT.Schedule/Assets/AboutAssets.txt | 19 ---- GUT.Schedule/GUT.Schedule/Calendar.cs | 92 +++++++++++-------- .../GUT.Schedule/DatePickerFragment.cs | 40 -------- GUT.Schedule/GUT.Schedule/Extensions.cs | 21 +++++ .../Fragments/DatePickerFragment.cs | 43 +++++++++ GUT.Schedule/GUT.Schedule/GUT.Schedule.csproj | 15 ++- .../GUT.Schedule/{ => Models}/Data.cs | 17 ++-- .../GUT.Schedule/{ => Models}/Subject.cs | 2 +- .../GUT.Schedule/Resources/AboutResources.txt | 44 --------- .../GUT.Schedule/Resources/menu/menu_main.xml | 1 - .../mipmap-anydpi-v26/ic_launcher.xml | 2 +- .../mipmap-anydpi-v26/ic_launcher_round.xml | 2 +- 15 files changed, 201 insertions(+), 212 deletions(-) rename GUT.Schedule/GUT.Schedule/{ => Activities}/ExportActivity.cs (54%) rename GUT.Schedule/GUT.Schedule/{ => Activities}/MainActivity.cs (74%) rename GUT.Schedule/GUT.Schedule/{ => Activities}/StartActivity.cs (83%) delete mode 100644 GUT.Schedule/GUT.Schedule/Assets/AboutAssets.txt delete mode 100644 GUT.Schedule/GUT.Schedule/DatePickerFragment.cs create mode 100644 GUT.Schedule/GUT.Schedule/Fragments/DatePickerFragment.cs rename GUT.Schedule/GUT.Schedule/{ => Models}/Data.cs (50%) rename GUT.Schedule/GUT.Schedule/{ => Models}/Subject.cs (98%) delete mode 100644 GUT.Schedule/GUT.Schedule/Resources/AboutResources.txt diff --git a/GUT.Schedule/GUT.Schedule/ExportActivity.cs b/GUT.Schedule/GUT.Schedule/Activities/ExportActivity.cs similarity index 54% rename from GUT.Schedule/GUT.Schedule/ExportActivity.cs rename to GUT.Schedule/GUT.Schedule/Activities/ExportActivity.cs index 46dda66..7a92734 100644 --- a/GUT.Schedule/GUT.Schedule/ExportActivity.cs +++ b/GUT.Schedule/GUT.Schedule/Activities/ExportActivity.cs @@ -1,14 +1,20 @@ using Android.App; using Android.OS; using Android.Widget; +using GUT.Schedule.Models; +using System.Collections.Generic; using System.Threading.Tasks; namespace GUT.Schedule { + /// + /// Shows status of schedule export process + /// [Activity(Theme = "@style/AppTheme.NoActionBar")] public class ExportActivity : Activity { TextView status; + protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); @@ -17,24 +23,19 @@ namespace GUT.Schedule status = FindViewById(Resource.Id.status); status.Text = "Загрузка расписания"; - await Parser.LoadSchedule(); + List schedule = await Parser.LoadSchedule(); + + schedule = schedule.FindAll(i => i.StartTime.Date >= Data.StartDate && i.StartTime.Date <= Data.EndDate); // Filtering schedule according to export range status.Text = "Экспортирование в календарь"; - int minutes = Data.Reminder switch - { - 1 => 0, - 2 => 5, - 3 => 10, - _ => -1 - }; - Calendar.Export(Data.Calendars[Data.Calendar].Id, Data.Schedule, minutes < 0 ? (int?)null : minutes, Data.AddTitle); + Calendar.Export(schedule); + status.Text = "Готово"; - await Task.Delay(3000); - base.OnBackPressed(); + base.OnBackPressed(); // Navigates back to main activity (always because I don't allow backward navigation) } - public override void OnBackPressed() { } + public override void OnBackPressed() { } // Disables back button } } \ No newline at end of file diff --git a/GUT.Schedule/GUT.Schedule/MainActivity.cs b/GUT.Schedule/GUT.Schedule/Activities/MainActivity.cs similarity index 74% rename from GUT.Schedule/GUT.Schedule/MainActivity.cs rename to GUT.Schedule/GUT.Schedule/Activities/MainActivity.cs index d04b49e..7e30e97 100644 --- a/GUT.Schedule/GUT.Schedule/MainActivity.cs +++ b/GUT.Schedule/GUT.Schedule/Activities/MainActivity.cs @@ -6,6 +6,7 @@ using Android.OS; using Android.Support.V7.App; using Android.Views; using Android.Widget; +using GUT.Schedule.Models; namespace GUT.Schedule { @@ -25,9 +26,9 @@ namespace GUT.Schedule AssignVariables(); AddEvents(); + // Settings spinners' dropdown lists content faculty.SetList(this, Data.Faculties.Select(i => i.Name)); - course.SetList(this, "12345".ToCharArray()); - + course.SetList(this, "1234".ToCharArray()); reminder.SetList(this, new string[] { "Нет", @@ -35,30 +36,12 @@ namespace GUT.Schedule "За 5 мин", "За 10 мин" }); - calendar.SetList(this, Data.Calendars.Select(i => i.Name)); + calendar.SetList(this, Calendar.Calendars.Select(i => i.Name)); end.Text = Data.EndDate.ToShortDateString(); start.Text = Data.StartDate.ToShortDateString(); } - public override bool OnCreateOptionsMenu(IMenu menu) - { - MenuInflater.Inflate(Resource.Menu.menu_main, menu); - return true; - } - - public override bool OnOptionsItemSelected(IMenuItem item) - { - int id = item.ItemId; - if (id == Resource.Id.github) - { - StartActivity(new Intent(Intent.ActionView, Android.Net.Uri.Parse("https://github.com/xfox111/GUTSchedule"))); - return true; - } - - return base.OnOptionsItemSelected(item); - } - private void Export_Click(object sender, EventArgs e) { error.Visibility = ViewStates.Gone; @@ -69,26 +52,35 @@ namespace GUT.Schedule error.Visibility = ViewStates.Visible; } - Data.Faculty = faculty.SelectedItemPosition; - Data.Group = group.SelectedItemPosition; - Data.Course = course.SelectedItemPosition + 1; - Data.Reminder = reminder.SelectedItemPosition; - Data.AddTitle = groupTitle.Checked; + // Forming export parameters + Data.DataSet = new DataSet + { + Faculty = Data.Faculties[faculty.SelectedItemPosition].Id, + Group = Data.Groups[group.SelectedItemPosition].Id, + Course = course.SelectedItemPosition + 1, + AddGroupToTitle = groupTitle.Checked, + Calendar = Calendar.Calendars[calendar.SelectedItemPosition].Id, + Reminder = reminder.SelectedItemPosition switch + { + 1 => 0, + 2 => 5, + 3 => 10, + _ => null + } + }; StartActivity(new Intent(this, typeof(ExportActivity))); } private async void End_Click(object sender, EventArgs e) { - DatePickerFragment picker = new DatePickerFragment(); - Data.EndDate = await picker.GetDate(SupportFragmentManager, "datePicker"); + Data.EndDate = await new DatePickerFragment().GetDate(SupportFragmentManager, Data.EndDate); end.Text = Data.EndDate.ToShortDateString(); } private async void Start_Click(object sender, EventArgs e) { - DatePickerFragment picker = new DatePickerFragment(); - Data.StartDate = await picker.GetDate(SupportFragmentManager, "datePicker"); + Data.StartDate = await new DatePickerFragment().GetDate(SupportFragmentManager, Data.StartDate); start.Text = Data.StartDate.ToShortDateString(); } @@ -101,8 +93,6 @@ namespace GUT.Schedule group.SetList(this, Data.Groups.Select(i => i.Name)); } - public override void OnBackPressed() { } - #region Init stuff private void AssignVariables() { @@ -131,5 +121,26 @@ namespace GUT.Schedule export.Click += Export_Click; } #endregion + + #region Menu stuff + public override bool OnCreateOptionsMenu(IMenu menu) + { + MenuInflater.Inflate(Resource.Menu.menu_main, menu); + return true; + } + + public override bool OnOptionsItemSelected(IMenuItem item) + { + if (item.ItemId == Resource.Id.github) + { + StartActivity(new Intent(Intent.ActionView, Android.Net.Uri.Parse("https://github.com/xfox111/GUTSchedule"))); + return true; + } + + return base.OnOptionsItemSelected(item); + } + #endregion + + public override void OnBackPressed() { } // Disables back button } } \ No newline at end of file diff --git a/GUT.Schedule/GUT.Schedule/StartActivity.cs b/GUT.Schedule/GUT.Schedule/Activities/StartActivity.cs similarity index 83% rename from GUT.Schedule/GUT.Schedule/StartActivity.cs rename to GUT.Schedule/GUT.Schedule/Activities/StartActivity.cs index 6b877d7..039f2ca 100644 --- a/GUT.Schedule/GUT.Schedule/StartActivity.cs +++ b/GUT.Schedule/GUT.Schedule/Activities/StartActivity.cs @@ -13,6 +13,9 @@ using System.Net.Http; namespace GUT.Schedule { + /// + /// Splash screen activity. Loads init data + /// [Activity(MainLauncher = true, Theme = "@style/AppTheme.NoActionBar")] public class StartActivity : AppCompatActivity { @@ -40,7 +43,7 @@ namespace GUT.Schedule private async void Proceed() { - status.Text = "Загрузка списка доступных для записи календарей"; + status.Text = "Загрузка списка календарей"; Calendar.LoadCalendars(); status.Text = "Загрузка списка факультетов"; @@ -56,6 +59,7 @@ namespace GUT.Schedule public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Permission[] grantResults) { base.OnRequestPermissionsResult(requestCode, permissions, grantResults); + if (grantResults.All(i => i == Permission.Granted)) Proceed(); else @@ -63,10 +67,11 @@ namespace GUT.Schedule } private void RequestPermissions() => - ActivityCompat.RequestPermissions(this, new string[] + ActivityCompat.RequestPermissions(this, new[] { - Manifest.Permission.ReadCalendar, Manifest.Permission.WriteCalendar - }, 76); + Manifest.Permission.ReadCalendar, + Manifest.Permission.WriteCalendar + }, 76); // IDK why I need requestCode value to be set (instead of 76 there can be any other number. Anyway it doesn't affect anything) private void ShowDialog() { @@ -79,6 +84,6 @@ namespace GUT.Schedule dialog.Show(); } - public override void OnBackPressed() { } + public override void OnBackPressed() { } // Disables back button } } \ No newline at end of file diff --git a/GUT.Schedule/GUT.Schedule/Assets/AboutAssets.txt b/GUT.Schedule/GUT.Schedule/Assets/AboutAssets.txt deleted file mode 100644 index dcb0409..0000000 --- a/GUT.Schedule/GUT.Schedule/Assets/AboutAssets.txt +++ /dev/null @@ -1,19 +0,0 @@ -Any raw assets you want to be deployed with your application can be placed in -this directory (and child directories) and given a Build Action of "AndroidAsset". - -These files will be deployed with your package and will be accessible using Android's -AssetManager, like this: - -public class ReadAsset : Activity -{ - protected override void OnCreate (Bundle bundle) - { - base.OnCreate (bundle); - - InputStream input = Assets.Open ("my_asset.txt"); - } -} - -Additionally, some Android functions will automatically load asset files: - -Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); \ No newline at end of file diff --git a/GUT.Schedule/GUT.Schedule/Calendar.cs b/GUT.Schedule/GUT.Schedule/Calendar.cs index 1657cb1..a8b311f 100644 --- a/GUT.Schedule/GUT.Schedule/Calendar.cs +++ b/GUT.Schedule/GUT.Schedule/Calendar.cs @@ -1,21 +1,30 @@ using System.Collections.Generic; using Android.App; -using Android.Content; using Android.Database; using Android.Net; using Android.Provider; using Android.Support.V4.Content; +using GUT.Schedule.Models; using Java.Util; namespace GUT.Schedule { public static class Calendar { + /// + /// List of all existing Google calendars on the device + /// + public static List<(string Id, string Name)> Calendars { get; private set; } = new List<(string Id, string Name)>(); + + /// + /// Retrieves all Google Accounts' calendars existing on the device and puts them to + /// public static void LoadCalendars() { - Data.Calendars = new List<(string, string)>(); + Calendars = new List<(string, string)>(); // Resetting current calendars list - var calendarsUri = CalendarContract.Calendars.ContentUri; + // Building calendar data retrieval projections + Uri calendarsUri = CalendarContract.Calendars.ContentUri; string[] calendarsProjection = { CalendarContract.Calendars.InterfaceConsts.Id, CalendarContract.Calendars.InterfaceConsts.CalendarDisplayName, @@ -24,54 +33,61 @@ namespace GUT.Schedule CalendarContract.Calendars.InterfaceConsts.AccountType, }; - using Android.Support.V4.Content.CursorLoader loader = new Android.Support.V4.Content.CursorLoader(Application.Context, calendarsUri, calendarsProjection, null, null, null); + // Retrieving calendars data + using CursorLoader loader = new CursorLoader(Application.Context, calendarsUri, calendarsProjection, null, null, null); ICursor cursor = (ICursor)loader.LoadInBackground(); cursor.MoveToNext(); for (int i = 0; i < cursor.Count; i++) { - if (cursor.GetString(4) == "com.google" && !cursor.GetString(3).Contains("google")) - Data.Calendars.Add((cursor.GetString(0), $"{cursor.GetString(1)} ({cursor.GetString(2)})")); + if (cursor.GetString(4) == "com.google" && !cursor.GetString(3).Contains("google")) // Loading only users' main calendars + Calendars.Add((cursor.GetString(0), $"{cursor.GetString(1)} ({cursor.GetString(2)})")); cursor.MoveToNext(); } } - public static void Export(string calendarId, IEnumerable schedule, int? remindBefore, bool addGroupToTitle) + + public static void Export(IEnumerable schedule) { + DataSet data = Data.DataSet; + foreach (Subject item in schedule) - AddEvent(calendarId, item, remindBefore, addGroupToTitle); - } - - static void AddEvent(string calendarId, Subject subject, int? reminderMinutes, bool addHeader) - { - ContentValues eventValues = new ContentValues(); - - eventValues.Put(CalendarContract.Events.InterfaceConsts.CalendarId, calendarId); - eventValues.Put(CalendarContract.Events.InterfaceConsts.Title, $"{subject.Order}.{(addHeader ? $" [{subject.Group}]" : "")} {subject.Name} ({subject.Type})"); - eventValues.Put(CalendarContract.Events.InterfaceConsts.Description, subject.Professor); - eventValues.Put(CalendarContract.Events.InterfaceConsts.EventLocation, string.Join(';', subject.Cabinets)); - - eventValues.Put(CalendarContract.Events.InterfaceConsts.Availability, 0); - - if(reminderMinutes.HasValue) - eventValues.Put(CalendarContract.Events.InterfaceConsts.HasAlarm, true); - - eventValues.Put(CalendarContract.Events.InterfaceConsts.Dtstart, subject.StartTime.ToUnixTime()); - eventValues.Put(CalendarContract.Events.InterfaceConsts.Dtend, Extensions.ToUnixTime(subject.EndTime)); - - eventValues.Put(CalendarContract.Events.InterfaceConsts.EventTimezone, TimeZone.Default.ID); - eventValues.Put(CalendarContract.Events.InterfaceConsts.EventEndTimezone, TimeZone.Default.ID); - - Uri response = Application.Context.ContentResolver.Insert(CalendarContract.Events.ContentUri, eventValues); - - if (reminderMinutes.HasValue) { - ContentValues reminderValues = new ContentValues(); - reminderValues.Put(CalendarContract.Reminders.InterfaceConsts.EventId, long.Parse(response.LastPathSegment)); - reminderValues.Put(CalendarContract.Reminders.InterfaceConsts.Method, 1); - reminderValues.Put(CalendarContract.Reminders.InterfaceConsts.Minutes, reminderMinutes.Value); + Android.Content.ContentValues eventValues = new Android.Content.ContentValues(); - Application.Context.ContentResolver.Insert(CalendarContract.Reminders.ContentUri, reminderValues); + eventValues.Put(CalendarContract.Events.InterfaceConsts.CalendarId, data.Calendar); + + eventValues.Put(CalendarContract.Events.InterfaceConsts.Title, string.Format("{0}.{1} {2} ({3})", + item.Order, + data.AddGroupToTitle ? $" [{item.Group}]" : "", + item.Name, + item.Type)); + + eventValues.Put(CalendarContract.Events.InterfaceConsts.Description, string.Join(';', item.Professor)); + eventValues.Put(CalendarContract.Events.InterfaceConsts.EventLocation, string.Join(';', item.Cabinets)); + + eventValues.Put(CalendarContract.Events.InterfaceConsts.Availability, 0); + + if (data.Reminder.HasValue) + eventValues.Put(CalendarContract.Events.InterfaceConsts.HasAlarm, true); + + 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); + + Uri response = Application.Context.ContentResolver.Insert(CalendarContract.Events.ContentUri, eventValues); + + if (data.Reminder.HasValue) + { + Android.Content.ContentValues reminderValues = new Android.Content.ContentValues(); + reminderValues.Put(CalendarContract.Reminders.InterfaceConsts.EventId, long.Parse(response.LastPathSegment)); + reminderValues.Put(CalendarContract.Reminders.InterfaceConsts.Method, 1); + reminderValues.Put(CalendarContract.Reminders.InterfaceConsts.Minutes, data.Reminder.Value); + + Application.Context.ContentResolver.Insert(CalendarContract.Reminders.ContentUri, reminderValues); + } } } } diff --git a/GUT.Schedule/GUT.Schedule/DatePickerFragment.cs b/GUT.Schedule/GUT.Schedule/DatePickerFragment.cs deleted file mode 100644 index 3886b49..0000000 --- a/GUT.Schedule/GUT.Schedule/DatePickerFragment.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using Android.OS; -using Android.Widget; -using Android.Support.V4.App; -using System.Threading.Tasks; - -namespace GUT.Schedule -{ - public class DatePickerFragment : DialogFragment, Android.App.DatePickerDialog.IOnDateSetListener - { - DateTime date; - bool dismissed = false; - public override Android.App.Dialog OnCreateDialog(Bundle savedInstanceState) - { - DateTime now = DateTime.Today; - return new Android.App.DatePickerDialog(Activity, this, now.Year, now.Month - 1, now.Day); - } - - public void OnDateSet(DatePicker view, int year, int month, int dayOfMonth) - { - SetDate(view.DateTime); - } - - public async Task GetDate(FragmentManager manager, string tag) - { - Show(manager, tag); - - while (!dismissed) - await Task.Delay(500); - - return date; - } - - private void SetDate(DateTime date) - { - this.date = date; - dismissed = true; - } - } -} \ No newline at end of file diff --git a/GUT.Schedule/GUT.Schedule/Extensions.cs b/GUT.Schedule/GUT.Schedule/Extensions.cs index 3483b87..627a2dd 100644 --- a/GUT.Schedule/GUT.Schedule/Extensions.cs +++ b/GUT.Schedule/GUT.Schedule/Extensions.cs @@ -8,11 +8,25 @@ namespace GUT.Schedule { public static class Extensions { + /// + /// Sets array as Spinner dropdown list content + /// + /// Array items type + /// Spinner on which array will be assigned to + /// Current activity context. In most common cases this will do + /// Array of items to be displayed public static void SetList(this Spinner spinner, Context context, IEnumerable array) { ArrayAdapter adapter = new ArrayAdapter(context, Resource.Layout.support_simple_spinner_dropdown_item, array.ToList()); spinner.Adapter = adapter; } + + /// + /// Returns instance based on study week number, weekday and semester start day number + /// + /// Number of the study week + /// Weekday + /// instance based on study week number, weekday and semester start day number public static DateTime GetDateFromWeeks(int week, int weekday) { DateTime dt = new DateTime(DateTime.Today.Year, 9, Data.FirstWeekDay); @@ -22,6 +36,13 @@ namespace GUT.Schedule return dt; } + + /// + /// Converts to milliseconds count + /// + /// In the nearest future we will be fucked because of that shit + /// which is to be converted to UNIX time + /// which is represented by total milliseconds count passed since 1970 public static long ToUnixTime(this DateTime dt) => (long)dt.ToUniversalTime().Subtract(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds; } diff --git a/GUT.Schedule/GUT.Schedule/Fragments/DatePickerFragment.cs b/GUT.Schedule/GUT.Schedule/Fragments/DatePickerFragment.cs new file mode 100644 index 0000000..261afbf --- /dev/null +++ b/GUT.Schedule/GUT.Schedule/Fragments/DatePickerFragment.cs @@ -0,0 +1,43 @@ +using System; +using Android.OS; +using Android.Widget; +using Android.App; +using System.Threading.Tasks; + +namespace GUT.Schedule +{ + /// + /// Date picker + /// + public class DatePickerFragment : Android.Support.V4.App.DialogFragment, DatePickerDialog.IOnDateSetListener + { + DateTime _date; + bool dismissed = false; + public override Dialog OnCreateDialog(Bundle savedInstanceState) => + new DatePickerDialog(Activity, this, _date.Year, _date.Month - 1, _date.Day); + + // Occures when user selected a date + public void OnDateSet(DatePicker view, int year, int month, int dayOfMonth) + { + _date = view.DateTime; + dismissed = true; + } + + /// + /// Shows date picker and waits for user input + /// + /// Fragment manager of the current activity (In most common cases it is this.FragmentManager) + /// Date which is to be selected by default + /// picked by user + public async Task GetDate(Android.Support.V4.App.FragmentManager manager, DateTime date) + { + _date = date; + Show(manager, "datePicker"); + + while (!dismissed) + await Task.Delay(100); + + return date; + } + } +} \ No newline at end of file diff --git a/GUT.Schedule/GUT.Schedule/GUT.Schedule.csproj b/GUT.Schedule/GUT.Schedule/GUT.Schedule.csproj index 41bd59f..58d685d 100644 --- a/GUT.Schedule/GUT.Schedule/GUT.Schedule.csproj +++ b/GUT.Schedule/GUT.Schedule/GUT.Schedule.csproj @@ -60,21 +60,20 @@ - - - + + + - + + - - + + - - diff --git a/GUT.Schedule/GUT.Schedule/Data.cs b/GUT.Schedule/GUT.Schedule/Models/Data.cs similarity index 50% rename from GUT.Schedule/GUT.Schedule/Data.cs rename to GUT.Schedule/GUT.Schedule/Models/Data.cs index 94e6ec0..ea1db7f 100644 --- a/GUT.Schedule/GUT.Schedule/Data.cs +++ b/GUT.Schedule/GUT.Schedule/Models/Data.cs @@ -1,4 +1,5 @@ -using System; +using GUT.Schedule.Models; +using System; using System.Collections.Generic; namespace GUT.Schedule @@ -7,17 +8,13 @@ namespace GUT.Schedule { public static List<(string Id, string Name)> Faculties { get; set; } public static List<(string Id, string Name)> Groups { get; set; } - public static List<(string Id, string Name)> Calendars { get; set; } - public static List Schedule { get; set; } public static int FirstWeekDay { get; set; } public static DateTime StartDate { get; set; } = DateTime.Today; public static DateTime EndDate { get; set; } = DateTime.Today.AddDays(7); - - public static int Faculty { get; set; } - public static int Group { get; set; } - public static int Course { get; set; } - public static int Calendar { get; set; } - public static int Reminder { get; set; } - public static bool AddTitle { get; set; } + + /// + /// Export parameters + /// + public static DataSet DataSet { get; set; } } } \ No newline at end of file diff --git a/GUT.Schedule/GUT.Schedule/Subject.cs b/GUT.Schedule/GUT.Schedule/Models/Subject.cs similarity index 98% rename from GUT.Schedule/GUT.Schedule/Subject.cs rename to GUT.Schedule/GUT.Schedule/Models/Subject.cs index 671f0df..b43f1d1 100644 --- a/GUT.Schedule/GUT.Schedule/Subject.cs +++ b/GUT.Schedule/GUT.Schedule/Models/Subject.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace GUT.Schedule +namespace GUT.Schedule.Models { public class Subject { diff --git a/GUT.Schedule/GUT.Schedule/Resources/AboutResources.txt b/GUT.Schedule/GUT.Schedule/Resources/AboutResources.txt deleted file mode 100644 index 096447a..0000000 --- a/GUT.Schedule/GUT.Schedule/Resources/AboutResources.txt +++ /dev/null @@ -1,44 +0,0 @@ -Images, layout descriptions, binary blobs and string dictionaries can be included -in your application as resource files. Various Android APIs are designed to -operate on the resource IDs instead of dealing with images, strings or binary blobs -directly. - -For example, a sample Android app that contains a user interface layout (main.xml), -an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) -would keep its resources in the "Resources" directory of the application: - -Resources/ - drawable/ - icon.png - - layout/ - main.xml - - values/ - strings.xml - -In order to get the build system to recognize Android resources, set the build action to -"AndroidResource". The native Android APIs do not operate directly with filenames, but -instead operate on resource IDs. When you compile an Android application that uses resources, -the build system will package the resources for distribution and generate a class called "R" -(this is an Android convention) that contains the tokens for each one of the resources -included. For example, for the above Resources layout, this is what the R class would expose: - -public class R { - public class drawable { - public const int icon = 0x123; - } - - public class layout { - public const int main = 0x456; - } - - public class strings { - public const int first_string = 0xabc; - public const int second_string = 0xbcd; - } -} - -You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main -to reference the layout/main.xml file, or R.strings.first_string to reference the first -string in the dictionary file values/strings.xml. \ No newline at end of file diff --git a/GUT.Schedule/GUT.Schedule/Resources/menu/menu_main.xml b/GUT.Schedule/GUT.Schedule/Resources/menu/menu_main.xml index 266ff59..4683e8e 100644 --- a/GUT.Schedule/GUT.Schedule/Resources/menu/menu_main.xml +++ b/GUT.Schedule/GUT.Schedule/Resources/menu/menu_main.xml @@ -3,7 +3,6 @@ xmlns:tools="http://schemas.android.com/tools"> diff --git a/GUT.Schedule/GUT.Schedule/Resources/mipmap-anydpi-v26/ic_launcher.xml b/GUT.Schedule/GUT.Schedule/Resources/mipmap-anydpi-v26/ic_launcher.xml index 036d09b..79ac9af 100644 --- a/GUT.Schedule/GUT.Schedule/Resources/mipmap-anydpi-v26/ic_launcher.xml +++ b/GUT.Schedule/GUT.Schedule/Resources/mipmap-anydpi-v26/ic_launcher.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/GUT.Schedule/GUT.Schedule/Resources/mipmap-anydpi-v26/ic_launcher_round.xml b/GUT.Schedule/GUT.Schedule/Resources/mipmap-anydpi-v26/ic_launcher_round.xml index 036d09b..79ac9af 100644 --- a/GUT.Schedule/GUT.Schedule/Resources/mipmap-anydpi-v26/ic_launcher_round.xml +++ b/GUT.Schedule/GUT.Schedule/Resources/mipmap-anydpi-v26/ic_launcher_round.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file