Skip to content
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

Migrate CollapseFullScreenDialogFragment.java to ViewBinding #20975

Conversation

neeldoshii
Copy link
Contributor

@neeldoshii neeldoshii commented Jun 12, 2024

Description

This pull request migrates the CollapseFullScreenDialogFragment to use ViewBinding, improving type safety and eliminating the need for findViewById calls.

Fixes/Related

Screenshots/ Video

// TODO

Steps to reproduce

  1. Click on my Site
  2. Click on comments tab from menu
  3. Open the comment
  4. Write some comment (Reply to comment), you will see left side up button click on that and the CollapseFullScreenDialogFragment will be reproduced 🥇

PR Submission Checklist:

  • I have completed the Regression Notes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Testing Checklist (strike-out the not-applying and unnecessary ones):

  • WordPress.com sites and self-hosted Jetpack sites.
  • Portrait and landscape orientations.
  • Light and dark modes.
  • Fonts: Larger, smaller and bold text.
  • High contrast.
  • Talkback.
  • Languages with large words or with letters/accents not frequently used in English.
  • Right-to-left languages. (Even if translation isn’t complete, formatting should still respect the right-to-left layout)
  • Large and small screen sizes. (Tablet and smaller phones)
  • Multi-tasking: Split screen and Pop-up view. (Android 10 or higher)

@neeldoshii neeldoshii force-pushed the Migrate-`CollapseFullScreenDialogFragment`-to-ViewBinding branch from 3e755fc to 20d74b8 Compare June 12, 2024 00:39
@@ -56,6 +56,7 @@ public class CollapseFullScreenDialogFragment extends DialogFragment {
private static final String ARG_HIDE_ACTIVITY_BAR = "ARG_HIDE_ACTIVITY_BAR";
private static final String ARG_TITLE = "ARG_TITLE";
private static final int ID_ACTION = 1;
private CollapseFullScreenDialogFragmentBinding mBinding;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reviewer Note (@ParaskP7): Should we always have refference of binding locally?.

also do you think I should making binding null on dismiss?

    @Override
    public void dismiss() {
        if (mHideActivityBar) {
            showActivityBar();
        }

        try {
            getParentFragmentManager().popBackStackImmediate();
        } catch (IllegalStateException e) {
            e.printStackTrace();
        }
    }

Copy link
Contributor

Choose a reason for hiding this comment

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

👋 @neeldoshii !

Should we always have refference of binding locally?

Since the mBinding is being used in both, the onCreate(...) and onCreateView(...) you can't avoid but using it as you did, via a shared field. Thus, the answer to your question is that "it depends".

also do you think I should making binding null on dismiss?

I actually suggest doing that within the onDestroyView(), just like it is recommended by the docs, which is to use the onDestroy() lifecycle method(s) and remove any reference to the mBinding fields there.

@ParaskP7
Copy link
Contributor

👋 @neeldoshii and thanks so much for submitting yet another PR!

Let's first manage to merge the other 2 open PRs that we have opened so far, that is, before proceeding to reviewing or opening any more PRs like that. I would love if you take all the lessons learned so far and start applying them to subsequent PRs, that, without us having to re-discuss on topics that we have already touched before.

How does this plan sound to you? 😊

PS: I don't want to stop you from being productive, nor to bring your morale down, I just want us to have an efficient process moving forward, 1 step at a time, 1 PR at a time. Then, when we'll start flying high, we could do more PRs in parallel. I hope that doesn't displease you. 🙏

Copy link

sonarcloud bot commented Jun 13, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@neeldoshii neeldoshii requested a review from ParaskP7 June 20, 2024 07:08
@ParaskP7 ParaskP7 added this to the Future milestone Jun 20, 2024
Copy link
Contributor

@ParaskP7 ParaskP7 left a comment

Choose a reason for hiding this comment

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

👋 @neeldoshii !

Thank you so much for your contribution to JP/WPAndroid with this PR! 🥇

I have reviewed but NOT tested this PR, neither triggered CI on it just yet, good job except with the testing part! 🌟


You will notice my blocker comment (🚫) below. Please make every effort to build and test any change you make, no matter how small. Also, please make an effort to check your code against our static analysis tools, like CheckStyle, Detekt and Lint, that is, before pushing it to remote. Not doing so gives me little confidence on the code that is about to be reviewed and doesn't make it easy for us to merge your solution as quick as possible.

@Override
public void onDestroy() {
super.onDestroy();
mBinding = null
Copy link
Contributor

Choose a reason for hiding this comment

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

Blocker (🚫): ; is expected here, this is a Java file. Don't forget to build and test your code before pushing. 🤷

@neeldoshii
Copy link
Contributor Author

Hi @ParaskP7 👋

I have reviewed but NOT tested this PR, neither triggered CI on it just yet, good job except with the testing part! 🌟

Not sure how did this happened 😅 when I tested locally it wasn't there as well as CI passed strange! My apologies for it 😔. I have made the appropriate changes.

@neeldoshii neeldoshii requested a review from ParaskP7 June 20, 2024 18:13
@ParaskP7
Copy link
Contributor

👋 @neeldoshii !

Not sure how did this happened 😅

🤷

when I tested locally it wasn't there...

What wasn't there? 🤔

...as well as CI passed strange!

CI didn't pass, I need to trigger CI manually after reviewing your changes, which I did, and then noticed the problem, at which point I didn't trigger CI.

My apologies for it 😔. I have made the appropriate changes.

I don't see any updates, are you sure you pushed the change(s)? 🤔

@neeldoshii
Copy link
Contributor Author

I don't see any updates, are you sure you pushed the change(s)? 🤔

Correct! Pushed now.

@ParaskP7
Copy link
Contributor

Awesome, thanks @neeldoshii , I'll take another look at it today! 👍

Copy link
Contributor

@ParaskP7 ParaskP7 left a comment

Choose a reason for hiding this comment

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

👋 @neeldoshii !

Thank you so much for your contribution to JP/WPAndroid with this PR! 🥇

I have reviewed and tested this PR as per the instructions, along with triggering CI on it via a draft PR, which I just pushed on the main repo, everything works as expected, good job! 🌟

@ParaskP7 ParaskP7 merged commit d72a98b into wordpress-mobile:trunk Jun 25, 2024
22 checks passed
@ParaskP7
Copy link
Contributor

🎉 @neeldoshii , another contribution in, thanks so much for all your work! 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants