Android icon indicating copy to clipboard operation
Android copied to clipboard

ViewBinding migration

Open AndroidPoet opened this issue 3 years ago • 9 comments

Task/Issue URL: https://github.com/duckduckgo/Android/issues/1478

Description

I have migrated most of the files from findViewById and kotlinExtenstions including Activities,Fragments,Dialog Fragments,Adapters. I have used the Kotlin-delegates in all the components to make code more readable and structured. I have also added a delegate for the "Dialog Fragments" because dialog fragment has a different lifecycle compared to "fragment" due to overriding of onCreateDialog.

Remaining Fragments and components

bindremaing

I would love to work on these also, but for this, I would need approval from the internal team. because the intro page is coupled with the base fragment, which is not very good practice, we can use the extension function for that, I know "browserTabFragment " is assigned to the internal team , but I would like to work on that including all other remaining components.

AndroidPoet avatar Jun 05 '22 11:06 AndroidPoet

Hi @cmonfortep! please review this PR (ViewBinding migration) when you have time. Thanks.

AndroidPoet avatar Jun 08 '22 15:06 AndroidPoet

@AndroidPoet will take a look thanks. Just to set expectations, I'm planning to review it beginning next week.

cmonfortep avatar Jun 09 '22 08:06 cmonfortep

@AndroidPoet will take a look thanks. Just to set expectations, I'm planning to review it beginning next week. Thanks!

AndroidPoet avatar Jun 09 '22 08:06 AndroidPoet

@AndroidPoet I was doing a quick pass and I see many unrelated changes (e.g: code formating, new lines, code commented, etc.), can you discard them? You can run as well spotless to fix any code style issues (https://github.com/duckduckgo/Android/blob/develop/STYLEGUIDE.md#code-formatting)

Also, our goal is to migrate away from kotlin synthetics since they are deprecated. Usage of findViewById or binding is allowed, up to each developer to follow their preference on each case. We don't have a strong rule to follow there. Could you discard changes on those classes that were already migrated?

Thanks!

cmonfortep avatar Jun 10 '22 12:06 cmonfortep

Thanks for the review.@cmonfortep, I will discard formatting and all these unnecessary things. I agree that we don't have to follow that strong rule, we can use findViewId and view binding together and remove kotlin synthetics. But In my opinion, code always should be uniform and follow the same structure on all the screens, It creates a pattern in our mind so we can easily identify things. But will use the same pattern which is View Binding for kotlin synthetics screens and will not change if there is already findViewId used.

AndroidPoet avatar Jun 10 '22 15:06 AndroidPoet

No worries. That will helps us have a smaller PR easier for me to review, otherwise, there are a lot more things to check here.

cmonfortep avatar Jun 13 '22 08:06 cmonfortep

Yes i was also thinking that we can divide screens and will work on that,so we can fix this step by step. will upload screenshot a list of screen which still have kotlin synthetic.

AndroidPoet avatar Jun 13 '22 08:06 AndroidPoet

@AndroidPoet I know you are busy with some interviews (I hope you do well :)).

If we are not actively working on this contribution, are you ok if we close it? You can reopen it again once it's ready for review. Thanks.

cmonfortep avatar Aug 02 '22 13:08 cmonfortep

@AndroidPoet I know you are busy with some interviews (I hope you do well :)).

If we are not actively working on this contribution, are you ok if we close it? You can reopen it again once it's ready for review. Thanks.

Thanks! Yeah Sure will reopen it .

AndroidPoet avatar Aug 02 '22 13:08 AndroidPoet

@cmonfortep assigning to you @AndroidPoet is this still active? can it be closed?

malmstein avatar Sep 09 '22 07:09 malmstein