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

Fix FeedbackBottomSheet rotation bug #699

Merged
merged 2 commits into from Feb 14, 2018
Merged

Conversation

danesfeder
Copy link
Contributor

Closes #693

  • Now set to retain instance and instruction view adds back listener to prevent memory leak

Copy link
Contributor

@Guardiola31337 Guardiola31337 left a comment

Choose a reason for hiding this comment

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

Minor details to address before 🚢


@Override
public void onDestroyView() {
// Prevent listener leak
Copy link
Contributor

Choose a reason for hiding this comment

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

What about extracting this block of code into a private method and give it a name based on the comment? This way onDestroyView() will be easier to read and understand and comment will become superfluous so it won't be necessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

We should keep public methods as clean as possible so they read like pseudocode (i.e. no conditionals, fors, etc.).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

// Prevent listener leak
feedbackBottomSheetListener = null;

// Maintains visibility on rotation
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here ☝️

if (dialog != null && getRetainInstance()) {
dialog.setDismissMessage(null);
}
// Cancel the animation
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here ☝️

@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
// Attach the listener to the FeedbackBottomSheet if it is showing
Copy link
Contributor

Choose a reason for hiding this comment

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

What about extracting this block of code into a private method giving it a name based on the comment and then remove it (comment won't be necessary anymore)?

@danesfeder
Copy link
Contributor Author

danesfeder commented Feb 14, 2018

@Guardiola31337 thanks, should be good to go 🍍

Copy link
Contributor

@Guardiola31337 Guardiola31337 left a comment

Choose a reason for hiding this comment

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

🚀

@danesfeder danesfeder merged commit 17f7af7 into master Feb 14, 2018
@danesfeder danesfeder deleted the dan-bottomsheet-rotation branch February 14, 2018 18:51
@danesfeder danesfeder mentioned this pull request Feb 26, 2018
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Defect to be fixed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants