@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mOverlay = new Overlay(this); SearchOrbView searchOrbView = (SearchOrbView) getView().findViewById(R.id.title_orb); if (searchOrbView != null) { searchOrbView.setOrbIcon(getResources().getDrawable(R.drawable.orb_sort)); } else { throw new IllegalArgumentException("Did not find R.id.title_orb in BrowseFragment! Need to update the orbview hack!"); } ViewGroup container = (ViewGroup) getView().findViewById(R.id.browse_frame); if (container != null) { LayoutInflater.from(getActivity()).inflate(R.layout.leanback_empty_view, container, true); mEmptyView = (TextView) container.findViewById(R.id.empty_view); mEmptyView.setText(R.string.you_have_no_movies); } else { throw new IllegalArgumentException("Did not find R.id.browse_frame in BrowseFragment! Need to update the emptyview hack!"); } }
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setTitle(getString(R.string.video_lists)); SearchOrbView searchOrbView = (SearchOrbView) getView().findViewById(R.id.title_orb); searchOrbView.setVisibility(View.INVISIBLE); setOnSearchClickedListener(null); }
/** * Sets the {@link android.support.v17.leanback.widget.SearchOrbView.Colors} used to draw the search affordance. */ public void setSearchAffordanceColors(SearchOrbView.Colors colors) { mSearchAffordanceColors = colors; mSearchAffordanceColorSet = true; if (mTitleView != null) { mTitleView.setSearchAffordanceColors(mSearchAffordanceColors); } }
/** * Returns the {@link android.support.v17.leanback.widget.SearchOrbView.Colors} * used to draw the search affordance. */ public SearchOrbView.Colors getSearchAffordanceColors() { if (mSearchAffordanceColorSet) { return mSearchAffordanceColors; } if (mTitleView == null) { throw new IllegalStateException("Fragment views not yet created"); } return mTitleView.getSearchAffordanceColors(); }
public MyTitleView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); LayoutInflater inflater = LayoutInflater.from(context); View rootView = inflater.inflate(R.layout.lb_my_title_view, this); mBadgeView = (ImageView) rootView.findViewById(R.id.title_badge); mTextView = (TextView) rootView.findViewById(R.id.title_text); mSearchOrbView = (SearchOrbView) rootView.findViewById(R.id.title_orb); mSearchOrbView2 = (SearchOrbView) rootView.findViewById(R.id.title_orb2); // ARCHOS added mSearchOrbView3 = (SearchOrbView) rootView.findViewById(R.id.title_orb3); // ARCHOS added mSearchOrbView4 = (SearchOrbView) rootView.findViewById(R.id.title_orb4); // ARCHOS added mSearchOrbView4.setVisibility(GONE); mHintView = (HintView) rootView.findViewById(R.id.hint_view); // ARCHOS added mOrb1Description = (TextView) rootView.findViewById(R.id.orb1_description); // ARCHOS added mOrb2Description = (TextView) rootView.findViewById(R.id.orb2_description); // ARCHOS added mOrb3Description = (TextView) rootView.findViewById(R.id.orb3_description); // ARCHOS added mOrb4Description = (TextView) rootView.findViewById(R.id.orb4_description); // ARCHOS added mSearchOrbView.setOnFocusChangeListener(mOrbsFocusListener); mSearchOrbView2.setOnFocusChangeListener(mOrbsFocusListener); mSearchOrbView3.setOnFocusChangeListener(mOrbsFocusListener); mSearchOrbView4.setOnFocusChangeListener(mOrbsFocusListener); setClipToPadding(false); setClipChildren(false); }
/** * Sets the {@link SearchOrbView.Colors} used to draw the search affordance. */ public void setSearchAffordanceColors(SearchOrbView.Colors colors) { mSearchOrbView.setOrbColors(colors); mSearchOrbView2.setOrbColors(colors); mSearchOrbView3.setOrbColors(colors); mSearchOrbView4.setOrbColors(colors); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.lb_search_fragment); searchBar = (SearchBar) findViewById(R.id.lb_search_bar); searchEditText = (SearchEditText) searchBar.findViewById(R.id.lb_search_text_editor); // reduce flakiness SearchOrbView searchOrbView = (SearchOrbView) searchBar.findViewById(R.id.lb_search_bar_speech_orb); searchOrbView.enableOrbColorAnimation(false); searchOrbView.setSoundEffectsEnabled(false); searchOrbView.clearAnimation(); }
/** * Sets the {@link SearchOrbView.Colors} used to draw the search affordance. */ public void setSearchAffordanceColors(SearchOrbView.Colors colors) { mSearchAffordanceColors = colors; mSearchAffordanceColorSet = true; if (mTitleView != null) { mTitleView.setSearchAffordanceColors(mSearchAffordanceColors); } }
/** * Returns the {@link SearchOrbView.Colors} used to draw the search affordance. */ public SearchOrbView.Colors getSearchAffordanceColors() { if (mSearchAffordanceColorSet) { return mSearchAffordanceColors; } if (mTitleView == null) { throw new IllegalStateException("Fragment views not yet created"); } return mTitleView.getSearchAffordanceColors(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_custom); orbView = (SearchOrbView) findViewById(R.id.custom_search_orb); orbView.setOrbColor(getResources().getColor(R.color.search_opaque)); orbView.bringToFront(); orbView.setOnOrbClickedListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(getApplicationContext(), TVSearchActivity.class); startActivity(intent); } }); fragments = new LinkedHashMap<Integer, CustomRowsFragment>(); for (int i = 0; i < CATEGORIES_NUMBER; i++) { CustomRowsFragment fragment = new CustomRowsFragment(); fragments.put(i, fragment); } headersFragment = new CustomHeadersFragment(); rowsFragment = fragments.get(0); customFrameLayout = (CustomFrameLayout) ((ViewGroup) this.findViewById(android.R.id.content)).getChildAt(0); setupCustomFrameLayout(); FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction transaction = fragmentManager.beginTransaction(); transaction .replace(R.id.header_container, headersFragment, "CustomHeadersFragment") .replace(R.id.rows_container, rowsFragment, "CustomRowsFragment"); transaction.commit(); }
/** * Returns the {@link SearchOrbView.Colors} used to draw the search affordance. */ public SearchOrbView.Colors getSearchAffordanceColors() { return mSearchOrbView.getOrbColors(); }
/** * Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SharedPreferences prefs = getSharedPreferences(PREFS_ROOT, Context.MODE_PRIVATE); useStandardBrowseFragment = prefs.getBoolean(PREFS_USE_STANDARD_BROWSE_FRAGMENT, false); /* * This flag discriminates the use of the CustomBrowseFragment widget. */ if (useStandardBrowseFragment) { setContentView(standardBrowseFragmentLayoutId); return; } setContentView(customBrowseFragmentLayoutId); orbView = (SearchOrbView) findViewById(R.id.custom_search_orb); orbView.setOrbColor(getResources().getColor(R.color.search_opaque)); orbView.bringToFront(); orbView.setOnOrbClickedListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(getApplicationContext(), SearchActivity.class); startActivity(intent); } }); rowsFragment = new CustomRowsFragment(); headersFragment = new CustomHeadersFragment(); moreSamplesFragment = new MoreSamplesFragment(); fragments = new LinkedHashMap<Integer, Fragment>(); fragments.put(0, rowsFragment); fragments.put(1, moreSamplesFragment); currentFragment = rowsFragment; customFrameLayout = (CustomFrameLayout) ((ViewGroup) this.findViewById(android.R.id.content)).getChildAt(0); setupCustomFrameLayout(); FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction transaction = fragmentManager.beginTransaction(); transaction .replace(R.id.header_container, headersFragment, "CustomHeadersFragment") .replace(R.id.rows_container, rowsFragment, "CustomRowsFragment"); transaction.commit(); }
/** * Sets the color used to draw the search affordance. * A default brighter color will be set by the framework. * * @param color The color to use for the search affordance. */ public void setSearchAffordanceColor(int color) { setSearchAffordanceColors(new SearchOrbView.Colors(color)); }