Releases: drakeet/MultiType
Releases · drakeet/MultiType
v2.1.0
Added AutoValue support (#27)
If the subclass is already registered, the registered mapping is used.
If the subclass is not registered, then look for the parent class is
registered, if the parent class is registered, the subclass is regarded
as the parent class.
cn-zh: 新增对于 Google AutoValue 支持,同时支持映射子类到同一 view provider 了,规则是:如果子类有注册,就用注册的映射关系;如果子类没注册,则该子类对象使用注册过的父类映射关系。
More details: https://github.com/drakeet/MultiType/pull/27/files
v2.0.0
- Removed
TypeItem
and flattened the Items! (#21)
public class MainActivity extends AppCompatActivity {
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.list);
/* Or you could use List<Item> */
Items items = new Items();
TextItem textItem = new TextItem("world");
ImageItem imageItem = new ImageItem(R.mipmap.ic_launcher);
RichItem richItem = new RichItem("小艾大人赛高", R.mipmap.avatar);
for (int i = 0; i < 20; i++) {
items.add(textItem);
items.add(imageItem);
items.add(richItem);
}
recyclerView.setAdapter(new MultiTypeAdapter(items));
}
}
- Added
FlatTypeAdapter
to flatten class and item, example by TimeMachine:
public class MessageAdapter extends MultiTypeAdapter {
public MessageAdapter(@NonNull List<Message> messages) {
super(messages);
}
@NonNull @Override public Class onFlattenClass(@NonNull Item message) {
return ((Message) message).content.getClass();
}
}
v1.2.4
v1.2.4:
- Supplied more
Items
operation methods - Supplied ItemsTest and changed the
Items
List type
v1.2.3:
- Added the
Items
class, now you can use it to simplify your codes, example:
Items items = new Items();
TextItemContent textItem = new TextItemContent("world");
ImageItemContent imageItem = new ImageItemContent(R.mipmap.ic_launcher);
RichItemContent richItem = new RichItemContent("小艾大人赛高", R.mipmap.avatar);
for (int i = 0; i < 20; i++) {
items.add(textItem);
items.add(imageItem);
items.add(richItem);
}
recyclerView.setAdapter(new MultiTypeAdapter(items.toList()));
- Supported adding duplicate types to the pool
- Updated android support libs to v24.2.0
v1.2.1
v1.2
v1.1
- Renamed
ItemTypesAdapter
toMultiTypeAdapter
(Thanks for @TellH ) - Changed
onCreateView
toonCreateViewHolder
(Thanks for @LuckyJayce) - Changed
onBindView
toonBindViewHolder
- Added register check to avoid insert the same type for pool to fixed #2
- Fixed #6 compatibility of java.util.Objects.requireNonNull
- Changed
class ItemViewProvider<C extends ItemContent, V extends ViewHolder>