use of com.armueller.fluxytodo.models.TodoItem in project FluxyAndroidTodo by armueller.
the class TodoListArrayAdapter method getView.
@Override
public View getView(int position, View view, ViewGroup parent) {
ViewHolder holder;
final TodoItem item = getItem(position);
if (view != null) {
holder = (ViewHolder) view.getTag();
holder.item = item;
} else {
view = inflater.inflate(R.layout.todo_item, parent, false);
holder = new ViewHolder(view, item);
view.setTag(holder);
}
inflateHolderData(holder, item);
setHolderListeners(holder, item);
return view;
}
use of com.armueller.fluxytodo.models.TodoItem in project FluxyAndroidTodo by armueller.
the class FilteredTodoListTest method filteredTodoListHasCompleteTodosTest.
@Test
public void filteredTodoListHasCompleteTodosTest() {
TodoItem t1 = new TodoItem(1, "T1", false);
TodoItem t2 = new TodoItem(2, "T2", true);
TodoItem t3 = new TodoItem(3, "T3", true);
TodoItem t4 = new TodoItem(4, "T4", false);
list.put(t1.getId(), t1);
list.put(t2.getId(), t2);
list.put(t3.getId(), t3);
list.put(t4.getId(), t4);
RawTodoList rawTodoList = new RawTodoList(list);
FilteredTodoList filteredTodoList = new FilteredTodoList(FilteredTodoList.Filter.COMPLETE, rawTodoList);
assertThat(filteredTodoList.list.size()).isEqualTo(2);
assertThat(filteredTodoList.list).contains(t2, t3);
}
use of com.armueller.fluxytodo.models.TodoItem in project FluxyAndroidTodo by armueller.
the class FilteredTodoListTest method filteredTodoListHasAllTodosTest.
@Test
public void filteredTodoListHasAllTodosTest() {
TodoItem t1 = new TodoItem(1, "T1", false);
TodoItem t2 = new TodoItem(2, "T2", false);
TodoItem t3 = new TodoItem(3, "T3", false);
list.put(t1.getId(), t1);
list.put(t2.getId(), t2);
list.put(t3.getId(), t3);
RawTodoList rawTodoList = new RawTodoList(list);
FilteredTodoList filteredTodoList = new FilteredTodoList(FilteredTodoList.Filter.ALL, rawTodoList);
assertThat(filteredTodoList.list.size()).isEqualTo(3);
assertThat(filteredTodoList.list).contains(t1, t2, t3);
}
use of com.armueller.fluxytodo.models.TodoItem in project FluxyAndroidTodo by armueller.
the class RawTodoListTest method createRawTodoListFromArrayListTest.
@Test
public void createRawTodoListFromArrayListTest() {
ArrayList<TodoItem> list = new ArrayList<TodoItem>(3);
list.add(new TodoItem(1, "T1", false));
list.add(new TodoItem(2, "T2", false));
list.add(new TodoItem(3, "T3", false));
RawTodoList rawTodoList = new RawTodoList(list);
assertThat(rawTodoList.list).isNotNull();
assertThat(rawTodoList.list.get(0).getId()).isEqualTo(1);
assertThat(rawTodoList.list.get(1).getId()).isEqualTo(2);
assertThat(rawTodoList.list.get(2).getId()).isEqualTo(3);
}
use of com.armueller.fluxytodo.models.TodoItem in project FluxyAndroidTodo by armueller.
the class RawTodoListTest method createRawTodoListFromHashMapTest.
@Test
public void createRawTodoListFromHashMapTest() {
HashMap<Long, TodoItem> list = new HashMap<Long, TodoItem>();
TodoItem t1 = new TodoItem(1, "T1", false);
TodoItem t2 = new TodoItem(2, "T2", false);
TodoItem t3 = new TodoItem(3, "T3", false);
list.put(1L, t1);
list.put(2L, t2);
list.put(3L, t3);
RawTodoList rawTodoList = new RawTodoList(list);
assertThat(rawTodoList.list).isNotNull();
assertThat(rawTodoList.list).contains(t1, t2, t3);
}
Aggregations