-
Notifications
You must be signed in to change notification settings - Fork 46
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
B: 2 - Migrated sample project view bindings to butterknife. Closes #11 #28
Conversation
* onViewStateRestored | ||
* onResume | ||
*/ | ||
viewUnbinder = ButterKnife.bind(this, getView()); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 onViewStateRestored
and onResume
?
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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
Migrated sample project view bindings to butterknife.