+
@@ -10,7 +37,7 @@
-
+
diff --git a/.idea/modules.xml b/.idea/modules.xml
index 071f741..2f420e3 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -3,6 +3,7 @@
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 66a5a82..30e5d07 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -25,5 +25,9 @@ dependencies {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.1'
+
+ // Custom dependencies
+ compile 'joda-time:joda-time:2.9.7'
+
testCompile 'junit:junit:4.12'
}
diff --git a/app/src/main/java/com/goodenoughapps/missioncomplete/domain/Subtask.java b/app/src/main/java/com/goodenoughapps/missioncomplete/domain/Subtask.java
new file mode 100644
index 0000000..e39d7ca
--- /dev/null
+++ b/app/src/main/java/com/goodenoughapps/missioncomplete/domain/Subtask.java
@@ -0,0 +1,78 @@
+package com.goodenoughapps.missioncomplete.domain;
+
+/**
+ * Represents a subtask which may be contained within a primary Task
+ * @author Aaron Vontell
+ */
+public class Subtask {
+
+ private String title; // The text content of this subtask
+ private boolean completed; // True if this subtask should be marked as completed
+
+ public static final String TITLE_FIELD = "title";
+ public static final String COMPLETED_FIELD = "completed";
+
+ /**
+ * Creates a subtask with a given title
+ * @param title The text content of this subtask
+ * @param completed True if this subtask should be marked as completed
+ */
+ public Subtask(String title, boolean completed) {
+ this.title = title;
+ this.completed = completed;
+ }
+
+ /**
+ * Creates a subtask with the given title, defaulting to not completed
+ * Useful for creating new tasks
+ * @param title The text content of this subtask
+ */
+ public Subtask(String title) {
+ this.title = title;
+ this.completed = false;
+ }
+
+ /**
+ * Returns the content of this subtask
+ * @return the content of this subtask
+ */
+ public String getTitle() {
+ return title;
+ }
+
+ /**
+ * Returns true if this subtask is completed
+ * @return true if this subtask is completed
+ */
+ public boolean isCompleted() {
+ return completed;
+ }
+
+ /**
+ * Sets whether this subtask should be marked as completed or not
+ * @param completed true if this should be marked as completed, false otherwise
+ */
+ public void setCompleted(boolean completed) {
+ this.completed = completed;
+ }
+
+ /**
+ * Returns a JSON object representing this subtask as marked in the Schema
+ * @return The JSON representation of this subtask
+ */
+ public String getJSON() {
+ return String.format("{%s: %s,%s: %s}",
+ TITLE_FIELD, this.title, COMPLETED_FIELD, this.isCompleted());
+ }
+
+ /**
+ * Returns a string representing this task, useful for debugging purposes
+ * @return a string representing this task
+ */
+ @Override
+ public String toString() {
+ return String.format("Task \"%s\" is %s",
+ this.title, this.isCompleted() ? "completed" : "not completed");
+ }
+
+}
diff --git a/app/src/main/java/com/goodenoughapps/missioncomplete/domain/Task.java b/app/src/main/java/com/goodenoughapps/missioncomplete/domain/Task.java
new file mode 100644
index 0000000..66e0248
--- /dev/null
+++ b/app/src/main/java/com/goodenoughapps/missioncomplete/domain/Task.java
@@ -0,0 +1,23 @@
+package com.goodenoughapps.missioncomplete.domain;
+
+import org.joda.time.DateTime;
+
+import java.util.List;
+
+/**
+ * The main task object for all tasks within the application. Follows the schema as mentioned on
+ * https://github.com/GoodEnoughSoftware/Mission-Complete/issues/1
+ * @author Aaron Vontell
+ */
+
+public class Task {
+
+ private String title;
+ private double difficulty;
+ private DateTime date;
+ private boolean completed;
+ private String note;
+ private TaskLocation location;
+ private List subtasks;
+
+}
diff --git a/app/src/main/java/com/goodenoughapps/missioncomplete/domain/TaskLocation.java b/app/src/main/java/com/goodenoughapps/missioncomplete/domain/TaskLocation.java
new file mode 100644
index 0000000..4b4eafe
--- /dev/null
+++ b/app/src/main/java/com/goodenoughapps/missioncomplete/domain/TaskLocation.java
@@ -0,0 +1,59 @@
+package com.goodenoughapps.missioncomplete.domain;
+
+/**
+ * Represents an immutable location which may be attributed to a Task
+ * @author Aaron Vontell
+ */
+public class TaskLocation {
+
+ private double latitude; // The latitude of this location
+ private double longitude; // The longitude of this location
+
+ public static final String LATITUDE_FIELD = "lat";
+ public static final String LONGITUDE_FIELD = "lng";
+
+ /**
+ * Creates a location from the given latitude and longitude
+ * @param latitude
+ * @param longitude
+ */
+ public TaskLocation(double latitude, double longitude) {
+ this.latitude = latitude;
+ this.longitude = longitude;
+ }
+
+ /**
+ * Returns the latitude of this location
+ * @return the latitude of this location
+ */
+ public double getLatitude() {
+ return latitude;
+ }
+
+ /**
+ * Returns the longitude of this location
+ * @return the longitude of this location
+ */
+ public double getLongitude() {
+ return longitude;
+ }
+
+ /**
+ * Returns a JSON representation of this location as defined in the schema
+ * @return a JSON representation of this location as defined in the schema
+ */
+ public String getJSON() {
+ return String.format("{%s: %s, %s: %s}",
+ LATITUDE_FIELD, this.latitude, LONGITUDE_FIELD, this.longitude);
+ }
+
+ /**
+ * Returns a string useful for debugging purposes representing this location
+ * @return a debugging string for this location
+ */
+ @Override
+ public String toString() {
+ return String.format("Location at [%s, %s]", this.latitude, this.longitude);
+ }
+
+}
diff --git a/build.gradle b/build.gradle
index 0d67c5c..a3330d4 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.2.0-rc2'
+ classpath 'com.android.tools.build:gradle:2.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files