Merge branch 'dev' into llunak/custom_snooze

This commit is contained in:
2017-09-28 07:00:51 -05:00
13 changed files with 53 additions and 21 deletions

View File

@@ -60,9 +60,9 @@ public class BaseUserInterfaceTest
@Before
public void setUp() throws Exception
{
device = getInstance(getInstrumentation());
TestButler.setup(getTargetContext());
TestButler.verifyAnimationsDisabled(getTargetContext());
device = getInstance(getInstrumentation());
HabitsApplication app =
(HabitsApplication) getTargetContext().getApplicationContext();

View File

@@ -31,7 +31,6 @@ import static org.isoron.uhabits.acceptance.steps.CommonSteps.*;
import static org.isoron.uhabits.acceptance.steps.EditHabitSteps.*;
import static org.isoron.uhabits.acceptance.steps.ListHabitsSteps.MenuItem.*;
import static org.isoron.uhabits.acceptance.steps.ListHabitsSteps.*;
import static org.isoron.uhabits.acceptance.steps.ListHabitsSteps.MenuItem.EDIT;
@RunWith(AndroidJUnit4.class)
@LargeTest
@@ -94,7 +93,7 @@ public class HabitsTest extends BaseUserInterfaceTest
clickSave();
verifyShowsScreen(LIST_HABITS);
verifyDisplaysText("Take a walk");
verifyDisplaysTextInSequence("Wake up early", "Take a walk", "Meditate");
verifyDoesNotDisplayText("Track time");
}

View File

@@ -31,6 +31,7 @@ import org.isoron.uhabits.activities.habits.list.*;
import static android.support.test.espresso.Espresso.*;
import static android.support.test.espresso.action.ViewActions.*;
import static android.support.test.espresso.assertion.PositionAssertions.*;
import static android.support.test.espresso.assertion.ViewAssertions.*;
import static android.support.test.espresso.matcher.ViewMatchers.*;
import static junit.framework.Assert.*;
@@ -114,6 +115,15 @@ public class CommonSteps extends BaseUserInterfaceTest
onView(withText(text)).check(matches(isEnabled()));
}
public static void verifyDisplaysTextInSequence(String... text)
{
verifyDisplaysText(text[0]);
for(int i = 1; i < text.length; i++) {
verifyDisplaysText(text[i]);
onView(withText(text[i])).check(isBelow(withText(text[i-1])));
}
}
private static void verifyDisplaysView(String className)
{
onView(withClassName(endsWith(className))).check(matches(isEnabled()));

View File

@@ -171,6 +171,8 @@ public class EditHabitDialog extends AppCompatDialogFragment
if (type == Habit.NUMBER_HABIT && !targetPanel.validate()) return;
Habit habit = modelFactory.buildHabit();
if( originalHabit != null )
habit.copyFrom(originalHabit);
habit.setName(namePanel.getName());
habit.setDescription(namePanel.getDescription());
habit.setColor(namePanel.getColor());

View File

@@ -21,8 +21,8 @@ package org.isoron.uhabits.notifications
import android.app.*
import android.content.*
import android.graphics.*
import android.graphics.BitmapFactory.*
import android.graphics.Color
import android.support.v4.app.*
import android.support.v4.app.NotificationCompat.*
import org.isoron.androidbase.*
@@ -85,13 +85,13 @@ class AndroidNotificationTray
.setWhen(reminderTime)
.setShowWhen(true)
.setOngoing(preferences.shouldMakeNotificationsSticky())
if (preferences.shouldMakeNotificationsLed())
builder.setLights(Color.RED, 1000, 1000)
val notification = builder.build()
builder.setLights(Color.RED, 1000, 1000)
val notificationManager = context.getSystemService(
Activity.NOTIFICATION_SERVICE) as NotificationManager
notificationManager.notify(notificationId, notification)
notificationManager.notify(notificationId, builder.build())
}
}

View File

@@ -92,7 +92,7 @@ public abstract class DatabaseUtils
throws IOException
{
SimpleDateFormat dateFormat = DateFormats.getBackupDateFormat();
String date = dateFormat.format(DateUtils.getStartOfToday());
String date = dateFormat.format(DateUtils.getLocalTime());
String format = "%s/Loop Habits Backup %s.db";
String filename = String.format(format, dir.getAbsolutePath(), date);

View File

@@ -166,7 +166,7 @@
<string name="pure_black_description">Replaces gray backgrounds with pure black in night mode. Reduces battery usage in phones with AMOLED display.</string>
<string name="interface_preferences">Interface</string>
<string name="reverse_days">Reverse order of days</string>
<string name="reverse_days_description">Show days in reverse order on the main screen</string>
<string name="reverse_days_description">Show days in reverse order on the main screen.</string>
<string name="day">Day</string>
<string name="week">Week</string>
@@ -191,8 +191,8 @@
<string name="sticky_notifications">Make notifications sticky</string>
<string name="sticky_notifications_description">Prevents notifications from being swiped away.</string>
<string name="led_notifications">LED</string>
<string name="led_notifications_description">Notifications blinking light.</string>
<string name="led_notifications">Notification light</string>
<string name="led_notifications_description">Shows a blinking light for reminders. Only available in phones with LED notification lights.</string>
<string name="repair_database">Repair database</string>
<string name="database_repaired">Database repaired.</string>