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

B: 2 - Migrated sample project view bindings to butterknife. Closes #11 #28

Merged
merged 1 commit into from
Jul 24, 2017

Conversation

vestrel00
Copy link
Owner

Migrated sample project view bindings to butterknife.

@vestrel00 vestrel00 added this to the B: butterknife milestone Jul 24, 2017
@vestrel00 vestrel00 self-assigned this Jul 24, 2017
@vestrel00 vestrel00 merged commit 51c9862 into master Jul 24, 2017
@vestrel00 vestrel00 deleted the feature/#11-migrate-to-butterknife-view-binding branch July 24, 2017 19:44
@vestrel00 vestrel00 changed the title Migrated sample project view bindings to butterknife. Closes #11 B: 2 - Migrated sample project view bindings to butterknife. Closes #11 Jul 25, 2017
* onViewStateRestored
* onResume
*/
viewUnbinder = ButterKnife.bind(this, getView());
Copy link
Owner Author

Choose a reason for hiding this comment

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

Use the view instead of calling getView() again.

Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't be onStart between onViewStateRestoredand onResume?

Copy link
Owner Author

@vestrel00 vestrel00 Aug 14, 2017

Choose a reason for hiding this comment

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

Yes. I didn't include onStart because it wasn't relevant here. I also omitted onCreate on purpose.

*
* If we bind before this method (e.g. onViewCreated), then any checked changed
* listeners bound by ButterKnife will be invoked during fragment recreation (since
* Android itself saves and restores the views' states.
Copy link
Owner Author

Choose a reason for hiding this comment

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

Missing closing parenthesis.

public void onViewStateRestored(Bundle savedInstanceState) {
super.onViewStateRestored(savedInstanceState);
View view = getView();
if (view != null) {
Copy link
Owner Author

Choose a reason for hiding this comment

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

Null check not needed since onViewStateRestored only gets called when the View returned in onCreateView is not null. See 7370d99

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