Skip to content

Releases: drakeet/MultiType

v2.1.0

09 Oct 14:14
Compare
Choose a tag to compare

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

21 Sep 16:31
Compare
Choose a tag to compare
  • 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

20 Sep 14:59
Compare
Choose a tag to compare

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

21 Aug 15:20
Compare
Choose a tag to compare
  • Added describe() method to Savable(#18)

v1.2

11 Aug 15:30
Compare
Choose a tag to compare
  • Renamed ItemTypePool to MultiTypePool
  • Changed the data type of MultiTypeAdapter to List<? extends TypeItem>

v1.1

05 Aug 15:02
Compare
Choose a tag to compare
  • Renamed ItemTypesAdapter to MultiTypeAdapter (Thanks for @TellH )
  • Changed onCreateView to onCreateViewHolder (Thanks for @LuckyJayce)
  • Changed onBindView to onBindViewHolder
  • 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>