Search in sources :

Example 6 with TodoItem

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;
}
Also used : TodoItem(com.armueller.fluxytodo.models.TodoItem)

Example 7 with TodoItem

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);
}
Also used : TodoItem(com.armueller.fluxytodo.models.TodoItem) Test(org.junit.Test)

Example 8 with TodoItem

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);
}
Also used : TodoItem(com.armueller.fluxytodo.models.TodoItem) Test(org.junit.Test)

Example 9 with TodoItem

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);
}
Also used : TodoItem(com.armueller.fluxytodo.models.TodoItem) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 10 with TodoItem

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);
}
Also used : TodoItem(com.armueller.fluxytodo.models.TodoItem) HashMap(java.util.HashMap) Test(org.junit.Test)

Aggregations

TodoItem (com.armueller.fluxytodo.models.TodoItem)12 Test (org.junit.Test)10 ArrayList (java.util.ArrayList)5 ViewAction (com.armueller.fluxytodo.actions.ViewAction)3 FilteredTodoList (com.armueller.fluxytodo.data.FilteredTodoList)3 RawTodoList (com.armueller.fluxytodo.data.RawTodoList)3 Subscribe (com.squareup.otto.Subscribe)3 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)3 HashMap (java.util.HashMap)1