rename: priority -> status

pull/660/head
Quentin Hibon 5 years ago
parent 7db6f600fb
commit 8c8204cf19

@ -104,8 +104,8 @@ class ListHabitsMenu @Inject constructor(
return true return true
} }
R.id.actionSortPriority -> { R.id.actionSortStatus -> {
behavior.onSortByPriority() behavior.onSortByStatus()
return true return true
} }

@ -67,8 +67,8 @@
android:title="@string/by_score"/> android:title="@string/by_score"/>
<item <item
android:id="@+id/actionSortPriority" android:id="@+id/actionSortStatus"
android:title="@string/by_priority"/> android:title="@string/by_status"/>
</menu> </menu>
</item> </item>
</menu> </menu>

@ -159,7 +159,7 @@
<string name="by_name">By name</string> <string name="by_name">By name</string>
<string name="by_color">By color</string> <string name="by_color">By color</string>
<string name="by_score">By score</string> <string name="by_score">By score</string>
<string name="by_priority">By priority</string> <string name="by_status">By status</string>
<string name="export">Export</string> <string name="export">Export</string>
<string name="long_press_to_edit">Press-and-hold to change the value</string> <string name="long_press_to_edit">Press-and-hold to change the value</string>
<string name="change_value">Change value</string> <string name="change_value">Change value</string>

@ -33,7 +33,7 @@ import static org.isoron.uhabits.core.utils.StringUtils.defaultToStringStyle;
* expected at that day or not. * expected at that day or not.
* </p> * </p>
* <p> * <p>
* Note that the priority comparator in * Note that the status comparator in
* {@link org.isoron.uhabits.core.models.memory.MemoryHabitList} * {@link org.isoron.uhabits.core.models.memory.MemoryHabitList}
* relies on SKIP > YES_MANUAL > YES_AUTO > NO. * relies on SKIP > YES_MANUAL > YES_AUTO > NO.
* <p> * <p>

@ -250,8 +250,8 @@ public abstract class HabitList implements Iterable<Habit>
BY_COLOR_DESC, BY_COLOR_DESC,
BY_SCORE_ASC, BY_SCORE_ASC,
BY_SCORE_DESC, BY_SCORE_DESC,
BY_PRIORITY_ASC, BY_STATUS_ASC,
BY_PRIORITY_DESC, BY_STATUS_DESC,
BY_POSITION BY_POSITION
} }
} }

@ -173,7 +173,7 @@ public class MemoryHabitList extends HabitList
else return p1.compareTo(p2); else return p1.compareTo(p2);
}; };
Comparator<Habit> priorityComparatorDesc = (h1, h2) -> Comparator<Habit> statusComparatorDesc = (h1, h2) ->
{ {
if (h1.isCompletedToday() != h2.isCompletedToday()) { if (h1.isCompletedToday() != h2.isCompletedToday()) {
return h1.isCompletedToday() ? -1 : 1; return h1.isCompletedToday() ? -1 : 1;
@ -189,7 +189,7 @@ public class MemoryHabitList extends HabitList
return v2.compareTo(v1); return v2.compareTo(v1);
}; };
Comparator<Habit> priorityComparatorAsc = (h1, h2) -> priorityComparatorDesc.compare(h2, h1); Comparator<Habit> statusComparatorAsc = (h1, h2) -> statusComparatorDesc.compare(h2, h1);
if (order == BY_POSITION) return positionComparator; if (order == BY_POSITION) return positionComparator;
if (order == BY_NAME_ASC) return nameComparatorAsc; if (order == BY_NAME_ASC) return nameComparatorAsc;
@ -198,8 +198,8 @@ public class MemoryHabitList extends HabitList
if (order == BY_COLOR_DESC) return colorComparatorDesc; if (order == BY_COLOR_DESC) return colorComparatorDesc;
if (order == BY_SCORE_DESC) return scoreComparatorDesc; if (order == BY_SCORE_DESC) return scoreComparatorDesc;
if (order == BY_SCORE_ASC) return scoreComparatorAsc; if (order == BY_SCORE_ASC) return scoreComparatorAsc;
if (order == BY_PRIORITY_DESC) return priorityComparatorDesc; if (order == BY_STATUS_DESC) return statusComparatorDesc;
if (order == BY_PRIORITY_ASC) return priorityComparatorAsc; if (order == BY_STATUS_ASC) return statusComparatorAsc;
throw new IllegalStateException(); throw new IllegalStateException();
} }

@ -127,11 +127,11 @@ public class ListHabitsMenuBehavior
} }
} }
public void onSortByPriority() { public void onSortByStatus() {
if (adapter.getOrder() != HabitList.Order.BY_PRIORITY_ASC) { if (adapter.getOrder() != HabitList.Order.BY_STATUS_ASC) {
adapter.setOrder(HabitList.Order.BY_PRIORITY_ASC); adapter.setOrder(HabitList.Order.BY_STATUS_ASC);
} else { } else {
adapter.setOrder(HabitList.Order.BY_PRIORITY_DESC); adapter.setOrder(HabitList.Order.BY_STATUS_DESC);
} }
} }

@ -132,11 +132,11 @@ public class ListHabitsMenuBehaviorTest extends BaseUnitTest
} }
@Test @Test
public void testOnSortPriority() public void testOnSortStatus()
{ {
behavior.onSortByPriority(); behavior.onSortByStatus();
verify(adapter).setOrder(orderCaptor.capture()); verify(adapter).setOrder(orderCaptor.capture());
assertThat(orderCaptor.getValue(), equalTo(BY_PRIORITY_ASC)); assertThat(orderCaptor.getValue(), equalTo(BY_STATUS_ASC));
} }
@Test @Test

Loading…
Cancel
Save