Android Open Source - ereaderhome Picasso Background Manager Target






From Project

Back to project page ereaderhome.

License

The source code is released under:

GNU General Public License

If you think the Android project ereaderhome 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 uk.co.droidinactu.ereaderhome;
/*  w ww  .j  av a 2 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

uk.co.droidinactu.ereaderhome.ApplicationInfo.java
uk.co.droidinactu.ereaderhome.ApplicationTest.java
uk.co.droidinactu.ereaderhome.ApplicationTest.java
uk.co.droidinactu.ereaderhome.ApplicationsStackLayout.java
uk.co.droidinactu.ereaderhome.CardPresenter.java
uk.co.droidinactu.ereaderhome.DetailsActivity.java
uk.co.droidinactu.ereaderhome.DetailsDescriptionPresenter.java
uk.co.droidinactu.ereaderhome.EBookDetailActivity.java
uk.co.droidinactu.ereaderhome.EBookDetailFragment.java
uk.co.droidinactu.ereaderhome.EBookListActivity.java
uk.co.droidinactu.ereaderhome.EBookListFragment.java
uk.co.droidinactu.ereaderhome.Home.java
uk.co.droidinactu.ereaderhome.MainActivity.java
uk.co.droidinactu.ereaderhome.MainActivity.java
uk.co.droidinactu.ereaderhome.MainFragment.java
uk.co.droidinactu.ereaderhome.MovieList.java
uk.co.droidinactu.ereaderhome.Movie.java
uk.co.droidinactu.ereaderhome.PicassoBackgroundManagerTarget.java
uk.co.droidinactu.ereaderhome.PlayerActivity.java
uk.co.droidinactu.ereaderhome.Utils.java
uk.co.droidinactu.ereaderhome.VideoDetailsFragment.java
uk.co.droidinactu.ereaderhome.Wallpaper.java
uk.co.droidinactu.ereaderhome.dummy.DummyContent.java