GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||
GeezerVison is showing github.com — The Big Kahuna of firebase-ui-database by SUPERCILEX · Pull Request #544 · firebase/FirebaseUI-Android Conversation
|
|
@samtstern Hmmm, your branch looks really interesting! The gist I got from it was to make the model class a first class citizen instead of |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Agreed with Alex that this looks promising. I only looked at
`FirebaseArray` for now, so still need to see how the extensions (such as
the indexed array or a re-sorted array) would work.
I'd prefer to not expose too many lists though. If it exposes a `List<E>`,
there should also be a `List<String>` with the keys. And when you have both
of those, they're really just syntactic sugar for `List<DataSnapshot>`.
Nothing wrong with syntactic sugar, but three lists feels like a bit much.
…On Fri, Feb 24, 2017 at 6:58 PM Alex Saveau ***@***.***> wrote:
@samtstern <https://github.com/samtstern> Hmmm, your branch looks really
interesting! The gist I got from it was to make the model class a first
class citizen instead of DataSnapshot which makes way more sense. I don't
really like that you have a getObject instead of getSnapshot method thus
moving the model class a little further back. What do you think of
rewriting this PR with your changes, but implementing List<E> in
ObservableSnapshotArray instead of List<DataSnapshot>? (We could call it
ObservableModelArray<T> or something better.)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#544 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA3w39hrT8tOWWgEXvxFQ8viYkMOLSWhks5rf5jtgaJpZM4LuMcz>
.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Change-Id: I831fd0bae52970ff7db6f4ab1ae2fdb7aa04200a
|
Opened https://github.com/SUPERCILEX/FirebaseUI-Android/pull/24 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
… object, change type name to `E` in ObservableSnapshotArray to unhide type T in toArray method, remove getSnapshots(int) method from FirebaseArray since there's already get(int), use `index` instead of `newIndex` in onKeyMove in FirebaseIndexArray Signed-off-by: Alex Saveau <[email protected]>
Signed-off-by: Alex Saveau <[email protected]>
|
@samtstern The index adapters were completely broken because we forgot to pass in a parser. Since I feel like this could be a recurring theme, I just removed the possibility of a null parser in 7601ded. If devs really don't want to provide a model class for some reason, they can just pass in var1.equals(Object.class)?var0:(var1.isEnum()?zzd(var0, var1):zze(var0, var1)); I also had to write a hacky constructor that really bothers me, but I couldn't think of a better way of doing it that would still let devs extend the adapters while passing in their own |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
public class First { public First(String foo) {} } private class Second extends First { public Second() {} // Doesn't compile public Second(String bar) { super(bar); } // Compiles } Since we also can't pass |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| super(activity, modelClass, modelLayout, new FirebaseIndexArray(keyRef, dataRef)); | ||
| Query keyQuery, | ||
| DatabaseReference dataRef) { | ||
| init(activity, new FirebaseIndexArray<>(keyQuery, dataRef, this), modelClass, modelLayout); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Hmm now I see what happened here. Having init be protected and called by the super class definitely "smells" and makes me think we got something wrong.
Seems like the problem is the circular reference between the adapter and the array, even though it goes through the SnapshotParser interface.
Any thoughts on how we can make this better?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@samtstern Hmmm, I found out that you can't reference non-static fields or methods either in a constructor call so that means no forwarding calls or anything like that. At this point, the only solution I can think of is using a setter for the parser, but I feel like that's way more hacky and makes the intentions less clear. Also, that beats the point of initializing everything for people because they will have to call setParser. @puf Have you encountered this kind of issue before or have any thoughts on this?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Here's a possible answer. Since we're breaking parseSnapshot anyway, what if we removed it from the adapter entirely and instead had the adapters take an optional SnapshotParser in their constructor. They would pass it through to the FirebaseArray if provided.
This seems to be a better representation of the hierarchy anyway,
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@samtstern As long as you're fine with making more breaking api changes, that solution sounds awesome to me!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Signed-off-by: Alex Saveau <[email protected]>
Signed-off-by: Alex Saveau <[email protected]>
|
@samtstern I'm getting this really weird crash because Here are some screenshots showing that even though |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@SUPERCILEX looks like maybe it's how we're casting? We're calling |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@samtstern I was confused by that too, but I think it's just a decompiling bug (java doesn't let you do what's in the screenshot anyway--I checked). If you look at our real code, we are casting things correctly: https://github.com/firebase/FirebaseUI-Android/pull/544/files#diff-fd5c505ad432166321255bc4541624ddR89 so I'm pretty sure this is an issue with the RTDB. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@SUPERCILEX yep you're right, it's not the casting issue. I just took a look at this and (I can't believe I'm saying it) but I'm ready to merge this beast! Could you file a new issue about the possible listener removal race condition thing? Definitely worth tracking but it does not seem to be a direct result of this PR. Do you have any oppositions to my doing a 'squash and merge' on this PR? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@samtstern AWESOME!!!! Yeah, I already filed a bug for the slow listener removal. No objections at all, please don't do anything but a squash. There are way too many commits in this PR! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Haha, nice gif! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.