mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-07 09:38:52 -06:00
replacing getDescription with getQuestion all over the code
This commit is contained in:
@@ -96,25 +96,25 @@ public class BaseUserInterfaceTest
|
|||||||
|
|
||||||
Habit h1 = fixtures.createEmptyHabit();
|
Habit h1 = fixtures.createEmptyHabit();
|
||||||
h1.setName("Wake up early");
|
h1.setName("Wake up early");
|
||||||
h1.setDescription("Did you wake up early today?");
|
h1.setQuestion("Did you wake up early today?");
|
||||||
h1.setColor(5);
|
h1.setColor(5);
|
||||||
habitList.update(h1);
|
habitList.update(h1);
|
||||||
|
|
||||||
Habit h2 = fixtures.createShortHabit();
|
Habit h2 = fixtures.createShortHabit();
|
||||||
h2.setName("Track time");
|
h2.setName("Track time");
|
||||||
h2.setDescription("Did you track your time?");
|
h2.setQuestion("Did you track your time?");
|
||||||
h2.setColor(5);
|
h2.setColor(5);
|
||||||
habitList.update(h2);
|
habitList.update(h2);
|
||||||
|
|
||||||
Habit h3 = fixtures.createLongHabit();
|
Habit h3 = fixtures.createLongHabit();
|
||||||
h3.setName("Meditate");
|
h3.setName("Meditate");
|
||||||
h3.setDescription("Did meditate today?");
|
h3.setQuestion("Did meditate today?");
|
||||||
h3.setColor(10);
|
h3.setColor(10);
|
||||||
habitList.update(h3);
|
habitList.update(h3);
|
||||||
|
|
||||||
Habit h4 = fixtures.createEmptyHabit();
|
Habit h4 = fixtures.createEmptyHabit();
|
||||||
h4.setName("Read books");
|
h4.setName("Read books");
|
||||||
h4.setDescription("Did you read books today?");
|
h4.setQuestion("Did you read books today?");
|
||||||
h4.setColor(2);
|
h4.setColor(2);
|
||||||
habitList.update(h4);
|
habitList.update(h4);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class HabitFixtures
|
|||||||
{
|
{
|
||||||
Habit habit = modelFactory.buildHabit();
|
Habit habit = modelFactory.buildHabit();
|
||||||
habit.setName("Meditate");
|
habit.setName("Meditate");
|
||||||
habit.setDescription("Did you meditate this morning?");
|
habit.setQuestion("Did you meditate this morning?");
|
||||||
habit.setColor(5);
|
habit.setColor(5);
|
||||||
habit.setFrequency(Frequency.DAILY);
|
habit.setFrequency(Frequency.DAILY);
|
||||||
habit.setId(id);
|
habit.setId(id);
|
||||||
@@ -81,7 +81,7 @@ public class HabitFixtures
|
|||||||
{
|
{
|
||||||
Habit habit = modelFactory.buildHabit();
|
Habit habit = modelFactory.buildHabit();
|
||||||
habit.setName("Take a walk");
|
habit.setName("Take a walk");
|
||||||
habit.setDescription("How many steps did you walk today?");
|
habit.setQuestion("How many steps did you walk today?");
|
||||||
habit.setType(Habit.NUMBER_HABIT);
|
habit.setType(Habit.NUMBER_HABIT);
|
||||||
habit.setTargetType(Habit.AT_LEAST);
|
habit.setTargetType(Habit.AT_LEAST);
|
||||||
habit.setTargetValue(200.0);
|
habit.setTargetValue(200.0);
|
||||||
@@ -103,7 +103,7 @@ public class HabitFixtures
|
|||||||
{
|
{
|
||||||
Habit habit = modelFactory.buildHabit();
|
Habit habit = modelFactory.buildHabit();
|
||||||
habit.setName("Wake up early");
|
habit.setName("Wake up early");
|
||||||
habit.setDescription("Did you wake up before 6am?");
|
habit.setQuestion("Did you wake up before 6am?");
|
||||||
habit.setFrequency(new Frequency(2, 3));
|
habit.setFrequency(new Frequency(2, 3));
|
||||||
habitList.add(habit);
|
habitList.add(habit);
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class SubtitleCard extends HabitCard
|
|||||||
|
|
||||||
if (habit.hasReminder()) updateReminderText(habit.getReminder());
|
if (habit.hasReminder()) updateReminderText(habit.getReminder());
|
||||||
|
|
||||||
if (habit.getDescription().isEmpty()) questionLabel.setVisibility(GONE);
|
if (habit.getQuestion().isEmpty()) questionLabel.setVisibility(GONE);
|
||||||
|
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ class AndroidNotificationTray
|
|||||||
val builder = NotificationCompat.Builder(context, REMINDERS_CHANNEL_ID)
|
val builder = NotificationCompat.Builder(context, REMINDERS_CHANNEL_ID)
|
||||||
.setSmallIcon(R.drawable.ic_notification)
|
.setSmallIcon(R.drawable.ic_notification)
|
||||||
.setContentTitle(habit.name)
|
.setContentTitle(habit.name)
|
||||||
.setContentText(if(habit.description.isNullOrBlank()) defaultText else habit.description)
|
.setContentText(if(habit.question.isBlank()) defaultText else habit.question)
|
||||||
.setContentIntent(pendingIntents.showHabit(habit))
|
.setContentIntent(pendingIntents.showHabit(habit))
|
||||||
.setDeleteIntent(pendingIntents.dismissNotification(habit))
|
.setDeleteIntent(pendingIntents.dismissNotification(habit))
|
||||||
.addAction(addRepetitionAction)
|
.addAction(addRepetitionAction)
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public class HabitBullCSVImporter extends AbstractImporter
|
|||||||
String name = line[0];
|
String name = line[0];
|
||||||
if (name.equals("HabitName")) continue;
|
if (name.equals("HabitName")) continue;
|
||||||
|
|
||||||
String description = line[1];
|
String question = line[1];
|
||||||
String dateString[] = line[3].split("-");
|
String dateString[] = line[3].split("-");
|
||||||
int year = Integer.parseInt(dateString[0]);
|
int year = Integer.parseInt(dateString[0]);
|
||||||
int month = Integer.parseInt(dateString[1]);
|
int month = Integer.parseInt(dateString[1]);
|
||||||
@@ -87,7 +87,7 @@ public class HabitBullCSVImporter extends AbstractImporter
|
|||||||
{
|
{
|
||||||
h = modelFactory.buildHabit();
|
h = modelFactory.buildHabit();
|
||||||
h.setName(name);
|
h.setName(name);
|
||||||
h.setDescription(description);
|
h.setQuestion(question);
|
||||||
h.setFrequency(Frequency.DAILY);
|
h.setFrequency(Frequency.DAILY);
|
||||||
habitList.add(h);
|
habitList.add(h);
|
||||||
map.put(name, h);
|
map.put(name, h);
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ public class RewireDBImporter extends AbstractImporter
|
|||||||
{
|
{
|
||||||
int id = c.getInt(0);
|
int id = c.getInt(0);
|
||||||
String name = c.getString(1);
|
String name = c.getString(1);
|
||||||
String description = c.getString(2);
|
String question = c.getString(2);
|
||||||
int schedule = c.getInt(3);
|
int schedule = c.getInt(3);
|
||||||
String activeDays = c.getString(4);
|
String activeDays = c.getString(4);
|
||||||
int repeatingCount = c.getInt(5);
|
int repeatingCount = c.getInt(5);
|
||||||
@@ -101,7 +101,7 @@ public class RewireDBImporter extends AbstractImporter
|
|||||||
|
|
||||||
Habit habit = modelFactory.buildHabit();
|
Habit habit = modelFactory.buildHabit();
|
||||||
habit.setName(name);
|
habit.setName(name);
|
||||||
habit.setDescription(description);
|
habit.setQuestion(question);
|
||||||
|
|
||||||
int periods[] = { 7, 31, 365 };
|
int periods[] = { 7, 31, 365 };
|
||||||
int numerator, denominator;
|
int numerator, denominator;
|
||||||
|
|||||||
@@ -123,11 +123,11 @@ public class TickmateDBImporter extends AbstractImporter
|
|||||||
{
|
{
|
||||||
int id = c.getInt(0);
|
int id = c.getInt(0);
|
||||||
String name = c.getString(1);
|
String name = c.getString(1);
|
||||||
String description = c.getString(2);
|
String question = c.getString(2);
|
||||||
|
|
||||||
Habit habit = modelFactory.buildHabit();
|
Habit habit = modelFactory.buildHabit();
|
||||||
habit.setName(name);
|
habit.setName(name);
|
||||||
habit.setDescription(description);
|
habit.setQuestion(question);
|
||||||
habit.setFrequency(Frequency.DAILY);
|
habit.setFrequency(Frequency.DAILY);
|
||||||
habitList.add(habit);
|
habitList.add(habit);
|
||||||
|
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ public abstract class HabitList implements Iterable<Habit>
|
|||||||
String[] cols = {
|
String[] cols = {
|
||||||
String.format("%03d", indexOf(habit) + 1),
|
String.format("%03d", indexOf(habit) + 1),
|
||||||
habit.getName(),
|
habit.getName(),
|
||||||
habit.getDescription(),
|
habit.getQuestion(),
|
||||||
Integer.toString(freq.getNumerator()),
|
Integer.toString(freq.getNumerator()),
|
||||||
Integer.toString(freq.getDenominator()),
|
Integer.toString(freq.getDenominator()),
|
||||||
ColorConstants.CSV_PALETTE[habit.getColor()]
|
ColorConstants.CSV_PALETTE[habit.getColor()]
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class HabitFixtures
|
|||||||
{
|
{
|
||||||
Habit habit = modelFactory.buildHabit();
|
Habit habit = modelFactory.buildHabit();
|
||||||
habit.setName("Meditate");
|
habit.setName("Meditate");
|
||||||
habit.setDescription("Did you meditate this morning?");
|
habit.setQuestion("Did you meditate this morning?");
|
||||||
habit.setColor(3);
|
habit.setColor(3);
|
||||||
habit.setFrequency(Frequency.DAILY);
|
habit.setFrequency(Frequency.DAILY);
|
||||||
saveIfSQLite(habit);
|
saveIfSQLite(habit);
|
||||||
@@ -73,7 +73,7 @@ public class HabitFixtures
|
|||||||
Habit habit = modelFactory.buildHabit();
|
Habit habit = modelFactory.buildHabit();
|
||||||
habit.setType(Habit.NUMBER_HABIT);
|
habit.setType(Habit.NUMBER_HABIT);
|
||||||
habit.setName("Run");
|
habit.setName("Run");
|
||||||
habit.setDescription("How many miles did you run today?");
|
habit.setQuestion("How many miles did you run today?");
|
||||||
habit.setUnit("miles");
|
habit.setUnit("miles");
|
||||||
habit.setTargetType(Habit.AT_LEAST);
|
habit.setTargetType(Habit.AT_LEAST);
|
||||||
habit.setTargetValue(2.0);
|
habit.setTargetValue(2.0);
|
||||||
@@ -98,7 +98,7 @@ public class HabitFixtures
|
|||||||
Habit habit = modelFactory.buildHabit();
|
Habit habit = modelFactory.buildHabit();
|
||||||
habit.setType(Habit.NUMBER_HABIT);
|
habit.setType(Habit.NUMBER_HABIT);
|
||||||
habit.setName("Walk");
|
habit.setName("Walk");
|
||||||
habit.setDescription("How many steps did you walk today?");
|
habit.setQuestion("How many steps did you walk today?");
|
||||||
habit.setUnit("steps");
|
habit.setUnit("steps");
|
||||||
habit.setTargetType(Habit.AT_LEAST);
|
habit.setTargetType(Habit.AT_LEAST);
|
||||||
habit.setTargetValue(100);
|
habit.setTargetValue(100);
|
||||||
@@ -133,7 +133,7 @@ public class HabitFixtures
|
|||||||
{
|
{
|
||||||
Habit habit = modelFactory.buildHabit();
|
Habit habit = modelFactory.buildHabit();
|
||||||
habit.setName("Wake up early");
|
habit.setName("Wake up early");
|
||||||
habit.setDescription("Did you wake up before 6am?");
|
habit.setQuestion("Did you wake up before 6am?");
|
||||||
habit.setFrequency(new Frequency(2, 3));
|
habit.setFrequency(new Frequency(2, 3));
|
||||||
saveIfSQLite(habit);
|
saveIfSQLite(habit);
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class ImportTest extends BaseUnitTest
|
|||||||
|
|
||||||
Habit habit = habitList.getByPosition(0);
|
Habit habit = habitList.getByPosition(0);
|
||||||
assertThat(habit.getName(), equalTo("Breed dragons"));
|
assertThat(habit.getName(), equalTo("Breed dragons"));
|
||||||
assertThat(habit.getDescription(), equalTo("with love and fire"));
|
assertThat(habit.getQuestion(), equalTo("with love and fire"));
|
||||||
assertThat(habit.getFrequency(), equalTo(Frequency.DAILY));
|
assertThat(habit.getFrequency(), equalTo(Frequency.DAILY));
|
||||||
assertTrue(containsRepetition(habit, 2016, 3, 18));
|
assertTrue(containsRepetition(habit, 2016, 3, 18));
|
||||||
assertTrue(containsRepetition(habit, 2016, 3, 19));
|
assertTrue(containsRepetition(habit, 2016, 3, 19));
|
||||||
|
|||||||
@@ -218,13 +218,13 @@ public class HabitListTest extends BaseUnitTest
|
|||||||
|
|
||||||
Habit h1 = fixtures.createEmptyHabit();
|
Habit h1 = fixtures.createEmptyHabit();
|
||||||
h1.setName("Meditate");
|
h1.setName("Meditate");
|
||||||
h1.setDescription("Did you meditate this morning?");
|
h1.setQuestion("Did you meditate this morning?");
|
||||||
h1.setFrequency(Frequency.DAILY);
|
h1.setFrequency(Frequency.DAILY);
|
||||||
h1.setColor(3);
|
h1.setColor(3);
|
||||||
|
|
||||||
Habit h2 = fixtures.createEmptyHabit();
|
Habit h2 = fixtures.createEmptyHabit();
|
||||||
h2.setName("Wake up early");
|
h2.setName("Wake up early");
|
||||||
h2.setDescription("Did you wake up before 6am?");
|
h2.setQuestion("Did you wake up before 6am?");
|
||||||
h2.setFrequency(new Frequency(2, 3));
|
h2.setFrequency(new Frequency(2, 3));
|
||||||
h2.setColor(5);
|
h2.setColor(5);
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class HabitRecordTest extends BaseUnitTest
|
|||||||
{
|
{
|
||||||
Habit original = modelFactory.buildHabit();
|
Habit original = modelFactory.buildHabit();
|
||||||
original.setName("Hello world");
|
original.setName("Hello world");
|
||||||
original.setDescription("Did you greet the world today?");
|
original.setQuestion("Did you greet the world today?");
|
||||||
original.setColor(1);
|
original.setColor(1);
|
||||||
original.setArchived(true);
|
original.setArchived(true);
|
||||||
original.setFrequency(Frequency.THREE_TIMES_PER_WEEK);
|
original.setFrequency(Frequency.THREE_TIMES_PER_WEEK);
|
||||||
@@ -58,7 +58,7 @@ public class HabitRecordTest extends BaseUnitTest
|
|||||||
{
|
{
|
||||||
Habit original = modelFactory.buildHabit();
|
Habit original = modelFactory.buildHabit();
|
||||||
original.setName("Hello world");
|
original.setName("Hello world");
|
||||||
original.setDescription("Did you greet the world today?");
|
original.setQuestion("Did you greet the world today?");
|
||||||
original.setColor(5);
|
original.setColor(5);
|
||||||
original.setArchived(false);
|
original.setArchived(false);
|
||||||
original.setFrequency(Frequency.DAILY);
|
original.setFrequency(Frequency.DAILY);
|
||||||
|
|||||||
Reference in New Issue
Block a user