With RecyclerView, is Picasso still needed?

Moving iOS forms recently, I realized that to quickly scroll through 100 large images,

this is quite a lot of work, and in practice you need to use Picasso (or perhaps Volley).

Now that RecyclerView is here - has anyone scrolled many large images using RecyclerView ?

If so, you need to use Picasso, as in the old days (i.e. last week)

Any conclusions on this? Greetings

+4
source share
2 answers

RecyclerView - , , AbsListView. API API - , , , .. API.

, . , Picasso:

@Override
public void onBindViewHolder(final MyViewHolder myViewHolder, final int i) {
    Picasso.withContext(mContext).load(myImageUrl).into(myViewHolder.imageView);
}

, :

RecyclerView - Android,

, , ListAdapter: ViewHolder convertView. RecyclerView , .

+24

, - , , .

import android.support.v7.widget.RecyclerView;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.scrolling.PicassoFlingScrollListener;


/**
 * Example Use:
 *     mRecyclerView.setOnScrollListener(new PicassoRecyclerViewScrollListener(mPicasso));
 * 
 * @author Simon Lightfoot <simon@demondevelopers.com>
 * 
 */
public static class PicassoRecyclerViewScrollListener implements RecyclerView.OnScrollListener
{
    private final PicassoFlingScrollListener    mListener;
    private final RecyclerView.OnScrollListener mDelegate;


    public PicassoRecyclerViewScrollListener(Picasso picasso)
    {
        this(picasso, null);
    }

    public PicassoRecyclerViewScrollListener(Picasso picasso, RecyclerView.OnScrollListener delegate)
    {
        mListener = new PicassoFlingScrollListener(picasso);
        mDelegate = delegate;
    }

    @Override
    public void onScrollStateChanged(int newState)
    {
        mListener.onScrollStateChanged(null, newState);
        if(mDelegate != null){
            mDelegate.onScrollStateChanged(newState);
        }
    }

    @Override
    public void onScrolled(int dx, int dy)
    {
        if(mDelegate != null){
            mDelegate.onScrolled(dx, dy);
        }
    }
}
0

Source: https://habr.com/ru/post/1546439/


All Articles