Hi David and the Firebase team,
I am trying to order the tabs in a FragmentStatePagerAdapter by most recent "scout." It seems really hard to insert an item into a FragmentStatePagerAdapter and get it to refresh properly. So instead of doing that, it would make my life way easier if Firebase just gave me the keys in descending order instead of ascending (most recent first). If this is not possible, consider this a feature request for orderByKeyDescending()
:) Any help would be appreciated! Thanks!
Here is my desired listener BTW:
scoutRef.orderByKeyDescending().addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
mSectionsPagerAdapter.mKeyPosition.add(dataSnapshot.getKey());
mSectionsPagerAdapter.notifyDataSetChanged();
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
}
@Override
public void onChildMoved(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onCancelled(DatabaseError databaseError) {
FirebaseCrash.report(databaseError.toException());
}
});