daimajia / daimajia/AndroidSwipeLayout
BaseSwipeAdapter
- Dominant language
- Java
- Stars
- 12.3k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I extended the BaseSwipeAdapter into my own class and I'm trying to add different item layouts based on the data. I am familiar with how listview recycles the items, and before hand I used to override the getView() method to achieve this effect. It worked perfectly but the BaseSwipeAdapter has the getView() method as final so I can't override it anymore. What's the solution? How can I make the generateView() method to allow me to specify a particular layout based on y data since the BaseSwipeAdapter getView() method is final:
`
View v = convertView;
if(v == null){
v = generateView(position, parent);
}
mItemManger.bind(v, position);
fillValues(position, v);
return v;
`
which to me reads like it's resuing the same item layout all the times after the initial ones have been created. What am I missing?
my generateView() code below:
`
@Override
public View generateView(int position, ViewGroup parent) {
```
final ViewHolder holder;
Click click = allClicks.get(position);
View vi;
if (click.getTotalClicks() == 1) {
vi = ((LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.up_click_item_layout, null);
} else {
vi = ((LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.down_click_item_layout, null);
}
return vi;
}
```
`
Thank you!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.