Java Code Examples for android.support.v17.leanback.app.BackgroundManager#getInstance()

The following examples show how to use android.support.v17.leanback.app.BackgroundManager#getInstance() . 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: TVVideoDetailsFragment.java    From BuildingForAndroidTV with MIT License 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    Log.i(TAG, "onCreate DetailsFragment");
    super.onCreate(savedInstanceState);

    BackgroundManager backgroundManager = BackgroundManager.getInstance(getActivity());
    backgroundManager.attach(getActivity().getWindow());
    mBackgroundTarget = new PicassoBackgroundManagerTarget(backgroundManager);

    mDefaultBackground = getResources().getDrawable(R.drawable.default_background);

    mMetrics = new DisplayMetrics();
    getActivity().getWindowManager().getDefaultDisplay().getMetrics(mMetrics);

    selectedMovie = (Movie) getActivity().getIntent().getSerializableExtra(MOVIE);
    new DetailRowBuilderTask().execute(selectedMovie);

    setOnItemClickedListener(getDefaultItemClickedListener());
    updateBackground(selectedMovie.getBackgroundImageURI());

}
 
Example 2
Source File: BrowseFragment.java    From Amphitheatre with Apache License 2.0 6 votes vote down vote up
private void prepareBackgroundManager() {
    BackgroundManager backgroundManager = BackgroundManager.getInstance(getActivity());
    backgroundManager.attach(getActivity().getWindow());
    mBackgroundTarget = new PicassoBackgroundManagerTarget(backgroundManager);

    mDefaultBackground = getResources().getDrawable(R.drawable.amphitheatre);

    mMetrics = new DisplayMetrics();
    getActivity().getWindowManager().getDefaultDisplay().getMetrics(mMetrics);

    Picasso.with(getActivity())
            .load(R.drawable.amphitheatre)
            .resize(mMetrics.widthPixels, mMetrics.heightPixels)
            .centerCrop()
            .skipMemoryCache()
            .into(mBackgroundTarget);
}
 
Example 3
Source File: TVVideoDetailsFragment.java    From BuildingForAndroidTV with MIT License 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    Log.i(TAG, "onCreate DetailsFragment");
    super.onCreate(savedInstanceState);

    BackgroundManager backgroundManager = BackgroundManager.getInstance(getActivity());
    backgroundManager.attach(getActivity().getWindow());
    mBackgroundTarget = new PicassoBackgroundManagerTarget(backgroundManager);

    mDefaultBackground = getResources().getDrawable(R.drawable.default_background);

    mMetrics = new DisplayMetrics();
    getActivity().getWindowManager().getDefaultDisplay().getMetrics(mMetrics);

    selectedMovie = (Movie) getActivity().getIntent().getSerializableExtra(MOVIE);
    new DetailRowBuilderTask().execute(selectedMovie);

    setOnItemClickedListener(getDefaultItemClickedListener());
    updateBackground(selectedMovie.getBackgroundImageURI());

}
 
Example 4
Source File: TVGridFragment.java    From BuildingForAndroidTV with MIT License 5 votes vote down vote up
private void prepareBackgroundManager() {
	BackgroundManager backgroundManager = BackgroundManager.getInstance(getActivity());
	backgroundManager.attach(getActivity().getWindow());
	mBackgroundTarget = new PicassoBackgroundManagerTarget(backgroundManager);

	mDefaultBackground = getResources().getDrawable(R.drawable.default_background);

	mMetrics = new DisplayMetrics();
	getActivity().getWindowManager().getDefaultDisplay().getMetrics(mMetrics);
}
 
Example 5
Source File: VideoDetailsFragment.java    From AndroidDemoProjects with Apache License 2.0 5 votes vote down vote up
private void initBackground() {
    BackgroundManager backgroundManager = BackgroundManager.getInstance(getActivity());
    backgroundManager.attach(getActivity().getWindow());
    mBackgroundTarget = new PicassoBackgroundManagerTarget( backgroundManager );

    mMetrics = new DisplayMetrics();
    getActivity().getWindowManager().getDefaultDisplay().getMetrics(mMetrics);

    if( mSelectedMovie != null && !TextUtils.isEmpty( mSelectedMovie.getBackgroundImageUrl() ) ) {
        try {
            updateBackground(new URI(mSelectedMovie.getBackgroundImageUrl()));
        } catch (URISyntaxException e) { }
    }
}
 
Example 6
Source File: MainFragment.java    From TuentiTV with Apache License 2.0 5 votes vote down vote up
private void prepareBackgroundManager() {
  BackgroundManager backgroundManager = BackgroundManager.getInstance(getActivity());
  backgroundManager.attach(getActivity().getWindow());
  backgroundTarget = new PicassoBackgroundManagerTarget(backgroundManager);
  metrics = new DisplayMetrics();
  getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
}
 
Example 7
Source File: DetailFragment.java    From TuentiTV with Apache License 2.0 5 votes vote down vote up
private void configureBackground() {
  metrics = new DisplayMetrics();
  getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
  BackgroundManager backgroundManager = BackgroundManager.getInstance(getActivity());
  backgroundManager.attach(getActivity().getWindow());
  backgroundTarget = new PicassoBackgroundManagerTarget(backgroundManager);
}
 
Example 8
Source File: VideoDetailsFragment.java    From CumulusTV with MIT License 5 votes vote down vote up
private void prepareBackgroundManager() {
    mBackgroundManager = BackgroundManager.getInstance(getActivity());
    mBackgroundManager.attach(getActivity().getWindow());
    mDefaultBackground = getResources().getDrawable(R.drawable.c_background5);
    mMetrics = new DisplayMetrics();
    getActivity().getWindowManager().getDefaultDisplay().getMetrics(mMetrics);
}
 
Example 9
Source File: TVDemoFragment.java    From BuildingForAndroidTV with MIT License 5 votes vote down vote up
private void prepareBackgroundManager() {

        BackgroundManager backgroundManager = BackgroundManager.getInstance(getActivity());
        backgroundManager.attach(getActivity().getWindow());
        mBackgroundTarget = new PicassoBackgroundManagerTarget(backgroundManager);

        mDefaultBackground = getResources().getDrawable(R.drawable.default_background);

        mMetrics = new DisplayMetrics();
        getActivity().getWindowManager().getDefaultDisplay().getMetrics(mMetrics);
    }
 
Example 10
Source File: BackgroundHelper.java    From android-tv-leanback with Apache License 2.0 5 votes vote down vote up
public void prepareBackgroundManager() {
    mBackgroundManager = BackgroundManager.getInstance(mActivity);
    mBackgroundManager.attach(mActivity.getWindow());
    mBackgroundTarget = new PicassoBackgroundManagerTarget(mBackgroundManager);
    mDefaultBackground = ContextCompat.getDrawable(mActivity, R.drawable.default_background);
    mMetrics = new DisplayMetrics();
    mActivity.getWindowManager().getDefaultDisplay().getMetrics(mMetrics);
}
 
Example 11
Source File: BackgroundHelper.java    From android-tv-leanback with Apache License 2.0 5 votes vote down vote up
public void prepareBackgroundManager() {
    mBackgroundManager = BackgroundManager.getInstance(mActivity);
    mBackgroundManager.attach(mActivity.getWindow());
    mBackgroundTarget = new PicassoBackgroundManagerTarget(mBackgroundManager);
    mDefaultBackground = ContextCompat.getDrawable(mActivity, R.drawable.default_background);
    mMetrics = new DisplayMetrics();
    mActivity.getWindowManager().getDefaultDisplay().getMetrics(mMetrics);
}
 
Example 12
Source File: PageAndListRowFragment.java    From leanback-showcase with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setupUi();
    loadData();
    mBackgroundManager = BackgroundManager.getInstance(getActivity());
    mBackgroundManager.attach(getActivity().getWindow());
    getMainFragmentRegistry().registerFragment(PageRow.class,
            new PageRowFragmentFactory(mBackgroundManager));
}
 
Example 13
Source File: TVGridFragment.java    From BuildingForAndroidTV with MIT License 5 votes vote down vote up
private void prepareBackgroundManager() {
	BackgroundManager backgroundManager = BackgroundManager.getInstance(getActivity());
	backgroundManager.attach(getActivity().getWindow());
	mBackgroundTarget = new PicassoBackgroundManagerTarget(backgroundManager);

	mDefaultBackground = getResources().getDrawable(R.drawable.default_background);

	mMetrics = new DisplayMetrics();
	getActivity().getWindowManager().getDefaultDisplay().getMetrics(mMetrics);
}
 
Example 14
Source File: MovieDetailsFragment.java    From BuildingForAndroidTV with MIT License 5 votes vote down vote up
private void prepareBackgroundManager() {
    mBackgroundManager = BackgroundManager.getInstance(getActivity());
    mBackgroundManager.attach(getActivity().getWindow());
    mDefaultBackground = getResources().getDrawable(R.drawable.default_background);
    mMetrics = new DisplayMetrics();
    getActivity().getWindowManager().getDefaultDisplay().getMetrics(mMetrics);
}
 
Example 15
Source File: TVGridFragment.java    From BuildingForAndroidTV with MIT License 5 votes vote down vote up
private void prepareBackgroundManager() {
	BackgroundManager backgroundManager = BackgroundManager.getInstance(getActivity());
	backgroundManager.attach(getActivity().getWindow());
	mBackgroundTarget = new PicassoBackgroundManagerTarget(backgroundManager);

	mDefaultBackground = getResources().getDrawable(R.drawable.default_background);

	mMetrics = new DisplayMetrics();
	getActivity().getWindowManager().getDefaultDisplay().getMetrics(mMetrics);
}
 
Example 16
Source File: MainFragment.java    From BuildingForAndroidTV with MIT License 5 votes vote down vote up
private void prepareBackgroundManager() {
    mBackgroundManager = BackgroundManager.getInstance(getActivity());
    mBackgroundManager.attach(getActivity().getWindow());
    mDefaultBackground = getResources().getDrawable(R.drawable.default_background);
    mMetrics = new DisplayMetrics();
    getActivity().getWindowManager().getDefaultDisplay().getMetrics(mMetrics);
}
 
Example 17
Source File: TVDemoFragment.java    From BuildingForAndroidTV with MIT License 5 votes vote down vote up
private void prepareBackgroundManager() {

        BackgroundManager backgroundManager = BackgroundManager.getInstance(getActivity());
        backgroundManager.attach(getActivity().getWindow());
        mBackgroundTarget = new PicassoBackgroundManagerTarget(backgroundManager);

        mDefaultBackground = getResources().getDrawable(R.drawable.default_background);

        mMetrics = new DisplayMetrics();
        getActivity().getWindowManager().getDefaultDisplay().getMetrics(mMetrics);
    }
 
Example 18
Source File: PicassoBackgroundManager.java    From alltv with MIT License 5 votes vote down vote up
public PicassoBackgroundManager(Activity activity) {
    mActivity = activity;
    mDefaultBackground = activity.getDrawable(DEFAULT_BACKGROUND_RES_ID);
    mBackgroundManager = BackgroundManager.getInstance(activity);
    mBackgroundManager.attach(activity.getWindow());
    mBackgroundTarget = new PicassoBackgroundManagerTarget(mBackgroundManager);
    mMetrics = new DisplayMetrics();
    activity.getWindowManager().getDefaultDisplay().getMetrics(mMetrics);

}
 
Example 19
Source File: MainFragment.java    From AndroidDemoProjects with Apache License 2.0 4 votes vote down vote up
private void setBackground() {

        BackgroundManager backgroundManager = BackgroundManager.getInstance( getActivity() );
        backgroundManager.attach( getActivity().getWindow() );
        backgroundManager.setDrawable( getResources().getDrawable( R.drawable.default_background ) );
    }
 
Example 20
Source File: MainFragment.java    From leanback-homescreen-channels with Apache License 2.0 4 votes vote down vote up
private void prepareBackgroundManager() {
    mBackgroundManager = BackgroundManager.getInstance(getActivity());
    mBackgroundManager.attach(getActivity().getWindow());
    mMetrics = new DisplayMetrics();
    getActivity().getWindowManager().getDefaultDisplay().getMetrics(mMetrics);
}