Skip to content

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

Merged
merged 10 commits into from
Jan 10, 2017

Conversation

puf
Copy link
Contributor

@puf puf commented Jan 3, 2017

Fixes #458 and #118. Ready for a final review, mostly to see how everyone feels about the name.

jdsingh and others added 3 commits December 9, 2016 13:56
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
@puf puf requested review from morganchen12 and samtstern January 3, 2017 23:07
@puf
Copy link
Contributor Author

puf commented Jan 3, 2017

@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();
Copy link
Collaborator

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!

Copy link
Contributor Author

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.

Copy link
Collaborator

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.

Copy link
Contributor

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.

@SUPERCILEX
Copy link
Collaborator

@puf, I found a stopship bug when offline #477 (comment).

Copy link
Contributor

@samtstern samtstern left a 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();
Copy link
Contributor

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.

@samtstern
Copy link
Contributor

@puf I am ready to merge this, can you change the target branch to version-1.1.0-dev and then we'll merge?

@SUPERCILEX
Copy link
Collaborator

SUPERCILEX commented Jan 9, 2017

@samtstern, I think @puf wanted to hold off on merging because of this. I could be wrong, but I just wanted to make sure.

(#487 and #477 appear to be duplicates.)

@samtstern
Copy link
Contributor

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

@puf
Copy link
Contributor Author

puf commented Jan 10, 2017

@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.

@puf
Copy link
Contributor Author

puf commented Jan 10, 2017

@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.

@SUPERCILEX
Copy link
Collaborator

@puf, SGTM.

@puf puf changed the base branch from master to version-1.1.0-dev January 10, 2017 04:53
@googlebot
Copy link

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 cla/google commit status will not change from this state. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

@SUPERCILEX
Copy link
Collaborator

Ah, OK. Thanks for the clarification @puf.

mEmptyListView = findViewById(R.id.emptyTextView);

mRef = FirebaseDatabase.getInstance().getReference();
mChatRef = mRef.child("chats");
Copy link
Collaborator

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).

Copy link
Contributor Author

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.

Copy link
Collaborator

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! 😄)

Copy link
Collaborator

@SUPERCILEX SUPERCILEX left a 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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space around : and ?.

android:id="@+id/emptyTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="No messages. Start chatting at the bottom!"
Copy link
Collaborator

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.

@samtstern
Copy link
Contributor

Going to squash and merge this, thank you all!

@samtstern samtstern merged commit dd6dd6a into version-1.1.0-dev Jan 10, 2017
@samtstern samtstern added this to the 1.1.0 milestone Jan 10, 2017
@samtstern samtstern deleted the puf-ondatachange branch June 15, 2017 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants