当前位置: 首页>>代码示例>>Java>>正文


Java Picasso类代码示例

本文整理汇总了Java中com.squareup.picasso.Picasso的典型用法代码示例。如果您正苦于以下问题:Java Picasso类的具体用法?Java Picasso怎么用?Java Picasso使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Picasso类属于com.squareup.picasso包,在下文中一共展示了Picasso类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import com.squareup.picasso.Picasso; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();

    if(!FirebaseApp.getApps(this).isEmpty()){
        FirebaseDatabase.getInstance().setPersistenceEnabled(true);
    }

    Picasso.Builder builder = new Picasso.Builder(this);
    builder.downloader(new OkHttp3Downloader(this, Integer.MAX_VALUE));
    Picasso built = builder.build();
    built.setIndicatorsEnabled(false);
    built.setLoggingEnabled(true);
    Picasso.setSingletonInstance(built);
}
 
开发者ID:Socialate,项目名称:furry-sniffle,代码行数:16,代码来源:Socialate.java

示例2: setUpBackdrop

import com.squareup.picasso.Picasso; //导入依赖的package包/类
private void setUpBackdrop(View view) {
    Context context = view.getContext();

    ImageView imgBackdrop = (ImageView) view.findViewById(R.id.iv_movie_backdrop);
    View viewOverlay = view.findViewById(R.id.view_backdrop_overlay);
    TextView tvTitle = (TextView) view.findViewById(R.id.tv_movie_detail_title);

    Picasso.with(context)
            .load(R.mipmap.civil_war_backdrop)
            .transform(new GrayscaleTransformation(Picasso.with(context)))
            .into(imgBackdrop);

    imgBackdrop.setContentDescription(mTitle);
    viewOverlay.setAlpha((float) 0.8);
}
 
开发者ID:ramadani,项目名称:Pilem,代码行数:16,代码来源:MovieDetailFragment.java

示例3: getItemView

import com.squareup.picasso.Picasso; //导入依赖的package包/类
@Override
public View getItemView(int sectionIndex, int position, View convertView,
		ViewGroup parent) {
	if (convertView == null) {
		convertView = LayoutInflater.from(context).inflate(
				R.layout.pic_view, parent, false);
	}
	ImageView img = (ImageView) convertView.findViewById(R.id.pic);
	if (hideImages) {
		int idx = position % colors.length;
		img.setBackgroundColor(colors[idx]);

	} else {
		Shot s = (Shot)(this.section.getData().get(position));
		Picasso.with(context)
				.load(s.getImage_teaser_url())
				.into(img);
	}

	return convertView;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:DribbbleDataAdapter.java

示例4: onBindViewHolder

import com.squareup.picasso.Picasso; //导入依赖的package包/类
@Override
public void onBindViewHolder(MyViewHolder holder, final int position) {
    if(holder.itemView.getScrollX()!=0){
        ((HorizontalScrollView)holder.itemView).fullScroll(View.FOCUS_UP);//如果item的HorizontalScrollView没在初始位置,则滚动回顶部
    }
    holder.ll.setMinimumWidth(screenwidth);//设置LinearLayout宽度为屏幕宽度
    holder.tv.setText("图"+position);
    Picasso.with(LineActivity2.this).load(meizis.get(position).getUrl()).into(holder.iv);

    holder.ll.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            SnackbarUtil.ShortSnackbar(coordinatorLayout,"点击第"+position+"个",SnackbarUtil.Info).show();
        }
    });
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:LineActivity2.java

示例5: initData

import com.squareup.picasso.Picasso; //导入依赖的package包/类
@Override
public void initData() {
    mCurrentUser = BmobUser.getCurrentUser(User.class);
    BmobFile userPhotoFile = mCurrentUser.getUserPhoto();
    String nick = mCurrentUser.getNick();
    String objectId = mCurrentUser.getObjectId();


    if (!TextUtils.isEmpty(nick)) {
        mTvName.setText(nick);
    }

    if (!TextUtils.isEmpty(objectId)) {
        mTvID.setText("飞鸽号:" + objectId);
    }

    if (userPhotoFile == null) {
        mCivUserPhoto.setImageResource(R.drawable.ic_default);
    } else {
        Picasso.with(getContext()).load(userPhotoFile.getFileUrl()).into(mCivUserPhoto);
    }

}
 
开发者ID:monsterLin,项目名称:Pigeon,代码行数:24,代码来源:PersonFragment.java

示例6: getView

import com.squareup.picasso.Picasso; //导入依赖的package包/类
@Override
public View getView(int i, View view) {

    ImageView iv = new ImageView(context);
    iv.setScaleType(ImageView.ScaleType.CENTER_CROP);
    iv.setBackgroundColor(Color.parseColor("#f5f5f5"));
    Picasso.with(context).load(getUrl(i)).placeholder(new ColorDrawable(Color.parseColor("#f5f5f5"))).into(iv);
    return iv;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:MyOrderAdapter.java

示例7: bind

import com.squareup.picasso.Picasso; //导入依赖的package包/类
void bind(Article article) {
    mData = article;

    if (!TextUtils.isEmpty(article.getCoverUrl())) {
        mBinding.coverView.setVisibility(View.VISIBLE);
        Picasso.with(itemView.getContext())
                .load(article.getCoverUrl())
                .centerCrop()
                .fit()
                .into(mBinding.coverView);
    } else {
        mBinding.coverView.setVisibility(View.GONE);
    }

    mBinding.titleView.setText(article.getTitle());
    mBinding.descriptionView.setText(article.getDescription());
}
 
开发者ID:nekocode,项目名称:Hubs,代码行数:18,代码来源:ArticleListAdapter.java

示例8: onBindViewHolder

import com.squareup.picasso.Picasso; //导入依赖的package包/类
@Override
public void onBindViewHolder(NewsVH holder, int position) {
    if (position == (mNewsArticleList.size()-1)) {
        mOnBottomReachedListener.onBottomReached();
    }
    final NewsArticle article = mNewsArticleList.get(position);
    String imageUrl = getNewsImagePath(article.getPulseImage().getCloudId());

    holder.newsTitle.setText(article.getTitle());
    holder.newsDate.setText(TextUtils.
            getFormattedDateForArticleFromUnixEpoch(article.getCreatedTimestamp()));
    Picasso.with(mContext)
            .load(imageUrl)
            .placeholder(R.drawable.placeholder_image)
            .into(holder.newsImage);

    holder.newsCard.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mNewsArticleListener.onNewsArticleClickListener(article);
        }
    });
}
 
开发者ID:Joel-Raju,项目名称:gamer-inside,代码行数:24,代码来源:NewsAdapter.java

示例9: getView

import com.squareup.picasso.Picasso; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    if(convertView==null) {
        holder=new ViewHolder();
        inflater=LayoutInflater.from(context);
        convertView= inflater.inflate(R.layout.videolist, parent, false);
        holder.tvtitle=(TextView) convertView.findViewById(R.id.videoTitletextview);
        holder.ivthumbnail=(ImageView) convertView.findViewById(R.id.videoPreviewThumb);
        convertView.setTag(holder);
    }
    else {
        holder=(ViewHolder)convertView.getTag();
    }
    holder.tvtitle.setText(video.get(position).getName());
    holder.tvtitle.setTypeface(typeface);
    Picasso.with(context).load("https://i.ytimg.com/vi/"+video.get(position).getVideoId().toString()+"/hqdefault.jpg").placeholder(R.drawable.logowhite).into(holder.ivthumbnail);

    return convertView;
}
 
开发者ID:rishabh115,项目名称:Odyssey2017,代码行数:21,代码来源:VideoListAdapter.java

示例10: onBindViewHolder

import com.squareup.picasso.Picasso; //导入依赖的package包/类
@Override
public void onBindViewHolder(RecyclerTestHolder holder, int position) {
    HomepageData.RecSpecialistBean data = datalist.get(position);
    HomepageData.RecSpecialistBean.ExperInfoBean experInfo = datalist.get(position).getExperInfo();

    Picasso.with(context)
            .load(UrlInfo.PREFIX_IMAGE_URL + experInfo.getAvatar())
            .into(holder.ivSchemeicon);
    String name = experInfo.getSname() + experInfo.getGname();
    holder.tvExpertName.setText(name);
    if (data.getTitle()!= null) {
        holder.tvExperttitle.setText(data.getTitle() + "");
    } else {
        holder.tvExperttitle.setText("");
    }

    holder.tvCompanyName.setText(experInfo.getEmployer());
    if (data.getSpecialty()!= null) {
        holder.tvExpertServiceMoney.setText("擅长:" + data.getSpecialty());
    } else {
        holder.tvExpertServiceMoney.setText("擅长:");
    }
    holder.BuyTimes.setText("已服务100次");
}
 
开发者ID:BittleDragon,项目名称:MyRepository,代码行数:25,代码来源:RecyclerTestAdapter.java

示例11: getImageView

import com.squareup.picasso.Picasso; //导入依赖的package包/类
private View getImageView(Context context, int resId) {
    /* 设置某一页面的view */
    RelativeLayout relativeLayout = new RelativeLayout(context);
    ImageView imageView = new ImageView(context);
    RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
    imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
    imageView.setLayoutParams(layoutParams);
    // 设置一个半透明的黑色背景,防止白字受白色图片干扰而无法显示
    ImageView background = new ImageView(context);
    background.setLayoutParams(layoutParams);
    background.setBackgroundResource(R.color.colorCycleViewBannerBackground);
    relativeLayout.addView(imageView);
    relativeLayout.addView(background);
    Picasso.with(context).load(resId).into(imageView);
    return relativeLayout;
}
 
开发者ID:hgs1217,项目名称:Paper-Melody,代码行数:18,代码来源:MainCycleViewPager.java

示例12: populateUserProfileData

import com.squareup.picasso.Picasso; //导入依赖的package包/类
private void populateUserProfileData() {
    repositories.setText(String.format(Locale.getDefault(), "%d", entry.getPublicRepos()));
    followers.setText(String.format(Locale.getDefault(), "%d", entry.getFollowers()));
    following.setText(String.format(Locale.getDefault(), "%d", entry.getFollowing()));

    Picasso pic = Picasso.with(this.getContext());
    if (entry.getImageUri() == null || entry.getImageUri().isEmpty()) {
        pic.load(R.drawable.octocat)
                .fit().centerCrop()
                .into(profilePoster);
    } else {
        pic.load(entry.getImageUri())
                .fit().centerCrop()
                .error(R.drawable.octocat)
                .into(profilePoster);
    }
}
 
开发者ID:OlgaKuklina,项目名称:GitJourney,代码行数:18,代码来源:UserProfileFragment.java

示例13: bindView

import com.squareup.picasso.Picasso; //导入依赖的package包/类
public void bindView(FeedItem feedItem, String userId) {
  this.feedItem = feedItem;
  Picasso.with(itemView.getContext())
      .load(Uri.parse(feedItem.getUserAvatarUrl()))
      .into(ivUserAvatar);
  tvUserName.setText(feedItem.getUserNickname());
  Picasso.with(itemView.getContext())
      .load(Uri.parse(feedItem.getPhotoSourceUrl()))
      .into(ivPhoto);
  if (feedItem.getPhotoDescription().isEmpty()) {
    tvDescription.setVisibility(View.GONE);
  } else {
    tvDescription.setVisibility(View.VISIBLE);
    tvDescription.setText(
        getStylizedText(feedItem.getUserNickname(), feedItem.getPhotoDescription()));
  }

  List<String> userLikes = feedItem.getUserLikes();
  int likesCount = userLikes != null ? userLikes.size() : 0;
  btnLike.setImageResource(
      userLikes != null && userLikes.contains(userId) ? R.drawable.ic_heart_red
          : R.drawable.ic_heart_outline_grey);
  tsLikesCounter.setCurrentText(
      itemView.getResources().getQuantityString(R.plurals.likes_count, likesCount, likesCount));
}
 
开发者ID:softonic,项目名称:instamaterial,代码行数:26,代码来源:FeedAdapter.java

示例14: notificationChange

import com.squareup.picasso.Picasso; //导入依赖的package包/类
@Override
public RemoteViews notificationChange(Notification notification, int notificationId, RemoteViews remoteViews) {

    if (mImageNotification != null) {
        remoteViews.setViewVisibility(R.id.notification_icon, View.VISIBLE);
        Picasso.with(this).load(mImageNotification)
                .into(remoteViews, R.id.notification_icon, notificationId, notification);
    }

    remoteViews.setViewVisibility(R.id.notification_title, View.VISIBLE);
    remoteViews.setTextViewText(R.id.notification_title, mTitle.getText().toString());

    remoteViews.setViewVisibility(R.id.notification_subtitle, View.VISIBLE);
    remoteViews.setTextViewText(R.id.notification_subtitle, mSubtitle.getText().toString());

    if (!mStop.isChecked()) {
        remoteViews.setViewVisibility(R.id.stop_icon, View.GONE);
    }

    if (!mPlayPause.isChecked()) {
        remoteViews.setViewVisibility(R.id.play_icon, View.GONE);
        remoteViews.setViewVisibility(R.id.pause_icon, View.GONE);
    }

    return remoteViews;
}
 
开发者ID:anthorlop,项目名称:AJCPlayer,代码行数:27,代码来源:SecondAudioActivity.java

示例15: onCreate

import com.squareup.picasso.Picasso; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_animal_detail);
    supportPostponeEnterTransition();

    Bundle extras = getIntent().getExtras();
    AnimalItem animalItem = extras.getParcelable(RecyclerViewActivity.EXTRA_ANIMAL_ITEM);

    ImageView imageView = (ImageView) findViewById(R.id.animal_detail_image_view);
    TextView textView = (TextView) findViewById(R.id.animal_detail_text);
    textView.setText(animalItem.detail);

    String imageUrl = animalItem.imageUrl;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        String imageTransitionName = extras.getString(RecyclerViewActivity.EXTRA_ANIMAL_IMAGE_TRANSITION_NAME);
        imageView.setTransitionName(imageTransitionName);
    }

    Picasso.with(this)
            .load(imageUrl)
            .noFade()
            .into(imageView, new Callback() {
                @Override
                public void onSuccess() {
                    supportStartPostponedEnterTransition();
                }

                @Override
                public void onError() {
                    supportStartPostponedEnterTransition();
                }
            });
}
 
开发者ID:mikescamell,项目名称:shared-element-transitions,代码行数:35,代码来源:AnimalDetailActivity.java


注:本文中的com.squareup.picasso.Picasso类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。