Code Monkey home page Code Monkey logo

Comments (3)

cwalmsley avatar cwalmsley commented on August 11, 2024

For the second issue (the empty view not being removed when the RealmRecyclerView goes from 0 -> 1 objects), I can confirm from my tests that View.GONE is being set correctly (see snippet below) but for some reason it does not hide the view in the UI. I'm still trying to figure out what is causing this.

 private void updateEmptyContentContainerVisibility(RecyclerView.Adapter adapter) {
    if (emptyViewId == 0) {
        return;
    }
    emptyContentContainer.setVisibility(
            adapter.getItemCount() == 0 ? View.VISIBLE : View.GONE);
}

from realm-recyclerview.

cwalmsley avatar cwalmsley commented on August 11, 2024

Unfortunately I have not been able to find a solution for this yet.

I've checked that the snippet above runs on the UI thread (it does) and also I've tried clearing any animations on the view as these coukd interfere with View.GONE

The issue is only for type LinearLayoutWithHeaders (and footers). I can't really see what is causing this bug comparing it with the other layout types.

Any help (or pointers of other things for me to try) would be greatly appreciated as currently this bug is a blocker for me to release an app using this feature.

from realm-recyclerview.

JM-Agrimap avatar JM-Agrimap commented on August 11, 2024

The problem is in RealmBasedRecyclerViewAdapter, it is caused by updateRowWrappers() not being called by the RealmBasedRecyclerViewAdapter if there are no ids in the collection.

To fix them problem requires a small change in the method getRealmChangeListener()

The following code should be change from

return new RealmChangeListener<OrderedRealmCollection<T>>() {
    @Override
    public void onChange(OrderedRealmCollection<T> element) {
        if (animateResults && ids != null && !ids.isEmpty()) {
        updateRowWrappers();
            ...
        } else {
    ...
        }
    }
    ...
}

to

return new RealmChangeListener<OrderedRealmCollection<T>>() {
    @Override
    public void onChange(OrderedRealmCollection<T> element) {
        updateRowWrappers();

        if (animateResults && ids != null && !ids.isEmpty()) {
            ...
        } else {
    ...
        }
    }
    ...
}

from realm-recyclerview.

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.