diff --git a/android/uhabits-core/src/main/java/org/isoron/uhabits/core/models/Habit.java b/android/uhabits-core/src/main/java/org/isoron/uhabits/core/models/Habit.java index cee0dabcf..3acdaab7c 100644 --- a/android/uhabits-core/src/main/java/org/isoron/uhabits/core/models/Habit.java +++ b/android/uhabits-core/src/main/java/org/isoron/uhabits/core/models/Habit.java @@ -354,14 +354,26 @@ public void setPosition(int newPosition) data.position = newPosition; } + @NonNull + public String getQuestion() { + return data.question; + } + + public void setQuestion(@NonNull String question) { + data.question = question; + } + public static final class HabitData { @NonNull public String name; - @NonNull + @Nullable public String description; + @NonNull + public String question; + @NonNull public Frequency frequency; @@ -390,7 +402,8 @@ public HabitData() this.frequency = new Frequency(3, 7); this.type = YES_NO_HABIT; this.name = ""; - this.description = ""; + this.description = null; + this.question = ""; this.targetType = AT_LEAST; this.targetValue = 100; this.unit = ""; @@ -401,6 +414,7 @@ public HabitData(@NonNull HabitData model) { this.name = model.name; this.description = model.description; + this.question = model.question; this.frequency = model.frequency; this.color = model.color; this.archived = model.archived; @@ -427,6 +441,7 @@ public String toString() .append("unit", unit) .append("reminder", reminder) .append("position", position) + .append("question", question) .toString(); } @@ -451,6 +466,7 @@ public boolean equals(Object o) .append(unit, habitData.unit) .append(reminder, habitData.reminder) .append(position, habitData.position) + .append(question, habitData.question) .isEquals(); } @@ -469,6 +485,7 @@ public int hashCode() .append(unit) .append(reminder) .append(position) + .append(question) .toHashCode(); } } diff --git a/android/uhabits-core/src/main/java/org/isoron/uhabits/core/models/sqlite/records/HabitRecord.java b/android/uhabits-core/src/main/java/org/isoron/uhabits/core/models/sqlite/records/HabitRecord.java index 29e7ffb5c..523da0542 100644 --- a/android/uhabits-core/src/main/java/org/isoron/uhabits/core/models/sqlite/records/HabitRecord.java +++ b/android/uhabits-core/src/main/java/org/isoron/uhabits/core/models/sqlite/records/HabitRecord.java @@ -33,6 +33,9 @@ public class HabitRecord @Column public String description; + @Column + public String question; + @Column public String name; @@ -91,6 +94,7 @@ public void copyFrom(Habit model) this.targetValue = model.getTargetValue(); this.unit = model.getUnit(); this.position = model.getPosition(); + this.question = model.getQuestion(); Frequency freq = model.getFrequency(); this.freqNum = freq.getNumerator(); @@ -113,6 +117,7 @@ public void copyTo(Habit habit) habit.setId(this.id); habit.setName(this.name); habit.setDescription(this.description); + habit.setQuestion(this.question); habit.setFrequency(new Frequency(this.freqNum, this.freqDen)); habit.setColor(this.color); habit.setArchived(this.archived != 0);