當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。