Git Product home page Git Product logo

adaptercommands's People

Contributors

sdoward avatar sockeqwe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

adaptercommands's Issues

java.lang.IllegalArgumentException: itemCount <= 0

When I set the adapter's items to an empty List twice in a row,
I get the above error at at com.hannesdorfmann.adaptercommands.command.ItemRangeRemovedCommand.<init>(ItemRangeRemovedCommand.java:40).

This is how I initialise my adapter:

        adapter = new SchoolAdapter(this);
        recyclerView.setAdapter(adapter);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        commandsCalculator = new DiffCommandsCalculator<>(true, SchoolItem.ITEM_CHANGE_DETECTOR);
        commandProcessor = new AdapterCommandProcessor(adapter);

This is how I clear out my adapter:

        List<SchoolItem> schools = Collections.emptyList();
        adapter.setItems(schools);
        commandProcessor.execute(commandsCalculator.diff(schools));

Support for Object Payloads

Hi Hannes.

Recent versions of the support library include support for sending optional object payloads in the various notification methods of the RecyclerView.Adapter:

void notifyItemChanged (int position, 
                Object payload)

void notifyItemRangeChanged (int positionStart, 
                int itemCount, 
                Object payload)

etc...

These methods are extremely useful in determining the right animations when writing your own RecyclerView.ItemAnimator , for example by recording custom ItemInfo when recordPreLayoutInformation(..) is called and passing the right info to the various animation methods of the RecyclerView.ItemAnimator.

This is potentially a very big change therefore I am enquiring if this is out of the scope of the current release and/or is doable at all.

Would be happy do contribute with a pull request if so.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.