Skip to content

Commit

Permalink
Resolved #344 - Get rid of Method B to create and bind ViewHolders
Browse files Browse the repository at this point in the history
  • Loading branch information
davideas committed Apr 21, 2017
1 parent 551c14d commit dfa7564
Showing 1 changed file with 38 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package eu.davidea.flexibleadapter;

import android.view.LayoutInflater;
import android.view.ViewGroup;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -23,9 +26,9 @@
@Config(constants = BuildConfig.class, sdk = 23)
public class ItemComparatorTest {

SimpleHeader[] headers;
SimpleItemComparator comparator;
List<AbstractFlexibleItem> initItems;
private SimpleHeader[] headers;
private SimpleItemComparator comparator;
private List<AbstractFlexibleItem> initItems;

@Before
public void setup() {
Expand Down Expand Up @@ -225,7 +228,7 @@ public int compare(IFlexible v1, IFlexible v2) {
private class SimpleHeader extends AbstractHeaderItem<FlexibleViewHolder> {
String title;

public SimpleHeader(String title) {
SimpleHeader(String title) {
this.title = title;
}

Expand All @@ -234,6 +237,21 @@ public boolean equals(Object o) {
return o instanceof SimpleHeader && title.equals(((SimpleHeader) o).title);
}

@Override
public int getLayoutRes() {
return 0;
}

@Override
public FlexibleViewHolder createViewHolder(FlexibleAdapter adapter, LayoutInflater inflater, ViewGroup parent) {
return null;
}

@Override
public void bindViewHolder(FlexibleAdapter adapter, FlexibleViewHolder holder, int position, List payloads) {

}

@Override
public String toString() {
return "/" + title;
Expand All @@ -243,7 +261,7 @@ public String toString() {
private class SimpleItem extends AbstractSectionableItem<FlexibleViewHolder, SimpleHeader> {
String title;

public SimpleItem(SimpleHeader header, String title) {
SimpleItem(SimpleHeader header, String title) {
super(header);
this.title = title;
}
Expand All @@ -253,6 +271,21 @@ public boolean equals(Object o) {
return o instanceof SimpleItem && title.equals(((SimpleItem) o).title);
}

@Override
public int getLayoutRes() {
return 0;
}

@Override
public FlexibleViewHolder createViewHolder(FlexibleAdapter adapter, LayoutInflater inflater, ViewGroup parent) {
return null;
}

@Override
public void bindViewHolder(FlexibleAdapter adapter, FlexibleViewHolder holder, int position, List payloads) {

}

@Override
public String toString() {
return getHeader().title + "." + title;
Expand Down

0 comments on commit dfa7564

Please sign in to comment.