jenkins-bot has submitted this change and it was merged.

Change subject: Unbind Views on Fragment destruction
......................................................................


Unbind Views on Fragment destruction

Add missing unbind() call in UserOptionRowFragment. From the docs[0]:

  Fragments have a different view lifecycle than activities. When
  binding a fragment in onCreateView, set the views to null in
  onDestroyView. Butter Knife returns an Unbinder instance when you call
  bind to do this for you. Call its unbind method in the appropriate
  lifecycle callback.

[0] http://jakewharton.github.io/butterknife/#reset

Change-Id: If81cea985d1d4c93ac74cc1b289bd4c1fbd149a4
---
M app/src/main/java/org/wikipedia/useroption/ui/UserOptionRowFragment.java
1 file changed, 4 insertions(+), 1 deletion(-)

Approvals:
  Dbrant: Looks good to me, approved
  jenkins-bot: Verified



diff --git 
a/app/src/main/java/org/wikipedia/useroption/ui/UserOptionRowFragment.java 
b/app/src/main/java/org/wikipedia/useroption/ui/UserOptionRowFragment.java
index a763104..45af2fc 100644
--- a/app/src/main/java/org/wikipedia/useroption/ui/UserOptionRowFragment.java
+++ b/app/src/main/java/org/wikipedia/useroption/ui/UserOptionRowFragment.java
@@ -28,11 +28,13 @@
 
 import butterknife.BindView;
 import butterknife.ButterKnife;
+import butterknife.Unbinder;
 
 import static org.wikipedia.Constants.USER_OPTION_ROW_FRAGMENT_LOADER_ID;
 
 public class UserOptionRowFragment extends Fragment implements 
CallbackFragment<FragmentCallback> {
     @BindView(R.id.fragment_user_option_list) ListView list;
+    private Unbinder unbinder;
 
     public static UserOptionRowFragment newInstance() {
         return new UserOptionRowFragment();
@@ -44,7 +46,7 @@
         super.onCreateView(inflater, container, savedInstanceState);
 
         View view = inflater.inflate(R.layout.fragment_user_option_row, 
container, false);
-        ButterKnife.bind(this, view);
+        unbinder = ButterKnife.bind(this, view);
 
         CursorAdapter listAdapter = new 
UserOptionRowCursorAdapter(getContext(), null, true);
         list.setAdapter(listAdapter);
@@ -60,6 +62,7 @@
 
     @Override public void onDestroyView() {
         
getActivity().getSupportLoaderManager().destroyLoader(USER_OPTION_ROW_FRAGMENT_LOADER_ID);
+        unbinder.unbind();
         super.onDestroyView();
     }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/288326
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If81cea985d1d4c93ac74cc1b289bd4c1fbd149a4
Gerrit-PatchSet: 2
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Niedzielski <[email protected]>
Gerrit-Reviewer: BearND <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
Gerrit-Reviewer: Dbrant <[email protected]>
Gerrit-Reviewer: Mholloway <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to