question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature request] Callbacks for data population

See original GitHub issue

I’m probably wrong, but I don’t think the FirebaseRecyclerAdapter and its children have callbacks for when the data is about to be initially populated or when it’s finished populating items. I checked docs and code for the current and 2.0.0 branches, and I didn’t see listeners or callbacks that would allow someone to display a progress bar if the database is taking a lot of time to fetch some items on a slow network and hide it when the items are populated. I know it’s possible to do this for simple references like so:

dataRef.addValueEventListener(new ValueEventListener() {
    @Override
    public void onDataChange(DataSnapshot dataSnapshot) {
        Data data = dataSnapshot.getValue(Data.class);
        textView.setText(data.getText());
        progressBar.setVisibility(View.GONE);
    }

    @Override
    public void onCancelled(DatabaseError databaseError) {
        // ...
    }
});

However, I’m wondering if something like this should be implemented in the FirebaseRecyclerAdapters:

dataAdapter.setOnPopulatedListener(new OnPopulatedListener() {
    @Override
    public void onPopulation() {
        progressBar.setVisibility(View.GONE);
    }
});

// Or perhaps, probably the right choice, by subclassing

public void onInitialPopulation() {
    progressBar.setVisibility(View.GONE);
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
SUPERCILEXcommented, Mar 14, 2017

@TheCraftKid So many questions! 😄 Well, now #633 should take care of it.

See https://github.com/firebase/FirebaseUI-Android/pull/477#issuecomment-270283875 for when onDataChanged isn’t called.

0reactions
WillieCubedcommented, Mar 14, 2017

Why won’t it be supported for the indexing? Is it an implementation issue? Also, in what situations is onDataChanged not called?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Learn From Churn #3 -Feature Request Data vs Feature Fitment
In my last post, I discussed how Ticketing vs Product Usage data predicted possible customer churn. You can read it here. So, let's...
Read more >
Event Handling and Callback Functions - DifferentialEquations.jl
The ContinuousCallback is applied when a given continuous condition function hits zero. · The DiscreteCallback is applied when its condition function is true...
Read more >
Callback Functions - MapsAlive User Guide
The callback functions let you write code to listen for specific events and perform actions when they occur.
Read more >
Clientside Callbacks | Dash for Python Documentation | Plotly
Clientside callbacks allow you to write your callbacks in JavaScript that runs ... to be run directly in the browser instead of a...
Read more >
Long Callbacks in Dash Web Apps - Towards Data Science
A long callback runs in a separate process and comes with additional options allowing you to improve the responsiveness of your app, e.g.,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found