From ce18a134531645a57661f6429b084c4b29938bf7 Mon Sep 17 00:00:00 2001 From: scuPulos <44333074+scuPulos@users.noreply.github.com> Date: Thu, 25 Oct 2018 20:41:16 -0700 Subject: [PATCH 01/11] Initial commit Created a basic layout of things like main classes for the MVP. As far as testing/interface goes it just shows the name of the most recent chore you entered. --- Chore.cs | 70 +++++++++++++++++++++++++++++++++++++++++ Group.cs | 78 ++++++++++++++++++++++++++++++++++++++++++++++ MainActivity.cs | 44 ++++++++++++++++++++++++++ TaskList.cs | 38 ++++++++++++++++++++++ Timestamp.cs | 66 +++++++++++++++++++++++++++++++++++++++ User.cs | 38 ++++++++++++++++++++++ activity_main.axml | 50 +++++++++++++++++++++++++++++ 7 files changed, 384 insertions(+) create mode 100644 Chore.cs create mode 100644 Group.cs create mode 100644 MainActivity.cs create mode 100644 TaskList.cs create mode 100644 Timestamp.cs create mode 100644 User.cs create mode 100644 activity_main.axml diff --git a/Chore.cs b/Chore.cs new file mode 100644 index 0000000..ab5e06e --- /dev/null +++ b/Chore.cs @@ -0,0 +1,70 @@ +using TimeSpace; + +namespace ChoreSpace +{ + public class Chore + { + int choreId; + string choreName; + int assignedUserId; + int completedUserId; + Timestamp deadlineTimestamp; + Timestamp completedTimestamp; + bool isPriority; + bool isCompleted; + + //constructor + public Chore(string name, int passedUserId, string deadline) + { + isCompleted = false; + completedUserId = -1; + completedTimestamp = new Timestamp(); + + choreName = name; + choreId = generateChoreId(); + assignedUserId = passedUserId; + deadlineTimestamp = new Timestamp(deadline); + } + + int generateChoreId() + { + //TODO: fetch greatest chore id and increment by 1 + return 0; + } + + public void MarkPriority() + { + isPriority = true; + } + + public void MarkComplete() + { + //TODO: get the Id of the user who marked it complete and assign it + completedUserId = assignedUserId; + completedTimestamp = new Timestamp().CurrentTimestamp(); + isCompleted = true; + } + + public int AssignUser(int passedUserId) + { + assignedUserId = passedUserId; + return (assignedUserId); + } + + public Timestamp UpdateDeadline(string deadline) + { + deadlineTimestamp = new Timestamp(deadline); + return deadlineTimestamp; + } + + public bool CheckId(int keyId) + { + return (keyId == choreId); + } + + public string GetName() + { + return (choreName); + } + } +} \ No newline at end of file diff --git a/Group.cs b/Group.cs new file mode 100644 index 0000000..7f20cd1 --- /dev/null +++ b/Group.cs @@ -0,0 +1,78 @@ +using System.Collections.Generic; +using UserSpace; +using TaskSpace; +using ChoreSpace; + +namespace GroupSpace +{ + class Group + { + int groupId; + string groupName; + bool valid; + + List users; + TaskList tasks; + + public Group() + { + groupId = 0; + groupName = "Fake"; + valid = false; + } + + public bool AssignGroup(int groupId) + { + //TODO: + //Fetch Grouup data corresponding to groupId + //Assign data values to group + valid = true; + //return false if group was not created or true if it was + return false; + } + + public bool AssignGroup(string groupName) + { + //TODO: + //Fetch Grouup data corresponding to groupName + //Assign data values to group + valid = true; + //return false if group was not created or true if it was + return false; + } + + public Group GenerateNew(string Name) + { + //Add a new group to the database with name Name + //Add the local user to the group's list of users + return (new Group()); + } + + public Group GenerateTestGroup() + { + groupId = 0; + groupName = "Best_Group"; + valid = true; + users = new List(); + tasks = new TaskList(); + return this; + } + + public User AddUser(User passedUser) + { + users.Add(passedUser); + return (passedUser); + } + + public Chore AddChore(Chore chore) + { + tasks.AddChore(chore); + return chore; + } + + public TaskList GetTaskList() + { + return(tasks); + } + } +} \ No newline at end of file diff --git a/MainActivity.cs b/MainActivity.cs new file mode 100644 index 0000000..4ba92c5 --- /dev/null +++ b/MainActivity.cs @@ -0,0 +1,44 @@ +using Android.App; +using Android.OS; +using Android.Support.V7.App; +using Android.Runtime; +using Android.Widget; +using UserSpace; +using GroupSpace; +using ChoreSpace; + +namespace ChoreChomper +{ + [Activity(Label = "@string/app_name", Theme = "@style/AppTheme", MainLauncher = true)] + public class MainActivity : AppCompatActivity + { + protected override void OnCreate(Bundle savedInstanceState) + { + base.OnCreate(savedInstanceState); + // Set our view from the "main" layout resource + SetContentView(Resource.Layout.activity_main); + + EditText choreNameText = FindViewById(Resource.Id.editChoreName); + TextView choreNameView = FindViewById(Resource.Id.textChoreDisp); + Button addButton = FindViewById