use viewBinding correctly

This commit is contained in:
evermind 2021-06-23 16:53:01 +02:00
parent e30a552b6c
commit 435813355f
1 changed files with 9 additions and 4 deletions

View File

@ -304,7 +304,8 @@ public final class VideoDetailFragment
@Override
public View onCreateView(@NonNull final LayoutInflater inflater, final ViewGroup container,
final Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_video_detail, container, false);
binding = FragmentVideoDetailBinding.inflate(inflater, container, false);
return binding.getRoot();
}
@Override
@ -355,7 +356,6 @@ public final class VideoDetailFragment
@Override
public void onDestroy() {
super.onDestroy();
binding = null;
// Stop the service when user leaves the app with double back press
// if video player is selected. Otherwise unbind
@ -388,6 +388,12 @@ public final class VideoDetailFragment
}
}
@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
@Override
public void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
super.onActivityResult(requestCode, resultCode, data);
@ -586,10 +592,9 @@ public final class VideoDetailFragment
// Init
//////////////////////////////////////////////////////////////////////////*/
@Override
@Override // called from onViewCreated in {@link BaseFragment#onViewCreated}
protected void initViews(final View rootView, final Bundle savedInstanceState) {
super.initViews(rootView, savedInstanceState);
binding = FragmentVideoDetailBinding.bind(rootView);
pageAdapter = new TabAdapter(getChildFragmentManager());
binding.viewPager.setAdapter(pageAdapter);