Skip to content

Commit

Permalink
use viewBinding correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
evermind-zz committed Jun 24, 2021
1 parent f014ad8 commit dc6685d
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ public void onChange(final boolean selfChange) {
@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
Expand Down Expand Up @@ -355,7 +356,6 @@ public void onStop() {
@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
Expand Down Expand Up @@ -388,6 +388,12 @@ public void onDestroy() {
}
}

@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);
Expand Down Expand Up @@ -586,10 +592,9 @@ private void toggleTitleAndSecondaryControls() {
// 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);
Expand Down

0 comments on commit dc6685d

Please sign in to comment.