Giter VIP home page Giter VIP logo

Comments (4)

ITServicesAM avatar ITServicesAM commented on May 16, 2024

I have the same Problem. With the Adapters (Alpha + Scale) set, items arn´t removed from screen. Without them set, the removed items disapear from screen.

from recyclerview-animators.

wasabeef avatar wasabeef commented on May 16, 2024

@eric56 @ITServicesAM

Hi.
The problem must be notifyItemRemoved against AnimationAdapter

example

    private ArrayList<String> mDataSet;
    private RecyclerView.Adapter mAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_adapter_sample);

        RecyclerView recyclerView = (RecyclerView) findViewById(R.id.list);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        recyclerView.setItemAnimator(new SlideInRightAnimator());

        mDataSet = new ArrayList<>(Arrays.asList(data));
        MainAdapter adapter = new MainAdapter(this, mDataSet);
        AlphaInAnimationAdapter alphaAdapter = new AlphaInAnimationAdapter(adapter);
        mAdapter = new ScaleInAnimationAdapter(alphaAdapter);
        recyclerView.setAdapter(mAdapter);
    }

    @Override
    public void onClick() {
        mDataSet.remove(2);
        mAdapter.notifyItemRemoved(2);
    }

from recyclerview-animators.

ITServicesAM avatar ITServicesAM commented on May 16, 2024

Even with a call to this method there is no removal. Instead there is a error, when you remove the first item if there are more items left.

from recyclerview-animators.

eric56 avatar eric56 commented on May 16, 2024

Hi , I solved this problem this way :

In recyclerview adapter:

listDAO.delete (item) ;
int pos = list.indexOf (item) ;
feed.remove (item) ;
Fragment_Main.scaleInAnimationAdapter.notifyItemRemoved (pos );

in MainActivity:

public static ScaleInAnimationAdapter scaleInAnimationAdapter ;

...

AlphaInAnimationAdapter alphaAdapter = new AlphaInAnimationAdapter ( cardAdapter ) ;
alphaAdapter.setDuration (300 );
ScaleInAnimationAdapter scaleInAnimationAdapter = new ScaleInAnimationAdapter ( alphaAdapter ) ;
scaleInAnimationAdapter.setDuration (300 );
recyclerView.setAdapter ( scaleInAnimationAdapter );

I hope it helps you too,

tell us if it worked ok ?

good luck!!!

from recyclerview-animators.

Related Issues (20)

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.