-
Notifications
You must be signed in to change notification settings - Fork 6
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
Implement View binding, replacing synthetics #634
Conversation
Feature/view binding
revert exception handler
… into develop � Conflicts: � stories/src/main/java/com/wordpress/stories/compose/ComposeLoopFrameActivity.kt
First of all thank you very much for your contribution here! We really appreciate it, and we apologize for the time that has passed. It's sometimes difficult to juggle priorities, but always happy to see contributions of this kind. Very helpful! I was finally able to dedicate a good amount of time to analyzing your PR and the approach, I'm summarizing my thoughts here. I changed the base branch to a feature branch we're going to utilize to build changes on it before we merge to develop. Smoke testI gave it a smoke test and it seems to be working well, except that the text color picker bottom sheet only shows the different colors when tapping on each color item in the selector. Checked and spotted where this issue was coming from, fixed in 28f28f5 (going to open a different PR with that). Plugin declarations / build.gradleI checked the init declaration in gradle and thought of changing it to:
as indicated in https://developer.android.com/topic/libraries/view-binding, but no big deal really. This can be changed later if needed 👍
https://developer.android.com/kotlin/parcelize
for our case I think it'd be enough to remove and add General code inspection
I can see you were using the boilerplate code from this gist which in turn is explained as part of this article here but turns out was not immune to how certain Fragments lifecycle is handled, and was updated here. We could update the code to use An interesting discussion held internally about this shows that there is not a whole lot of agreement on this area, or to put it some way, a consensus is still in development. The discussion in this PoC PR also brought up the finding that the same updated gist as used in this PR works with using What my thoughts are: using the viewDelegate makes coding faster, but finding a bug may become harder. I'd be up for using this in a smaller app, but I wonder whether we're willing to introduce this in such a large codebase as the WordPress for Android is. In the case of WordPress, the changes there are so huge and widespread that they need be done in partial ways and in a way which is easier to understand and is traceable. Hence the "first pass" on all applicable classes was done by means of applying the Google recipe first, with taking care of nullifying the Interestingly, this seems to be an ache for many developers. One of the problems outlined in omitting nullifying the binding field as expressed here woocommerce/woocommerce-android#3764 could be fixed by the delegate introduced here in this PR, if we also took care of changing the observer to
Digging a bit more, I realized the But, unfortunately Finally, I'm now understanding a bit more how this PR here brings both these concepts to an upper level by implementing an homogeneous interface with these 2 classes:
That is neat! 🙌 !
So back to the discussion about the approach, certainly the Stories library is in a better spot to implement changes such as this one as it's not a huge codebase to work with in this regard. In terms of how to integrate these solutions, I wish we could implement the library and also incorporate the gist https://gist.github.com/seanghay/0fd991d7a823815500557fe043b052ce#file-view-binding-ktx-kt Setting that apart, in general I'd be up to go for it, with a few changes as explained above, plus the needed conflict resolution. I'm taking care of that in a subsequent PR to make it easier 👍 (*) |
I resolved the conflicts with the base branch, merging now 👍 (will test and fix any other issues from the view binding update against the feature branch) |
Hi @mzorz, |
Thank you @faranjit! The delay was on our part first so, no problem :). Looking forward to more contributions for sure, I always enjoy learning from reading and analyzing other people's approaches to things and yours was certainly carefully crafted and very tidy which I always appreciate. Also always happy to see the library is helping anyone out there who wants to use it 👍 🙇 |
This pr has opened regarding the issue #628. This pr does not contains PhotoEditor.kt because that file has some logics.