1 package com.android.tv.dvr.ui; 2 3 import android.app.FragmentManager; 4 import android.content.Context; 5 import android.os.Bundle; 6 import android.support.v17.leanback.app.GuidedStepFragment; 7 import android.view.LayoutInflater; 8 import android.view.View; 9 import android.view.ViewGroup; 10 11 import com.android.tv.MainActivity; 12 import com.android.tv.R; 13 import com.android.tv.guide.ProgramGuide; 14 15 public class DvrDialogFragment extends HalfSizedDialogFragment { 16 private final DvrGuidedStepFragment mDvrGuidedStepFragment; 17 18 public DvrDialogFragment(DvrGuidedStepFragment dvrGuidedStepFragment) { 19 mDvrGuidedStepFragment = dvrGuidedStepFragment; 20 } 21 22 @Override 23 public void onAttach(Context context) { 24 super.onAttach(context); 25 ProgramGuide programGuide = 26 ((MainActivity) getActivity()).getOverlayManager().getProgramGuide(); 27 if (programGuide != null && programGuide.isActive()) { 28 programGuide.cancelHide(); 29 } 30 } 31 32 @Override 33 public View onCreateView(LayoutInflater inflater, ViewGroup container, 34 Bundle savedInstanceState) { 35 View view = super.onCreateView(inflater, container, savedInstanceState); 36 FragmentManager fm = getChildFragmentManager(); 37 GuidedStepFragment.add(fm, mDvrGuidedStepFragment, R.id.halfsized_dialog_host); 38 return view; 39 } 40 41 @Override 42 public void onDetach() { 43 super.onDetach(); 44 ProgramGuide programGuide = 45 ((MainActivity) getActivity()).getOverlayManager().getProgramGuide(); 46 if (programGuide != null && programGuide.isActive()) { 47 programGuide.scheduleHide(); 48 } 49 } 50 } 51