@SuppressWarnings("deprecation") protected void setupUIElements() { setHeadersState(HEADERS_DISABLED | HEADERS_HIDDEN); setupHeader(); View root = getView(); if (root != null) { progress = new ProgressBar(getActivity()); progress.setLayoutParams(new FrameLayout.LayoutParams(150, 150, Gravity.CENTER)); progressText = new TextView(getActivity()); FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER); lp.topMargin = 150; progressText.setLayoutParams(lp); progressText.setGravity(Gravity.CENTER); progressText.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize(R.dimen.fontHuge)); BrowseFrameLayout frame = getBrowseFrame(root); frame.addView(progress); frame.addView(progressText); } }
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); BrowseFrameLayout layout = (BrowseFrameLayout) view; // Override down navigation as we do not use it in this screen // Only the detailPresenter will be displayed layout.setOnDispatchKeyListener((v, keyCode, event) -> event.getKeyCode() == KeyEvent.KEYCODE_DPAD_DOWN); }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup root = (ViewGroup) inflater.inflate(R.layout.lb_vertical_grid_fragment, container, false); mBrowseFrame = (BrowseFrameLayout) root.findViewById(R.id.browse_frame); mBrowseFrame.setOnFocusSearchListener(mOnFocusSearchListener); mTitleView = (TitleView) root.findViewById(R.id.browse_title_group); mTitleView.setBadgeDrawable(mBadgeDrawable); mTitleView.setTitle(mTitle); if (mSearchAffordanceColorSet) { mTitleView.setSearchAffordanceColors(mSearchAffordanceColors); } if (mExternalOnSearchClickedListener != null) { mTitleView.setOnSearchClickedListener(mExternalOnSearchClickedListener); } mSceneWithTitle = sTransitionHelper.createScene(root, new Runnable() { @Override public void run() { mTitleView.setVisibility(View.VISIBLE); } }); mSceneWithoutTitle = sTransitionHelper.createScene(root, new Runnable() { @Override public void run() { mTitleView.setVisibility(View.INVISIBLE); } }); mTitleUpTransition = TitleTransitionHelper.createTransitionTitleUp(sTransitionHelper); mTitleDownTransition = TitleTransitionHelper.createTransitionTitleDown(sTransitionHelper); sTransitionHelper.excludeChildren(mTitleUpTransition, R.id.browse_grid_dock, true); sTransitionHelper.excludeChildren(mTitleDownTransition, R.id.browse_grid_dock, true); return root; }
private void setupFocusSearchListener() { BrowseFrameLayout browseFrameLayout = (BrowseFrameLayout) getView().findViewById( R.id.grid_frame); browseFrameLayout.setOnFocusSearchListener(getTitleHelper().getOnFocusSearchListener()); }
protected BrowseFrameLayout getBrowseFrame(View root) { return (BrowseFrameLayout) root.findViewById(android.support.v17.leanback.R.id.browse_frame); }
@Override protected BrowseFrameLayout getBrowseFrame(View root) { return (BrowseFrameLayout) root.findViewById(android.support.v17.leanback.R.id.browse_frame); }
/** * Returns a * {@link android.support.v17.leanback.widget.BrowseFrameLayout.OnFocusSearchListener} which * may be used to manage focus switching between the title view and scene root. */ public BrowseFrameLayout.OnFocusSearchListener getOnFocusSearchListener() { return mOnFocusSearchListener; }
protected abstract BrowseFrameLayout getBrowseFrame(View root);