Android Open Source - BuildingForAndroidTV Picasso Background Manager Target






From Project

Back to project page BuildingForAndroidTV.

License

The source code is released under:

MIT License

If you think the Android project BuildingForAndroidTV listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.sgottard.tvdemoapp;
//w ww.  j  a va2  s .  co m
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.support.v17.leanback.app.BackgroundManager;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.Target;

/**
 * Picasso target for updating default_background images
 */
public class PicassoBackgroundManagerTarget implements Target {
    BackgroundManager mBackgroundManager;

    public PicassoBackgroundManagerTarget(BackgroundManager backgroundManager) {
        this.mBackgroundManager = backgroundManager;
    }

    @Override
    public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom loadedFrom) {
        this.mBackgroundManager.setBitmap(bitmap);
    }

    @Override
    public void onBitmapFailed(Drawable drawable) {
        this.mBackgroundManager.setDrawable(drawable);
    }

    @Override
    public void onPrepareLoad(Drawable drawable) {
        // Do nothing, default_background manager has its own transitions
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;

        PicassoBackgroundManagerTarget that = (PicassoBackgroundManagerTarget) o;

        if (!mBackgroundManager.equals(that.mBackgroundManager))
            return false;

        return true;
    }

    @Override
    public int hashCode() {
        return mBackgroundManager.hashCode();
    }
}




Java Source Code List

com.sgottard.tvdemoapp.ApplicationTest.java
com.sgottard.tvdemoapp.ApplicationTest.java
com.sgottard.tvdemoapp.ApplicationTest.java
com.sgottard.tvdemoapp.CardPresenter.java
com.sgottard.tvdemoapp.CardPresenter.java
com.sgottard.tvdemoapp.CardPresenter.java
com.sgottard.tvdemoapp.CustomFrameLayout.java
com.sgottard.tvdemoapp.CustomHeadersFragment.java
com.sgottard.tvdemoapp.CustomHeadersFragment.java
com.sgottard.tvdemoapp.CustomRowsFragment.java
com.sgottard.tvdemoapp.CustomRowsFragment.java
com.sgottard.tvdemoapp.DetailsDescriptionPresenter.java
com.sgottard.tvdemoapp.DetailsDescriptionPresenter.java
com.sgottard.tvdemoapp.DetailsDescriptionPresenter.java
com.sgottard.tvdemoapp.MovieList.java
com.sgottard.tvdemoapp.MovieList.java
com.sgottard.tvdemoapp.MovieList.java
com.sgottard.tvdemoapp.Movie.java
com.sgottard.tvdemoapp.Movie.java
com.sgottard.tvdemoapp.Movie.java
com.sgottard.tvdemoapp.PicassoBackgroundManagerTarget.java
com.sgottard.tvdemoapp.PicassoBackgroundManagerTarget.java
com.sgottard.tvdemoapp.PicassoBackgroundManagerTarget.java
com.sgottard.tvdemoapp.PlayerActivity.java
com.sgottard.tvdemoapp.PlayerActivity.java
com.sgottard.tvdemoapp.PlayerActivity.java
com.sgottard.tvdemoapp.TVDemoActivity.java
com.sgottard.tvdemoapp.TVDemoActivity.java
com.sgottard.tvdemoapp.TVDemoActivity.java
com.sgottard.tvdemoapp.TVDemoFragment.java
com.sgottard.tvdemoapp.TVDemoFragment.java
com.sgottard.tvdemoapp.TVDemoFragment.java
com.sgottard.tvdemoapp.TVDetailsActivity.java
com.sgottard.tvdemoapp.TVDetailsActivity.java
com.sgottard.tvdemoapp.TVDetailsActivity.java
com.sgottard.tvdemoapp.TVGridActivity.java
com.sgottard.tvdemoapp.TVGridActivity.java
com.sgottard.tvdemoapp.TVGridActivity.java
com.sgottard.tvdemoapp.TVGridFragment.java
com.sgottard.tvdemoapp.TVGridFragment.java
com.sgottard.tvdemoapp.TVGridFragment.java
com.sgottard.tvdemoapp.TVSearchActivity.java
com.sgottard.tvdemoapp.TVSearchActivity.java
com.sgottard.tvdemoapp.TVSearchActivity.java
com.sgottard.tvdemoapp.TVSearchFragment.java
com.sgottard.tvdemoapp.TVSearchFragment.java
com.sgottard.tvdemoapp.TVSearchFragment.java
com.sgottard.tvdemoapp.TVVideoDetailsFragment.java
com.sgottard.tvdemoapp.TVVideoDetailsFragment.java
com.sgottard.tvdemoapp.TVVideoDetailsFragment.java
com.sgottard.tvdemoapp.Utils.java
com.sgottard.tvdemoapp.Utils.java
com.sgottard.tvdemoapp.Utils.java