com.squareup.picasso.Picasso Java Examples

The following examples show how to use com.squareup.picasso.Picasso. 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: PicassoDataRequestHandler.java    From android with MIT License 6 votes vote down vote up
@Override
public Result load(Request request, int networkPolicy) {
    String uri = request.uri.toString();
    String imageDataBytes = uri.substring(uri.indexOf(",") + 1);
    byte[] bytes = Base64.decode(imageDataBytes.getBytes(), Base64.DEFAULT);
    Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);

    if (bitmap == null) {
        String show = uri.length() > 50 ? uri.substring(0, 49) + "..." : uri;
        RuntimeException malformed = new RuntimeException("Malformed data uri: " + show);
        Log.e("Could not load image", malformed);
        throw malformed;
    }

    return new Result(bitmap, Picasso.LoadedFrom.NETWORK);
}
 
Example #2
Source File: MyContactAdapter.java    From Retrofit_Example_Part_1 with Apache License 2.0 6 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    final ViewHolder vh;
    if (convertView == null) {
        View view = mInflater.inflate(R.layout.layout_row_view, parent, false);
        vh = ViewHolder.create((RelativeLayout) view);
        view.setTag(vh);
    } else {
        vh = (ViewHolder) convertView.getTag();
    }

    Contact item = getItem(position);

    vh.textViewName.setText(item.getName());
    vh.textViewEmail.setText(item.getEmail());
    Picasso.with(context).load(item.getProfilePic()).placeholder(R.mipmap.ic_launcher).error(R.mipmap.ic_launcher).into(vh.imageView);

    return vh.rootView;
}
 
Example #3
Source File: UserProfileActivity.java    From InstaMaterial with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_user_profile);

    this.avatarSize = getResources().getDimensionPixelSize(R.dimen.user_profile_avatar_size);
    this.profilePhoto = getString(R.string.user_profile_photo);

    Picasso.with(this)
            .load(profilePhoto)
            .placeholder(R.drawable.img_circle_placeholder)
            .resize(avatarSize, avatarSize)
            .centerCrop()
            .transform(new CircleTransformation())
            .into(ivUserProfilePhoto);

    setupTabs();
    setupUserProfileGrid();
    setupRevealBackground(savedInstanceState);
}
 
Example #4
Source File: PostAdapter.java    From Ruisi with Apache License 2.0 6 votes vote down vote up
@Override
void setData(int position) {
    final SingleArticleData single = datalist.get(position);
    title.setText(single.title);
    userName.setText(single.username);
    String imgUrl = UrlUtils.getAvaterurlm(single.getImg());
    if (single.uid > 0) {
        Picasso.get()
            .load(imgUrl)
            .resize(size, size)
            .placeholder(R.drawable.image_placeholder)
            .error(R.drawable.image_placeholder)
            .into(userAvatar);
    } else {
        Picasso.get()
            .load(R.drawable.image_placeholder)
            .resize(size, size)
            .into(userAvatar);
    }
    
    String postTime = "发表于:" + single.postTime;
    this.postTime.setText(postTime);
    HtmlView.parseHtml(single.content).into(content);
}
 
Example #5
Source File: InvitedDialogFragment.java    From AndroidPlayground with MIT License 6 votes vote down vote up
private void setupView(View view) {
    mAvatar = findById(view, R.id.mFromAvatar);
    Picasso.with(getContext()).load(mFromUserAvatar).into(mAvatar);

    CountdownView countdownView = findById(view, R.id.mCountDownTimber);
    countdownView.start(INVITE_EXPIRE_MILLIS);
    countdownView.setOnCountdownEndListener(new CountdownView.OnCountdownEndListener() {
        @Override
        public void onEnd(CountdownView cv) {
            dismiss();
        }
    });

    ImageView deny = findById(view, R.id.mIvDeny);
    deny.setOnClickListener(this);
    ImageView accept = findById(view, R.id.mIvAccept);
    accept.setOnClickListener(this);
}
 
Example #6
Source File: RecyclerAdapterScaleTeamsAutomatic.java    From intra42 with Apache License 2.0 6 votes vote down vote up
@Override
public void onBindViewHolder(@NonNull final ViewHolderScaleTeam holder, int position) {
    TeamsUploads item = getItem(position);

    Picasso picasso = Picasso.get();
    RequestCreator requestCreator;
    String url = UserImage.BASE_URL + "moulinette.jpg";
    requestCreator = picasso.load(url).resize(200, 240);
    requestCreator.into(holder.imageViewUser);

    holder.textViewCorrector.setText(R.string.project_moulinette);
    holder.textViewScale.setText(String.valueOf(item.finalMark));
    holder.textViewComment.setText(item.comment);
    holder.groupFeedback.setVisibility(View.GONE);
    holder.textViewUserFeedback.setVisibility(View.GONE);

}
 
Example #7
Source File: ManageIgnoreListQuickActionsAdapter.java    From PADListener with GNU General Public License v2.0 6 votes vote down vote up
private void bindOneImage(int position, ImageView monsterImageView, Integer monsterId, boolean alreadyIgnored) {
	MyLog.entry("position = " + position);

	monsterImageView.clearColorFilter();

	if (monsterId != null && mTaskFragment.getMonsterInfoHelper() != null) {
		monsterImageView.setVisibility(View.VISIBLE);
		try {
			final MonsterInfoModel monsterInfo = mTaskFragment.getMonsterInfoHelper().getMonsterInfo(monsterId);
			mImageHelper.fillImage(monsterImageView, monsterInfo);

			if (!alreadyIgnored) {
				monsterImageView.setColorFilter(Color.parseColor("#99000000"), PorterDuff.Mode.DARKEN);
			}
		} catch (UnknownMonsterException e) {
			Picasso.with(getContext())
					.load(R.drawable.no_monster_image)
					.into(monsterImageView);
		}
	} else {
		MyLog.debug("no monster at " + position + ", ignored");
		monsterImageView.setVisibility(View.INVISIBLE);
	}
	MyLog.exit();
}
 
Example #8
Source File: FantasyFragment.java    From catnut with MIT License 6 votes vote down vote up
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
	boolean fitXY = getArguments().getBoolean(FIT_XY);
	if (getActivity() instanceof HelloActivity) {
		if (!((HelloActivity) getActivity()).isNetworkAvailable()) {
			if (fitXY) {
				Toast.makeText(getActivity(), R.string.network_unavailable, Toast.LENGTH_SHORT).show();
				mFantasy.setImageResource(R.drawable.default_fantasy);
				return; // 没有网络,直接结束第一张fantasy
			}
		}
	}
	RequestCreator creator = Picasso.with(getActivity()).load(mUrl);
	if (fitXY) {
		creator.placeholder(R.drawable.default_fantasy);
	}
	creator.error(R.drawable.error)
			.into(target);
}
 
Example #9
Source File: ContactEditText.java    From material with Apache License 2.0 6 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ContactView v = (ContactView)convertView;
    if (v == null)
        v = new ContactView(getContext(), null, 0, R.style.ContactView);

    Recipient recipient = (Recipient) getItem(position);
    v.setNameText(recipient.name);
    v.setAddressText(recipient.number);

    if(TextUtils.isEmpty(recipient.lookupKey))
        v.setAvatarResource(mDefaultAvatarId);
    else
        Picasso.with(getContext())
                .load(Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_LOOKUP_URI, recipient.lookupKey))
                .placeholder(mDefaultAvatarId)
                .into(v);

    return v;
}
 
Example #10
Source File: OtherAdapter.java    From MaterialWpp with Apache License 2.0 6 votes vote down vote up
@Override
public void onBindViewHolder(final MyHolder holder, final int position) {
        Picasso.with(holder.itemView.getContext()).load(datums.get(position).getSmallImgUrl())
        .noPlaceholder()
        .into(holder.imageView);
        holder.title.setText(datums.get(position).getLikesCount());
        holder.itemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent=new Intent(holder.itemView.getContext(), DetailActivity.class);
            intent.putExtra("id",pid);
            intent.putExtra("index",position);
            intent.putExtra("sourcetype",3);
            intent.putExtra("order","1");
            intent.putExtra("update",0);
            holder.itemView.getContext().startActivity(intent);
        }
    });

        }
 
Example #11
Source File: AppContext.java    From monolog-android with MIT License 6 votes vote down vote up
public void loadImg(ImageView v, String url, int width) {
    String absoluteUrl = url;
    try {
        Picasso.with(this)
                .load(absoluteUrl)
                .placeholder(R.drawable.img_bg)
                .error(R.drawable.ic_action_picture)
                .transform(new CropSquareTransformation())
                .resize(width, width)
                .into(v);
    } catch (Exception ex) {
        Picasso.with(this)
                .load(R.drawable.img_bg)
                .transform(new CropSquareTransformation())
                .into(v);
    }
}
 
Example #12
Source File: ArtistView.java    From Cheerleader with Apache License 2.0 6 votes vote down vote up
/**
 * Set the {@link SoundCloudUser} used as model.
 *
 * @param artist user used as artist.
 */
public void setModel(SoundCloudUser artist) {
    mModel = artist;
    if (mModel != null) {
        Picasso.with(getContext())
                .load(
                        SoundCloudArtworkHelper.getCoverUrl(
                                mModel,
                                SoundCloudArtworkHelper.XLARGE
                        )
                )
                .fit()
                .centerInside()
                .into(mAvatar);
        mArtistName.setText(mModel.getFullName());
        mTracks.setText(
                String.format(
                        getResources().getString(R.string.artist_view_track_count),
                        mModel.getTrackCount()
                )
        );
        mDescription.setText(Html.fromHtml(mModel.getDescription()));
        this.setVisibility(VISIBLE);
    }
}
 
Example #13
Source File: VideoDetailsFragment.java    From android-tv-leanback with Apache License 2.0 6 votes vote down vote up
@Override
protected DetailsOverviewRow doInBackground(Video... videos) {
    DetailsOverviewRow row = new DetailsOverviewRow(videos[0]);
    try {
        Bitmap poster = Picasso.with(getActivity())
                .load(videos[0].getThumbUrl())
                .resize(dpToPx(DETAIL_THUMB_WIDTH, getActivity().getApplicationContext()),
                        dpToPx(DETAIL_THUMB_HEIGHT, getActivity().getApplicationContext()))
                .centerCrop()
                .get();
        row.setImageBitmap(getActivity(), poster);
    } catch (IOException e) {
        Log.e("VideoDetailsFragment", "Cannot load thumbnail for " + videos[0].getId(), e);
    }

    SparseArrayObjectAdapter adapter = new SparseArrayObjectAdapter();
    adapter.set(ACTION_PLAY, new Action(ACTION_PLAY, getResources().getString(
            R.string.action_play)));
    adapter.set(ACTION_WATCH_LATER, new Action(ACTION_WATCH_LATER, getResources().getString(R.string.action_watch_later)));
    row.setActionsAdapter(adapter);

    return row;
}
 
Example #14
Source File: SearchUserActivity.java    From android-pdk with Apache License 2.0 5 votes vote down vote up
private void showUser() {
    if (user != null) {
        followButton.setVisibility(View.VISIBLE);
        userImageView.setVisibility(View.VISIBLE);
        userName.setVisibility(View.VISIBLE);

        userName.setText(user.getFirstName() + " " + user.getLastName() );
        Picasso.with(this).load(user.getImageUrl()).into(userImageView);
    }
}
 
Example #15
Source File: ProductActivity.java    From product-catalogue-android with MIT License 5 votes vote down vote up
private void generateThumbnail(String url, final int position, int size) {
  ImageView imageView = new ImageView(this);
  imageView.setLayoutParams(new LinearLayoutCompat.LayoutParams(size, size));
  imageView.setBackgroundResource(R.drawable.thumbnail_bg);
  Picasso.with(this).load(url).fit().centerInside().into(imageView);
  imageView.setOnClickListener(new View.OnClickListener() {
    @Override public void onClick(View v) {
      imagesPager.setCurrentItem(position, true);
    }
  });
  thumbnails.addView(imageView);
}
 
Example #16
Source File: VideoCollectionAdapter.java    From BuildmLearn-Toolkit-Android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public View getView(final int position, View convertView, ViewGroup parent) {

    VideoTemplateHolder holder;

    if (convertView == null) {
        LayoutInflater inflater = LayoutInflater.from(mContext);
        convertView = inflater.inflate(R.layout.video_template_item, parent, false);
        holder = new VideoTemplateHolder();
    } else {
        holder = (VideoTemplateHolder) convertView.getTag();
    }

    holder.thumb = (ImageView) convertView.findViewById(R.id.thumb);
    holder.title = (TextViewPlus) convertView.findViewById(R.id.title);
    holder.description = (TextViewPlus) convertView.findViewById(R.id.description);

    VideoModel video = getItem(position);
    holder.description.setText(Html.fromHtml("<b>" + "Description :  " + "</b> " + video.getDescription()));
    holder.title.setText(Html.fromHtml("<b>" + "Title :  " + "</b> " + video.getTitle()));

    if (video.getThumbnailUrl().length() > 0) {
        Picasso
                .with(mContext)
                .load(video.getThumbnailUrl())
                .transform(new RoundedTransformation(20, 20))
                .fit()
                .centerCrop()
                .into(holder.thumb);
        holder.thumb.setAdjustViewBounds(true);
    }

    convertView.setTag(holder);
    return convertView;
}
 
Example #17
Source File: ImageGridAdapter.java    From MultiImageSelector with MIT License 5 votes vote down vote up
void bindData(final Image data){
    if(data == null) return;
    // 处理单选和多选状态
    if(showSelectIndicator){
        indicator.setVisibility(View.VISIBLE);
        if(mSelectedImages.contains(data)){
            // 设置选中状态
            indicator.setImageResource(R.drawable.mis_btn_selected);
            mask.setVisibility(View.VISIBLE);
        }else{
            // 未选择
            indicator.setImageResource(R.drawable.mis_btn_unselected);
            mask.setVisibility(View.GONE);
        }
    }else{
        indicator.setVisibility(View.GONE);
    }
    File imageFile = new File(data.path);
    if (imageFile.exists()) {
        // 显示图片
        Picasso.with(mContext)
                .load(imageFile)
                .placeholder(R.drawable.mis_default_error)
                .tag(MultiImageSelectorFragment.TAG)
                .resize(mGridWidth, mGridWidth)
                .centerCrop()
                .into(image);
    }else{
        image.setImageResource(R.drawable.mis_default_error);
    }
}
 
Example #18
Source File: UpdateUserInfoActivity.java    From Pigeon with MIT License 5 votes vote down vote up
@Override
public void initData() {

    mCurrentUser = BmobUser.getCurrentUser(User.class);

    if (!TextUtils.isEmpty(mCurrentUser.getNick())) {
        mEdtNick.setText(mCurrentUser.getNick());
    }

    if (mCurrentUser.getAge() == 0) {
        mEdtAge.setText("");
    } else {
        mEdtAge.setText(String.valueOf(mCurrentUser.getAge()));
    }
    mEdtPhone.setText(mCurrentUser.getMobilePhoneNumber());

    typeInt = mCurrentUser.getType();

    if (typeInt == 0) {
        //子女
        mRRChild.setChecked(true);
        mRRParent.setChecked(false);
    } else if (typeInt == 1) {
        //父母
        mRRChild.setChecked(false);
        mRRParent.setChecked(true);
    }

    BmobFile userPhotoFile = mCurrentUser.getUserPhoto();
    if (userPhotoFile != null) {
        Picasso.with(UpdateUserInfoActivity.this).load(userPhotoFile.getFileUrl()).into(mCivPhoto);
    } else {
        mCivPhoto.setImageResource(R.drawable.ic_default);
    }

}
 
Example #19
Source File: MockRequestHandler.java    From u2020-mvp with Apache License 2.0 5 votes vote down vote up
@Override public Result load(Request request, int networkPolicy) throws IOException {
    String imagePath = request.uri.getPath().substring(1); // Grab only the path sans leading slash.

    // Check the disk cache for the image. A non-null return value indicates a hit.
    boolean cacheHit = emulatedDiskCache.get(imagePath) != null;

    // If there's a hit, grab the image stream and return it.
    if (cacheHit) {
        return new Result(loadBitmap(imagePath), Picasso.LoadedFrom.DISK);
    }

    // If we are not allowed to hit the network and the cache missed return a big fat nothing.
    if (NetworkPolicy.isOfflineOnly(networkPolicy)) {
        return null;
    }

    // If we got this far there was a cache miss and hitting the network is required. See if we need
    // to fake an network error.
    if (behavior.calculateIsFailure()) {
        SystemClock.sleep(behavior.calculateDelay(MILLISECONDS));
        throw new IOException("Fake network error!");
    }

    // We aren't throwing a network error so fake a round trip delay.
    SystemClock.sleep(behavior.calculateDelay(MILLISECONDS));

    // Since we cache missed put it in the LRU.
    AssetFileDescriptor fileDescriptor = assetManager.openFd(imagePath);
    long size = fileDescriptor.getLength();
    fileDescriptor.close();
    emulatedDiskCache.put(imagePath, size);

    // Grab the image stream and return it.
    return new Result(loadBitmap(imagePath), Picasso.LoadedFrom.NETWORK);
}
 
Example #20
Source File: BaseImageView.java    From android-base-mvp with Apache License 2.0 5 votes vote down vote up
public void setImageUrl(String url, int placeHolderDrawable, Drawable errorDrawable) {
    mImageUrl = url;
    Picasso.get()
            .load(url)
            .placeholder(placeHolderDrawable)
            .error(errorDrawable)
            .into(this);
}
 
Example #21
Source File: VirtualViewRenderService.java    From Tangram-Android with MIT License 5 votes vote down vote up
@Override
public void bindImage(String uri, final ImageBase imageBase, int reqWidth, int reqHeight) {
    RequestCreator requestCreator = Picasso.with(tangramEngine.getContext()).load(uri);
    Log.d("TangramActivity", "bindImage request width height " + reqHeight + " " + reqWidth);
    if (reqHeight > 0 || reqWidth > 0) {
        requestCreator.resize(reqWidth, reqHeight);
    }
    ImageTarget imageTarget = new ImageTarget(imageBase);
    cache.add(imageTarget);
    requestCreator.into(imageTarget);
}
 
Example #22
Source File: PostAdapter.java    From quill with MIT License 5 votes vote down vote up
public PostAdapter(Context context, List<Post> posts, String blogUrl, Picasso picasso,
                   View.OnClickListener itemClickListener) {
    mContext = context;
    mBlogUrl = blogUrl;
    mPicasso = picasso;
    mLayoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    mPosts = posts;
    mItemClickListener = itemClickListener;

    mLowAlphaPaint = new Paint();
    mLowAlphaPaint.setColorFilter(new ColorMatrixColorFilter(new float[] {
            1,     0,     0,     0,     0,    // red
            0,     1,     0,     0,     0,    // green
            0,     0,     1,     0,     0,    // blue
            0,     0,     0,     0.5f,  0,    // alpha
    }));

    mGhostAndroidTip = new Tip(R.drawable.quill_to_ghost_small,
            context.getString(R.string.quill_is_now_ghost_android),
            Arrays.asList(
                    new Tip.Action(R.drawable.play_store, context.getString(R.string.ghost_android_download), v -> {
                        context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=org.ghost.android")));
                    }),
                    new Tip.Action(R.drawable.help_circle, context.getString(R.string.ghost_android_announcement), v -> {
                        context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://blog.ghost.org/android")));
                    })));

    setHasStableIds(true);
}
 
Example #23
Source File: PicassoImageLoader.java    From ImagePicker with Apache License 2.0 5 votes vote down vote up
@Override
public void displayImage(Activity activity, String path, ImageView imageView, int width, int height) {
    Picasso.with(activity)//
            .load(Uri.fromFile(new File(path)))//
            .placeholder(R.drawable.ic_default_image)//
            .error(R.drawable.ic_default_image)//
            .resize(width, height)//
            .centerInside()//
            .memoryPolicy(MemoryPolicy.NO_CACHE, MemoryPolicy.NO_STORE)//
            .into(imageView);
}
 
Example #24
Source File: DrinksAdapter.java    From Drinks with Apache License 2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(final TileViewHolder holder, int position) {
    final Drink drink = filteredDrinks.get(position);
    holder.getNameView().setText(drink.getName());

    RatioImageView imageView = holder.getImageView();
    switch (getItemViewType(position)) {
        case TYPE_34:
            imageView.setRatio(RATIO_34);
            break;
        case TYPE_43:
            imageView.setRatio(RATIO_43);
            break;
        default:
            throw new IllegalArgumentException("Unknown ratio type");
    }

    Context context = holder.itemView.getContext();

    Picasso.with(context)
            .load(drink.getImageUrl())
            .fit()
            .placeholder(placeHolders.get(context, position))
            .centerCrop()
            .into(imageView);

    if (listener != null) {
        holder.itemView.setOnClickListener(v -> listener.onItemClick(holder.getAdapterPosition(), drink));
    }
}
 
Example #25
Source File: ViewerFragment.java    From meizhi with Apache License 2.0 5 votes vote down vote up
@Override
public void onResume() {
    super.onResume();
    Picasso picasso = Picasso.with(activity);
    picasso.setLoggingEnabled(true);
    picasso.load(url).into(image);
}
 
Example #26
Source File: DebugDataModule.java    From u2020-mvp with Apache License 2.0 5 votes vote down vote up
@Provides
@ApplicationScope
Picasso providePicasso(OkHttpClient client, NetworkBehavior behavior,
                       @IsMockMode boolean isMockMode, Application app) {
    Picasso.Builder builder = new Picasso.Builder(app).downloader(new OkHttp3Downloader(client));
    if (isMockMode) {
        builder.addRequestHandler(new MockRequestHandler(behavior, app.getAssets()));
    }
    builder.listener((picasso, uri, exception) -> Timber.e(exception, "Error while loading image %s", uri));
    return builder.build();
}
 
Example #27
Source File: GridAdapter.java    From materialandroid with Apache License 2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(GridViewHolder holder, int position) {
  String url = images[position];
  Picasso.with(context)
      .load(url)
      .fit()
      .into(holder.imageView);
  setupLabel(holder.labelView);
  holder.labelView.setIconGravity(iconGravity);
}
 
Example #28
Source File: PicassoEngine.java    From PictureSelector with Apache License 2.0 5 votes vote down vote up
/**
 * 加载图片列表图片
 *
 * @param context   上下文
 * @param url       图片路径
 * @param imageView 承载图片ImageView
 */
@Override
public void loadGridImage(@NonNull Context context, @NonNull String url, @NonNull ImageView imageView) {
    VideoRequestHandler videoRequestHandler = new VideoRequestHandler();
    if (PictureMimeType.isContent(url)) {
        Picasso.get()
                .load(Uri.parse(url))
                .resize(200, 200)
                .centerCrop()
                .placeholder(R.drawable.picture_image_placeholder)
                .into(imageView);
    } else {
        if (PictureMimeType.isUrlHasVideo(url)) {
            Picasso picasso = new Picasso.Builder(context.getApplicationContext())
                    .addRequestHandler(videoRequestHandler)
                    .build();
            picasso.load(videoRequestHandler.SCHEME_VIDEO + ":" + url)
                    .resize(200, 200)
                    .centerCrop()
                    .placeholder(R.drawable.picture_image_placeholder)
                    .into(imageView);
        } else {
            Picasso.get()
                    .load(new File(url))
                    .resize(200, 200)
                    .centerCrop()
                    .placeholder(R.drawable.picture_image_placeholder)
                    .into(imageView);
        }
    }
}
 
Example #29
Source File: TitleListViewAdapter.java    From xmpp with Apache License 2.0 5 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    if (convertView == null) {
        convertView = LayoutInflater.from(context).inflate(R.layout.listview_item, null);
        holder = new ViewHolder();
        holder.iv_icon = (ImageView) convertView.findViewById(R.id.listview_item_imageview_icon);
        holder.tv_title = (TextView) convertView.findViewById(R.id.listview_item_textView_title);
       // holder.tv_zhaiyao = (TextView) convertView.findViewById(R.id.listview_item_textView_zhaiyao);
        holder.tv_pinglun = (TextView) convertView.findViewById(R.id.listview_item_textView_pinglun);
        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }
    String[] str=list.get(position).getCimage().split(";");
    holder.tv_title.setText(list.get(position).getCtitle());
  //  holder.tv_zhaiyao.setText(list.get(position).getCzhaiyao());
    holder.tv_pinglun.setText(list.get(position).getCpinglun() + "评 ");
    if(str[0].contains("http")){
        Picasso.with(context).load(str[0]).resize(200,200).centerInside().placeholder(R.mipmap.aio_image_default_round).error(R.mipmap.aio_image_default_round).into(holder.iv_icon);

    }else{
        Picasso.with(context).load(Ip.ip+str[0]).resize(200,200).centerInside().placeholder(R.mipmap.aio_image_default_round).error(R.mipmap.aio_image_default_round).into(holder.iv_icon);

    }


    return convertView;
}
 
Example #30
Source File: MainActivity.java    From ExoPlayer-Wrapper with Apache License 2.0 5 votes vote down vote up
/**
 * ExoPlayerListener
 */

@Override
public void onThumbImageViewReady(ImageView imageView) {
    Picasso.get()
            .load(THUMB_IMG_URL)
            //.fit()
            .placeholder(R.drawable.place_holder)
            .error(R.drawable.error_image)
            .into(imageView);
}