Java Code Examples for android.support.v17.leanback.widget.SearchOrbView#bringToFront()

The following examples show how to use android.support.v17.leanback.widget.SearchOrbView#bringToFront() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TVDemoActivity.java    From BuildingForAndroidTV with MIT License 5 votes vote down vote up
@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();
}
 
Example 2
Source File: MainActivity.java    From BuildingForAndroidTV with MIT License 4 votes vote down vote up
/**
 * 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();
}