-
Notifications
You must be signed in to change notification settings - Fork 1.9k
This change allows easy detection of the list being empty *and* respo… #487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Previously just writing repositories makes it confusing whether to add the url under `buildscript` or `allprojects`.
add fabric maven url under allprojects
…nding to multi-child changes. The demo app has been updated to show an "this list is empty" view when there are no chat messages. Separate API changes (and minimal) demo from the bigger demo changes in https://github.com/firebase/FirebaseUI-Android/pull/477/files
@SUPERCILEX Can you have a look at this PR and weigh in on the name of the new method? |
|
||
@Override | ||
public void onReady() { | ||
FirebaseRecyclerAdapter.this.onDataChanged(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't we want to unify these names and pick either onReady
or onDataChanged
? Other than that, LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I wasn't sure. In the context of FirebaseArray
the name onDataChanged()
is too close to the existing onChanged()
name. But I like the name as a whole.
We could consider renaming onChanged()
to onChildChanged()
(keep its signature aside from the name-change). Since the interface isn't part of the public API (yet), we could do that in a minor version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should go for the second option (with onChildChanged
letting us use onDataChanged
). It would make the api more consistent with the native Firebase apis and fits well in the context of my other PR: https://github.com/firebase/FirebaseUI-Android/pull/488/files#diff-3620a1e9acaa17bea769cfbc3079f39aR18.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, might as well change the signature now while it's still private and get the name you actually want.
@puf, I found a stopship bug when offline #477 (comment). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approve pending resolution of discussion in comments.
|
||
@Override | ||
public void onReady() { | ||
FirebaseRecyclerAdapter.this.onDataChanged(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, might as well change the signature now while it's still private and get the name you actually want.
…y` to `onDataChanged`.
@puf I am ready to merge this, can you change the target branch to |
@samtstern, I think @puf wanted to hold off on merging because of this. I could be wrong, but I just wanted to make sure. |
I interpreted the end of that discussion to mean "it will be fixed here when it's fixed in the SDK" but will let @puf confirm |
@samtstern @SUPERCILEX there is no ongoing work to fix this in the SDK, but I don't want to implement a workaround in FirebaseUI. If that is the only thing blocking this PR, I suggest we merge and keep #477 (comment) open. |
@SUPERCILEX #487 is a small subset of #477. The latter includes a more elaborate demo, which we're (it's @samtstern for once) not ready to merge yet. |
@puf, SGTM. |
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
Ah, OK. Thanks for the clarification @puf. |
mEmptyListView = findViewById(R.id.emptyTextView); | ||
|
||
mRef = FirebaseDatabase.getInstance().getReference(); | ||
mChatRef = mRef.child("chats"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@puf looks like the merge didn't work (mChatRef
got split into a nonexistent mRef
for some reason).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I split into two refs and apparently forgot to initialize one when resolving the conflict. It was my first time using the web conflict resolution editor and I must've borked something. I'll fix it tomorrow back at my desktop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh cool! I haven't been able to try that out yet. Github just needs to add checks to make sure your code compiles 😄 (oh, and why not add Intellij while we're at it and just write all of your code for you! 😄)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@puf FirebaseUI now has checkstyle and it appears to be mad about spacing... Hopefully, this won't become too much of an annoyance. 😄
@Override | ||
protected void onDataChanged() { | ||
// if there are no chat messages, show a view that invites the user to add a message | ||
mEmptyListView.setVisibility(mRecyclerViewAdapter.getItemCount() == 0?View.VISIBLE:View.INVISIBLE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space around :
and ?
.
…picky about that.
android:id="@+id/emptyTextView" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="No messages. Start chatting at the bottom!" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@puf Hmmm, this is kind of an experiment so we'll have to see how it goes. I would recommend running ./gradlew check
to make sure lint and checkstyle are happy, but in this case it wants you to create and @string
resource. You can just ignore it with tools:ignore="HardcodedText"
if you want.
Going to squash and merge this, thank you all! |
Fixes #458 and #118. Ready for a final review, mostly to see how everyone feels about the name.